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 Contains a factory interface for creating and opening gnubbies. | 6 * @fileoverview Contains a factory interface for creating and opening gnubbies. |
7 */ | 7 */ |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 /** | 10 /** |
11 * A factory for creating and opening gnubbies. | 11 * A factory for creating and opening gnubbies. |
12 * @interface | 12 * @interface |
13 */ | 13 */ |
14 function GnubbyFactory() {} | 14 function GnubbyFactory() {} |
15 | 15 |
16 /** | 16 /** |
17 * Enumerates gnubbies. | 17 * Enumerates gnubbies. |
18 * @param {function(number, Array<GnubbyDeviceId>)} cb Enumerate callback | 18 * @param {function(number, Array<GnubbyDeviceId>)} cb Enumerate callback |
19 */ | 19 */ |
20 GnubbyFactory.prototype.enumerate = function(cb) { | 20 GnubbyFactory.prototype.enumerate = function(cb) {}; |
21 }; | |
22 | 21 |
23 /** @typedef {function(number, Gnubby=)} */ | 22 /** @typedef {function(number, Gnubby=)} */ |
24 var FactoryOpenCallback; | 23 var FactoryOpenCallback; |
25 | 24 |
26 /** | 25 /** |
27 * Creates a new gnubby object, and opens the gnubby with the given index. | 26 * Creates a new gnubby object, and opens the gnubby with the given index. |
28 * @param {GnubbyDeviceId} which The device to open. | 27 * @param {GnubbyDeviceId} which The device to open. |
29 * @param {boolean} forEnroll Whether this gnubby is being opened for enrolling. | 28 * @param {boolean} forEnroll Whether this gnubby is being opened for enrolling. |
30 * @param {FactoryOpenCallback} cb Called with result of opening the gnubby. | 29 * @param {FactoryOpenCallback} cb Called with result of opening the gnubby. |
31 * @param {string=} opt_appIdHash The base64-encoded hash of the app id for | 30 * @param {string=} opt_appIdHash The base64-encoded hash of the app id for |
32 * which the gnubby being opened. | 31 * which the gnubby being opened. |
33 * @param {string=} opt_logMsgUrl The url to post log messages to. | 32 * @param {string=} opt_logMsgUrl The url to post log messages to. |
34 * @param {string=} opt_caller Identifier for the caller. | 33 * @param {string=} opt_caller Identifier for the caller. |
35 * @return {(function ()|undefined)} Some implementations might return function | 34 * @return {(function ()|undefined)} Some implementations might return function |
36 * that can be used to cancel this pending open operation. Opening device | 35 * that can be used to cancel this pending open operation. Opening device |
37 * might take long time or be resource-hungry. | 36 * might take long time or be resource-hungry. |
38 */ | 37 */ |
39 GnubbyFactory.prototype.openGnubby = | 38 GnubbyFactory.prototype.openGnubby = function( |
40 function(which, forEnroll, cb, opt_appIdHash, opt_logMsgUrl, opt_caller) { | 39 which, forEnroll, cb, opt_appIdHash, opt_logMsgUrl, opt_caller) {}; |
41 }; | |
42 | 40 |
43 /** | 41 /** |
44 * Called during enrollment to check whether a gnubby known not to be enrolled | 42 * Called during enrollment to check whether a gnubby known not to be enrolled |
45 * is allowed to enroll in its present state. Upon completion of the check, the | 43 * is allowed to enroll in its present state. Upon completion of the check, the |
46 * callback is called. | 44 * callback is called. |
47 * @param {Gnubby} gnubby The not-enrolled gnubby. | 45 * @param {Gnubby} gnubby The not-enrolled gnubby. |
48 * @param {string} appIdHash The base64-encoded hash of the app id for which | 46 * @param {string} appIdHash The base64-encoded hash of the app id for which |
49 * the gnubby being enrolled. | 47 * the gnubby being enrolled. |
50 * @param {FactoryOpenCallback} cb Called with the result of the prerequisite | 48 * @param {FactoryOpenCallback} cb Called with the result of the prerequisite |
51 * check. (A non-zero status indicates failure.) | 49 * check. (A non-zero status indicates failure.) |
52 */ | 50 */ |
53 GnubbyFactory.prototype.notEnrolledPrerequisiteCheck = | 51 GnubbyFactory.prototype.notEnrolledPrerequisiteCheck = function( |
54 function(gnubby, appIdHash, cb) { | 52 gnubby, appIdHash, cb) {}; |
55 }; | |
OLD | NEW |