Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / cryptotoken / enrollhelper.js
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
3 // found in the LICENSE file.
4
5 /**
6  * @fileoverview Provides a "bottom half" helper to assist with raw enroll
7  * requests.
8  */
9 'use strict';
10
11 /**
12  * A helper for enroll requests.
13  * @extends {Closeable}
14  * @interface
15  */
16 function EnrollHelper() {}
17
18 /**
19  * Attempts to enroll using the provided data.
20  * @param {Array} enrollChallenges an array enroll challenges.
21  * @param {Array.<SignHelperChallenge>} signChallenges a list of sign
22  *     challenges for already enrolled gnubbies, to prevent double-enrolling a
23  *     device.
24  */
25 EnrollHelper.prototype.doEnroll =
26     function(enrollChallenges, signChallenges) {};
27
28 /** Closes this helper. */
29 EnrollHelper.prototype.close = function() {};
30
31 /**
32  * A factory for creating enroll helpers.
33  * @interface
34  */
35 function EnrollHelperFactory() {}
36
37 /**
38  * Creates a new enroll helper.
39  * @param {!Countdown} timer Timer after whose expiration the caller is no
40  *     longer interested in the result of an enroll request.
41  * @param {function(number, boolean)} errorCb Called when an enroll request
42  *     fails with an error code and whether any gnubbies were found.
43  * @param {function(string, string)} successCb Called with the result of a
44  *     successful enroll request, along with the version of the gnubby that
45  *     provided it.
46  * @param {(function(number, boolean)|undefined)} opt_progressCb Called with
47  *     progress updates to the enroll request.
48  * @param {string=} opt_logMsgUrl A URL to post log messages to.
49  * @return {EnrollHelper} the newly created helper.
50  */
51 EnrollHelperFactory.prototype.createHelper =
52     function(timer, errorCb, successCb, opt_progressCb, opt_logMsgUrl) {};