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

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

Issue 607913003: Improved error reporting in cryptotoken (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « no previous file | chrome/browser/resources/cryptotoken/errorcodes.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Handles web page requests for gnubby enrollment. 6 * @fileoverview Handles web page requests for gnubby enrollment.
7 */ 7 */
8 8
9 'use strict'; 9 'use strict';
10 10
11 /** 11 /**
12 * Handles a web enroll request. 12 * Handles a web enroll request.
13 * @param {MessageSender} sender The sender of the message. 13 * @param {MessageSender} sender The sender of the message.
14 * @param {Object} request The web page's enroll request. 14 * @param {Object} request The web page's enroll request.
15 * @param {Function} sendResponse Called back with the result of the enroll. 15 * @param {Function} sendResponse Called back with the result of the enroll.
16 * @return {Closeable} A handler object to be closed when the browser channel 16 * @return {Closeable} A handler object to be closed when the browser channel
17 * closes. 17 * closes.
18 */ 18 */
19 function handleWebEnrollRequest(sender, request, sendResponse) { 19 function handleWebEnrollRequest(sender, request, sendResponse) {
20 var sentResponse = false; 20 var sentResponse = false;
21 var closeable; 21 var closeable = null;
22 22
23 function sendErrorResponse(u2fCode) { 23 function sendErrorResponse(error) {
24 var response = makeWebErrorResponse(request, 24 var response = makeWebErrorResponse(request,
25 mapErrorCodeToGnubbyCodeType(u2fCode, false /* forSign */)); 25 mapErrorCodeToGnubbyCodeType(error.errorCode, false /* forSign */));
26 sendResponseOnce(sentResponse, closeable, response, sendResponse); 26 sendResponseOnce(sentResponse, closeable, response, sendResponse);
27 } 27 }
28 28
29 function sendSuccessResponse(u2fVersion, info, browserData) { 29 function sendSuccessResponse(u2fVersion, info, browserData) {
30 var enrollChallenges = request['enrollChallenges']; 30 var enrollChallenges = request['enrollChallenges'];
31 var enrollChallenge = 31 var enrollChallenge =
32 findEnrollChallengeOfVersion(enrollChallenges, u2fVersion); 32 findEnrollChallengeOfVersion(enrollChallenges, u2fVersion);
33 if (!enrollChallenge) { 33 if (!enrollChallenge) {
34 sendErrorResponse(ErrorCodes.OTHER_ERROR); 34 sendErrorResponse(ErrorCodes.OTHER_ERROR);
35 return; 35 return;
36 } 36 }
37 var responseData = 37 var responseData =
38 makeEnrollResponseData(enrollChallenge, u2fVersion, 38 makeEnrollResponseData(enrollChallenge, u2fVersion,
39 'enrollData', info, 'browserData', browserData); 39 'enrollData', info, 'browserData', browserData);
40 var response = makeWebSuccessResponse(request, responseData); 40 var response = makeWebSuccessResponse(request, responseData);
41 sendResponseOnce(sentResponse, closeable, response, sendResponse); 41 sendResponseOnce(sentResponse, closeable, response, sendResponse);
42 } 42 }
43 43
44 closeable = 44 var enroller =
45 validateAndBeginEnrollRequest( 45 validateEnrollRequest(
46 sender, request, 'enrollChallenges', 'signData', 46 sender, request, 'enrollChallenges', 'signData',
47 sendErrorResponse, sendSuccessResponse); 47 sendErrorResponse, sendSuccessResponse);
48 if (enroller) {
49 var registerRequests = request['enrollChallenges'];
50 var signRequests = getSignRequestsFromEnrollRequest(request, 'signData');
51 closeable = /** @type {Closeable} */ (enroller);
52 enroller.doEnroll(registerRequests, signRequests, request['appId']);
53 }
48 return closeable; 54 return closeable;
49 } 55 }
50 56
51 /** 57 /**
52 * Handles a U2F enroll request. 58 * Handles a U2F enroll request.
53 * @param {MessageSender} sender The sender of the message. 59 * @param {MessageSender} sender The sender of the message.
54 * @param {Object} request The web page's enroll request. 60 * @param {Object} request The web page's enroll request.
55 * @param {Function} sendResponse Called back with the result of the enroll. 61 * @param {Function} sendResponse Called back with the result of the enroll.
56 * @return {Closeable} A handler object to be closed when the browser channel 62 * @return {Closeable} A handler object to be closed when the browser channel
57 * closes. 63 * closes.
58 */ 64 */
59 function handleU2fEnrollRequest(sender, request, sendResponse) { 65 function handleU2fEnrollRequest(sender, request, sendResponse) {
60 var sentResponse = false; 66 var sentResponse = false;
61 var closeable; 67 var closeable = null;
62 68
63 function sendErrorResponse(u2fCode) { 69 function sendErrorResponse(error) {
64 var response = makeU2fErrorResponse(request, u2fCode); 70 var response = makeU2fErrorResponse(request, error.errorCode,
71 error.errorMessage);
65 sendResponseOnce(sentResponse, closeable, response, sendResponse); 72 sendResponseOnce(sentResponse, closeable, response, sendResponse);
66 } 73 }
67 74
68 function sendSuccessResponse(u2fVersion, info, browserData) { 75 function sendSuccessResponse(u2fVersion, info, browserData) {
69 var enrollChallenges = request['registerRequests']; 76 var enrollChallenges = request['registerRequests'];
70 var enrollChallenge = 77 var enrollChallenge =
71 findEnrollChallengeOfVersion(enrollChallenges, u2fVersion); 78 findEnrollChallengeOfVersion(enrollChallenges, u2fVersion);
72 if (!enrollChallenge) { 79 if (!enrollChallenge) {
73 sendErrorResponse(ErrorCodes.OTHER_ERROR); 80 sendErrorResponse(ErrorCodes.OTHER_ERROR);
74 return; 81 return;
75 } 82 }
76 var responseData = 83 var responseData =
77 makeEnrollResponseData(enrollChallenge, u2fVersion, 84 makeEnrollResponseData(enrollChallenge, u2fVersion,
78 'registrationData', info, 'clientData', browserData); 85 'registrationData', info, 'clientData', browserData);
79 var response = makeU2fSuccessResponse(request, responseData); 86 var response = makeU2fSuccessResponse(request, responseData);
80 sendResponseOnce(sentResponse, closeable, response, sendResponse); 87 sendResponseOnce(sentResponse, closeable, response, sendResponse);
81 } 88 }
82 89
83 closeable = 90 var enroller =
84 validateAndBeginEnrollRequest( 91 validateEnrollRequest(
85 sender, request, 'registerRequests', 'signRequests', 92 sender, request, 'registerRequests', 'signRequests',
86 sendErrorResponse, sendSuccessResponse, 'registeredKeys'); 93 sendErrorResponse, sendSuccessResponse, 'registeredKeys');
94 if (enroller) {
95 var registerRequests = request['registerRequests'];
96 var signRequests = getSignRequestsFromEnrollRequest(request,
97 'signRequests', 'registeredKeys');
98 closeable = /** @type {Closeable} */ (enroller);
99 enroller.doEnroll(registerRequests, signRequests, request['appId']);
100 }
87 return closeable; 101 return closeable;
88 } 102 }
89 103
90 /** 104 /**
91 * Validates an enroll request using the given parameters, and, if valid, begins 105 * Validates an enroll request using the given parameters.
92 * handling the enroll request. (The enroll request may be modified as a result
93 * of handling it.)
94 * @param {MessageSender} sender The sender of the message. 106 * @param {MessageSender} sender The sender of the message.
95 * @param {Object} request The web page's enroll request. 107 * @param {Object} request The web page's enroll request.
96 * @param {string} enrollChallengesName The name of the enroll challenges value 108 * @param {string} enrollChallengesName The name of the enroll challenges value
97 * in the request. 109 * in the request.
98 * @param {string} signChallengesName The name of the sign challenges value in 110 * @param {string} signChallengesName The name of the sign challenges value in
99 * the request. 111 * the request.
100 * @param {function(ErrorCodes)} errorCb Error callback. 112 * @param {function(U2fError)} errorCb Error callback.
101 * @param {function(string, string, (string|undefined))} successCb Success 113 * @param {function(string, string, (string|undefined))} successCb Success
102 * callback. 114 * callback.
103 * @param {string=} opt_registeredKeysName The name of the registered keys 115 * @param {string=} opt_registeredKeysName The name of the registered keys
104 * value in the request. 116 * value in the request.
105 * @return {Closeable} Request handler that should be closed when the browser 117 * @return {Enroller} Enroller object representing the request, if the request
106 * message channel is closed. 118 * is valid, or null if the request is invalid.
107 */ 119 */
108 function validateAndBeginEnrollRequest(sender, request, 120 function validateEnrollRequest(sender, request,
109 enrollChallengesName, signChallengesName, errorCb, successCb, 121 enrollChallengesName, signChallengesName, errorCb, successCb,
110 opt_registeredKeysName) { 122 opt_registeredKeysName) {
111 var origin = getOriginFromUrl(/** @type {string} */ (sender.url)); 123 var origin = getOriginFromUrl(/** @type {string} */ (sender.url));
112 if (!origin) { 124 if (!origin) {
113 errorCb(ErrorCodes.BAD_REQUEST); 125 errorCb({errorCode: ErrorCodes.BAD_REQUEST});
114 return null; 126 return null;
115 } 127 }
116 128
117 if (!isValidEnrollRequest(request, enrollChallengesName, 129 if (!isValidEnrollRequest(request, enrollChallengesName,
118 signChallengesName, opt_registeredKeysName)) { 130 signChallengesName, opt_registeredKeysName)) {
119 errorCb(ErrorCodes.BAD_REQUEST); 131 errorCb({errorCode: ErrorCodes.BAD_REQUEST});
120 return null; 132 return null;
121 } 133 }
122 134
123 var enrollChallenges = request[enrollChallengesName];
124 var signChallenges;
125 if (opt_registeredKeysName &&
126 request.hasOwnProperty(opt_registeredKeysName)) {
127 // Convert registered keys to sign challenges by adding a challenge value.
128 signChallenges = request[opt_registeredKeysName];
129 for (var i = 0; i < signChallenges.length; i++) {
130 // The actual value doesn't matter, as long as it's a string.
131 signChallenges[i]['challenge'] = '';
132 }
133 } else {
134 signChallenges = request[signChallengesName];
135 }
136 var logMsgUrl = request['logMsgUrl'];
137
138 var timer = createTimerForRequest( 135 var timer = createTimerForRequest(
139 FACTORY_REGISTRY.getCountdownFactory(), request); 136 FACTORY_REGISTRY.getCountdownFactory(), request);
137 var logMsgUrl = request['logMsgUrl'];
140 var enroller = new Enroller(timer, origin, errorCb, successCb, 138 var enroller = new Enroller(timer, origin, errorCb, successCb,
141 sender.tlsChannelId, logMsgUrl); 139 sender.tlsChannelId, logMsgUrl);
142 enroller.doEnroll(enrollChallenges, signChallenges, request['appId']); 140 return enroller;
143 return /** @type {Closeable} */ (enroller);
144 } 141 }
145 142
146 /** 143 /**
147 * Returns whether the request appears to be a valid enroll request. 144 * Returns whether the request appears to be a valid enroll request.
148 * @param {Object} request The request. 145 * @param {Object} request The request.
149 * @param {string} enrollChallengesName The name of the enroll challenges value 146 * @param {string} enrollChallengesName The name of the enroll challenges value
150 * in the request. 147 * in the request.
151 * @param {string} signChallengesName The name of the sign challenges value in 148 * @param {string} signChallengesName The name of the sign challenges value in
152 * the request. 149 * the request.
153 * @param {string=} opt_registeredKeysName The name of the registered keys 150 * @param {string=} opt_registeredKeysName The name of the registered keys
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 262 }
266 if (u2fVersion == 'U2F_V2') { 263 if (u2fVersion == 'U2F_V2') {
267 // For U2F_V2, the challenge sent to the gnubby is modified to be the 264 // For U2F_V2, the challenge sent to the gnubby is modified to be the
268 // hash of the browser data. Include the browser data. 265 // hash of the browser data. Include the browser data.
269 responseData[browserDataName] = browserData; 266 responseData[browserDataName] = browserData;
270 } 267 }
271 return responseData; 268 return responseData;
272 } 269 }
273 270
274 /** 271 /**
272 * Gets the expanded sign challenges from an enroll request, potentially by
273 * modifying the request to contain a challenge value where one was omitted.
274 * (For enrolling, the server isn't interested in the value of a signature,
275 * only whether the presented key handle is already enrolled.)
276 * @param {Object} request The request.
277 * @param {string} signChallengesName The name of the sign challenges value in
278 * the request.
279 * @param {string=} opt_registeredKeysName The name of the registered keys
280 * value in the request.
281 * @return {Array.<SignChallenge>}
282 */
283 function getSignRequestsFromEnrollRequest(request, signChallengesName,
284 opt_registeredKeysName) {
285 var signChallenges;
286 if (opt_registeredKeysName &&
287 request.hasOwnProperty(opt_registeredKeysName)) {
288 // Convert registered keys to sign challenges by adding a challenge value.
289 signChallenges = request[opt_registeredKeysName];
290 for (var i = 0; i < signChallenges.length; i++) {
291 // The actual value doesn't matter, as long as it's a string.
292 signChallenges[i]['challenge'] = '';
293 }
294 } else {
295 signChallenges = request[signChallengesName];
296 }
297 return signChallenges;
298 }
299
300 /**
275 * Creates a new object to track enrolling with a gnubby. 301 * Creates a new object to track enrolling with a gnubby.
276 * @param {!Countdown} timer Timer for enroll request. 302 * @param {!Countdown} timer Timer for enroll request.
277 * @param {string} origin The origin making the request. 303 * @param {string} origin The origin making the request.
278 * @param {function(ErrorCodes)} errorCb Called upon enroll failure with an 304 * @param {function(U2fError)} errorCb Called upon enroll failure.
279 * error code.
280 * @param {function(string, string, (string|undefined))} successCb Called upon 305 * @param {function(string, string, (string|undefined))} successCb Called upon
281 * enroll success with the version of the succeeding gnubby, the enroll 306 * enroll success with the version of the succeeding gnubby, the enroll
282 * data, and optionally the browser data associated with the enrollment. 307 * data, and optionally the browser data associated with the enrollment.
283 * @param {string=} opt_tlsChannelId the TLS channel ID, if any, of the origin 308 * @param {string=} opt_tlsChannelId the TLS channel ID, if any, of the origin
284 * making the request. 309 * making the request.
285 * @param {string=} opt_logMsgUrl The url to post log messages to. 310 * @param {string=} opt_logMsgUrl The url to post log messages to.
286 * @constructor 311 * @constructor
287 */ 312 */
288 function Enroller(timer, origin, errorCb, successCb, opt_tlsChannelId, 313 function Enroller(timer, origin, errorCb, successCb, opt_tlsChannelId,
289 opt_logMsgUrl) { 314 opt_logMsgUrl) {
290 /** @private {Countdown} */ 315 /** @private {Countdown} */
291 this.timer_ = timer; 316 this.timer_ = timer;
292 /** @private {string} */ 317 /** @private {string} */
293 this.origin_ = origin; 318 this.origin_ = origin;
294 /** @private {function(ErrorCodes)} */ 319 /** @private {function(U2fError)} */
295 this.errorCb_ = errorCb; 320 this.errorCb_ = errorCb;
296 /** @private {function(string, string, (string|undefined))} */ 321 /** @private {function(string, string, (string|undefined))} */
297 this.successCb_ = successCb; 322 this.successCb_ = successCb;
298 /** @private {string|undefined} */ 323 /** @private {string|undefined} */
299 this.tlsChannelId_ = opt_tlsChannelId; 324 this.tlsChannelId_ = opt_tlsChannelId;
300 /** @private {string|undefined} */ 325 /** @private {string|undefined} */
301 this.logMsgUrl_ = opt_logMsgUrl; 326 this.logMsgUrl_ = opt_logMsgUrl;
302 327
303 /** @private {boolean} */ 328 /** @private {boolean} */
304 this.done_ = false; 329 this.done_ = false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 enrollAppIds.push(opt_appId); 376 enrollAppIds.push(opt_appId);
352 } 377 }
353 for (var i = 0; i < enrollChallenges.length; i++) { 378 for (var i = 0; i < enrollChallenges.length; i++) {
354 if (enrollChallenges[i].hasOwnProperty('appId')) { 379 if (enrollChallenges[i].hasOwnProperty('appId')) {
355 enrollAppIds.push(enrollChallenges[i]['appId']); 380 enrollAppIds.push(enrollChallenges[i]['appId']);
356 } 381 }
357 } 382 }
358 // Sanity check 383 // Sanity check
359 if (!enrollAppIds.length) { 384 if (!enrollAppIds.length) {
360 console.warn(UTIL_fmt('empty enroll app ids?')); 385 console.warn(UTIL_fmt('empty enroll app ids?'));
361 this.notifyError_(ErrorCodes.BAD_REQUEST); 386 this.notifyError_({errorCode: ErrorCodes.BAD_REQUEST});
362 return; 387 return;
363 } 388 }
364 var self = this; 389 var self = this;
365 this.checkAppIds_(enrollAppIds, signChallenges, function(result) { 390 this.checkAppIds_(enrollAppIds, signChallenges, function(result) {
366 if (result) { 391 if (result) {
367 self.handler_ = FACTORY_REGISTRY.getRequestHelper().getHandler(request); 392 self.handler_ = FACTORY_REGISTRY.getRequestHelper().getHandler(request);
368 if (self.handler_) { 393 if (self.handler_) {
369 var helperComplete = 394 var helperComplete =
370 /** @type {function(HelperReply)} */ 395 /** @type {function(HelperReply)} */
371 (self.helperComplete_.bind(self)); 396 (self.helperComplete_.bind(self));
372 self.handler_.run(helperComplete); 397 self.handler_.run(helperComplete);
373 } else { 398 } else {
374 self.notifyError_(ErrorCodes.OTHER_ERROR); 399 self.notifyError_({errorCode: ErrorCodes.OTHER_ERROR});
375 } 400 }
376 } else { 401 } else {
377 self.notifyError_(ErrorCodes.BAD_REQUEST); 402 self.notifyError_({errorCode: ErrorCodes.BAD_REQUEST});
378 } 403 }
379 }); 404 });
380 }; 405 };
381 406
382 /** 407 /**
383 * Encodes the enroll challenge as an enroll helper challenge. 408 * Encodes the enroll challenge as an enroll helper challenge.
384 * @param {EnrollChallenge} enrollChallenge The enroll challenge to encode. 409 * @param {EnrollChallenge} enrollChallenge The enroll challenge to encode.
385 * @param {string=} opt_appId The app id for the entire request. 410 * @param {string=} opt_appId The app id for the entire request.
386 * @return {EnrollHelperChallenge} The encoded challenge. 411 * @return {EnrollHelperChallenge} The encoded challenge.
387 * @private 412 * @private
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 * Called with the result of checking the origin. When the origin is allowed 501 * Called with the result of checking the origin. When the origin is allowed
477 * to claim the app ids, begins checking whether the app ids also list the 502 * to claim the app ids, begins checking whether the app ids also list the
478 * origin. 503 * origin.
479 * @param {!Array.<string>} appIds The app ids. 504 * @param {!Array.<string>} appIds The app ids.
480 * @param {function(boolean)} cb Called with the result of the check. 505 * @param {function(boolean)} cb Called with the result of the check.
481 * @param {boolean} result Whether the origin could claim the app ids. 506 * @param {boolean} result Whether the origin could claim the app ids.
482 * @private 507 * @private
483 */ 508 */
484 Enroller.prototype.originChecked_ = function(appIds, cb, result) { 509 Enroller.prototype.originChecked_ = function(appIds, cb, result) {
485 if (!result) { 510 if (!result) {
486 this.notifyError_(ErrorCodes.BAD_REQUEST); 511 this.notifyError_({errorCode: ErrorCodes.BAD_REQUEST});
487 return; 512 return;
488 } 513 }
489 /** @private {!AppIdChecker} */ 514 /** @private {!AppIdChecker} */
490 this.appIdChecker_ = new AppIdChecker(FACTORY_REGISTRY.getTextFetcher(), 515 this.appIdChecker_ = new AppIdChecker(FACTORY_REGISTRY.getTextFetcher(),
491 this.timer_.clone(), this.origin_, appIds, this.allowHttp_, 516 this.timer_.clone(), this.origin_, appIds, this.allowHttp_,
492 this.logMsgUrl_); 517 this.logMsgUrl_);
493 this.appIdChecker_.doCheck().then(cb); 518 this.appIdChecker_.doCheck().then(cb);
494 }; 519 };
495 520
496 /** Closes this enroller. */ 521 /** Closes this enroller. */
497 Enroller.prototype.close = function() { 522 Enroller.prototype.close = function() {
498 if (this.appIdChecker_) { 523 if (this.appIdChecker_) {
499 this.appIdChecker_.close(); 524 this.appIdChecker_.close();
500 } 525 }
501 if (this.handler_) { 526 if (this.handler_) {
502 this.handler_.close(); 527 this.handler_.close();
503 this.handler_ = null; 528 this.handler_ = null;
504 } 529 }
505 }; 530 };
506 531
507 /** 532 /**
508 * Notifies the caller with the error code. 533 * Notifies the caller with the error.
509 * @param {ErrorCodes} code Error code 534 * @param {U2fError} error Error.
510 * @private 535 * @private
511 */ 536 */
512 Enroller.prototype.notifyError_ = function(code) { 537 Enroller.prototype.notifyError_ = function(error) {
513 if (this.done_) 538 if (this.done_)
514 return; 539 return;
515 this.close(); 540 this.close();
516 this.done_ = true; 541 this.done_ = true;
517 this.errorCb_(code); 542 this.errorCb_(error);
518 }; 543 };
519 544
520 /** 545 /**
521 * Notifies the caller of success with the provided response data. 546 * Notifies the caller of success with the provided response data.
522 * @param {string} u2fVersion Protocol version 547 * @param {string} u2fVersion Protocol version
523 * @param {string} info Response data 548 * @param {string} info Response data
524 * @param {string|undefined} opt_browserData Browser data used 549 * @param {string|undefined} opt_browserData Browser data used
525 * @private 550 * @private
526 */ 551 */
527 Enroller.prototype.notifySuccess_ = 552 Enroller.prototype.notifySuccess_ =
528 function(u2fVersion, info, opt_browserData) { 553 function(u2fVersion, info, opt_browserData) {
529 if (this.done_) 554 if (this.done_)
530 return; 555 return;
531 this.close(); 556 this.close();
532 this.done_ = true; 557 this.done_ = true;
533 this.successCb_(u2fVersion, info, opt_browserData); 558 this.successCb_(u2fVersion, info, opt_browserData);
534 }; 559 };
535 560
536 /** 561 /**
537 * Called by the helper upon completion. 562 * Called by the helper upon completion.
538 * @param {EnrollHelperReply} reply The result of the enroll request. 563 * @param {EnrollHelperReply} reply The result of the enroll request.
539 * @private 564 * @private
540 */ 565 */
541 Enroller.prototype.helperComplete_ = function(reply) { 566 Enroller.prototype.helperComplete_ = function(reply) {
542 if (reply.code) { 567 if (reply.code) {
543 var reportedError = mapDeviceStatusCodeToErrorCode(reply.code); 568 var reportedError = mapDeviceStatusCodeToU2fError(reply.code);
544 console.log(UTIL_fmt('helper reported ' + reply.code.toString(16) + 569 console.log(UTIL_fmt('helper reported ' + reply.code.toString(16) +
545 ', returning ' + reportedError)); 570 ', returning ' + reportedError.errorCode));
546 this.notifyError_(reportedError); 571 this.notifyError_(reportedError);
547 } else { 572 } else {
548 console.log(UTIL_fmt('Gnubby enrollment succeeded!!!!!')); 573 console.log(UTIL_fmt('Gnubby enrollment succeeded!!!!!'));
549 var browserData; 574 var browserData;
550 575
551 if (reply.version == 'U2F_V2') { 576 if (reply.version == 'U2F_V2') {
552 // For U2F_V2, the challenge sent to the gnubby is modified to be the hash 577 // For U2F_V2, the challenge sent to the gnubby is modified to be the hash
553 // of the browser data. Include the browser data. 578 // of the browser data. Include the browser data.
554 browserData = this.browserData_[reply.version]; 579 browserData = this.browserData_[reply.version];
555 } 580 }
556 581
557 this.notifySuccess_(/** @type {string} */ (reply.version), 582 this.notifySuccess_(/** @type {string} */ (reply.version),
558 /** @type {string} */ (reply.enrollData), 583 /** @type {string} */ (reply.enrollData),
559 browserData); 584 browserData);
560 } 585 }
561 }; 586 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/cryptotoken/errorcodes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698