| OLD | NEW |
| 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 Implements a sign handler using USB gnubbies. | 6 * @fileoverview Implements a sign handler using USB gnubbies. |
| 7 */ | 7 */ |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 var CORRUPT_sign = false; | 10 var CORRUPT_sign = false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 */ | 40 */ |
| 41 UsbSignHandler.prototype.run = function(cb) { | 41 UsbSignHandler.prototype.run = function(cb) { |
| 42 if (this.cb_) { | 42 if (this.cb_) { |
| 43 // Can only handle one request. | 43 // Can only handle one request. |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 /** @private {RequestHandlerCallback} */ | 46 /** @private {RequestHandlerCallback} */ |
| 47 this.cb_ = cb; | 47 this.cb_ = cb; |
| 48 if (!this.request_.signData || !this.request_.signData.length) { | 48 if (!this.request_.signData || !this.request_.signData.length) { |
| 49 // Fail a sign request with an empty set of challenges. | 49 // Fail a sign request with an empty set of challenges. |
| 50 this.notifyError_(DeviceStatusCodes.INVALID_DATA_STATUS); | |
| 51 return false; | 50 return false; |
| 52 } | 51 } |
| 53 var timeoutMillis = | 52 var timeoutMillis = |
| 54 this.request_.timeoutSeconds ? | 53 this.request_.timeoutSeconds ? |
| 55 this.request_.timeoutSeconds * 1000 : | 54 this.request_.timeoutSeconds * 1000 : |
| 56 UsbSignHandler.DEFAULT_TIMEOUT_MILLIS; | 55 UsbSignHandler.DEFAULT_TIMEOUT_MILLIS; |
| 57 /** @private {MultipleGnubbySigner} */ | 56 /** @private {MultipleGnubbySigner} */ |
| 58 this.signer_ = new MultipleGnubbySigner( | 57 this.signer_ = new MultipleGnubbySigner( |
| 59 false /* forEnroll */, | 58 false /* forEnroll */, |
| 60 this.signerCompleted_.bind(this), | 59 this.signerCompleted_.bind(this), |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 UsbSignHandler.prototype.close = function() { | 253 UsbSignHandler.prototype.close = function() { |
| 255 while (this.notEnrolledGnubbies_.length != 0) { | 254 while (this.notEnrolledGnubbies_.length != 0) { |
| 256 var gnubby = this.notEnrolledGnubbies_.shift(); | 255 var gnubby = this.notEnrolledGnubbies_.shift(); |
| 257 gnubby.closeWhenIdle(); | 256 gnubby.closeWhenIdle(); |
| 258 } | 257 } |
| 259 if (this.signer_) { | 258 if (this.signer_) { |
| 260 this.signer_.close(); | 259 this.signer_.close(); |
| 261 this.signer_ = null; | 260 this.signer_ = null; |
| 262 } | 261 } |
| 263 }; | 262 }; |
| OLD | NEW |