Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: chrome/browser/resources/cryptotoken/singlesigner.js

Issue 799923007: Enable 3rd party support for Security Keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove duplicate line from merge Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview A single gnubby signer wraps the process of opening a gnubby, 6 * @fileoverview A single gnubby signer wraps the process of opening a gnubby,
7 * signing each challenge in an array of challenges until a success condition 7 * signing each challenge in an array of challenges until a success condition
8 * is satisfied, and finally yielding the gnubby upon success. 8 * is satisfied, and finally yielding the gnubby upon success.
9 * 9 *
10 */ 10 */
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 }; 247 };
248 248
249 /** 249 /**
250 * Called with the result of a version command. 250 * Called with the result of a version command.
251 * @param {number} rc Result of version command. 251 * @param {number} rc Result of version command.
252 * @param {ArrayBuffer=} opt_data Version. 252 * @param {ArrayBuffer=} opt_data Version.
253 * @private 253 * @private
254 */ 254 */
255 SingleGnubbySigner.prototype.versionCallback_ = function(rc, opt_data) { 255 SingleGnubbySigner.prototype.versionCallback_ = function(rc, opt_data) {
256 if (rc == DeviceStatusCodes.BUSY_STATUS) {
257 if (this.timer_ && this.timer_.expired()) {
258 this.goToError_(DeviceStatusCodes.TIMEOUT_STATUS);
259 return;
260 }
261 // There's still time: resync and retry.
262 var self = this;
263 this.gnubby_.sync(function(code) {
264 if (code) {
265 self.goToError_(code, true);
266 return;
267 }
268 self.gnubby_.version(self.versionCallback_.bind(self));
269 });
270 return;
271 }
256 if (rc) { 272 if (rc) {
257 this.goToError_(rc, true); 273 this.goToError_(rc, true);
258 return; 274 return;
259 } 275 }
260 this.state_ = SingleGnubbySigner.State.IDLE; 276 this.state_ = SingleGnubbySigner.State.IDLE;
261 this.version_ = UTIL_BytesToString(new Uint8Array(opt_data || [])); 277 this.version_ = UTIL_BytesToString(new Uint8Array(opt_data || []));
262 this.doSign_(this.challengeIndex_); 278 this.doSign_(this.challengeIndex_);
263 }; 279 };
264 280
265 /** 281 /**
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 result['challenge'] = opt_challenge; 467 result['challenge'] = opt_challenge;
452 } 468 }
453 if (opt_info) { 469 if (opt_info) {
454 result['info'] = opt_info; 470 result['info'] = opt_info;
455 } 471 }
456 } 472 }
457 this.completeCb_(result); 473 this.completeCb_(result);
458 // this.gnubby_ is now owned by completeCb_. 474 // this.gnubby_ is now owned by completeCb_.
459 this.gnubby_ = null; 475 this.gnubby_ = null;
460 }; 476 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/cryptotoken/manifest.json ('k') | chrome/browser/resources/cryptotoken/usbsignhandler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698