1
-
2
- import { TotpSecret } from "../../platform_browser/mfa/assertions/totp" ;
3
- import { TotpMultiFactorAssertion } from "../../model/public_types" ;
4
- import { FactorId } from "../../model/enum_maps"
5
- import { MultiFactorSession } from "../../model/public_types" ;
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { TotpSecret } from '../../platform_browser/mfa/assertions/totp' ;
18
+ import { TotpMultiFactorAssertion } from '../../model/public_types' ;
19
+ import { FactorId } from '../../model/enum_maps' ;
20
+ import { MultiFactorSession } from '../../model/public_types' ;
6
21
/**
7
22
* Provider for generating a {@link TotpMultiFactorAssertion}.
8
23
*
9
24
* @public
10
25
*/
11
-
12
- export class TotpMultiFactorGenerator {
13
- /**
14
- * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the totp(Time-based One Time Password) second factor.
15
- * This assertion is used to complete enrollment in TOTP second factor.
16
- *
17
- * @param secret {@link TotpSecret }.
18
- * @param oneTimePassword One-time password from TOTP App.
19
- * @returns A {@link TotpMultiFactorAssertion} which can be used with
20
- * {@link MultiFactorUser.enroll}.
21
- */
22
-
23
- static assertionForEnrollment ( secret : TotpSecret , oneTimePassword : string ) : TotpMultiFactorAssertion { return null as any }
24
-
25
- /**
26
- * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the totp second factor.
27
- * This assertion is used to complete signIn with TOTP as the second factor.
28
- *
29
- * @param enrollmentId identifies the enrolled TOTP second factor.
30
- * @param otp One-time password from TOTP App.
31
- * @returns A {@link TotpMultiFactorAssertion} which can be used with
32
- * {@link MultiFactorResolver.resolveSignIn}.
33
- */
34
-
35
- static assertionForSignIn ( enrollmentId : string , otp : string ) : TotpMultiFactorAssertion { return null as any }
36
-
37
- /**
38
- * Returns a promise to {@link TOTPSecret} which contains the TOTP shared secret key and other parameters.
39
- * Creates a TOTP secret as part of enrolling a TOTP second factor.
40
- * Used for generating a QRCode URL or inputting into a TOTP App.
41
- * This method uses the auth instance corresponding to the user in the multiFactorSession.
42
- *
43
- * @param session A link to {@MultiFactorSession }.
44
- * @returns A promise to {@link TotpSecret}.
45
- */
46
- static async generateSecret ( session : MultiFactorSession ) : Promise < TotpSecret > {
47
- return new Promise < TotpSecret > ( ( resolve , reject ) => {
48
-
49
- } ) }
50
-
51
-
52
- /**
53
- * The identifier of the phone second factor: `totp`.
54
- */
55
- static FACTOR_ID = FactorId . TOTP ;
56
-
57
-
26
+ export class TotpMultiFactorGenerator {
27
+ /**
28
+ * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the totp(Time-based One Time Password) second factor.
29
+ * This assertion is used to complete enrollment in TOTP second factor.
30
+ *
31
+ * @param secret {@link TotpSecret }.
32
+ * @param oneTimePassword One-time password from TOTP App.
33
+ * @returns A {@link TotpMultiFactorAssertion} which can be used with
34
+ * {@link MultiFactorUser.enroll}.
35
+ */
36
+ static assertionForEnrollment (
37
+ secret : TotpSecret ,
38
+ oneTimePassword : string
39
+ ) : TotpMultiFactorAssertion {
40
+ throw new Error ( 'Unimplemented' ) ;
41
+ }
42
+ /**
43
+ * Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the totp second factor.
44
+ * This assertion is used to complete signIn with TOTP as the second factor.
45
+ *
46
+ * @param enrollmentId identifies the enrolled TOTP second factor.
47
+ * @param otp One-time password from TOTP App.
48
+ * @returns A {@link TotpMultiFactorAssertion} which can be used with
49
+ * {@link MultiFactorResolver.resolveSignIn}.
50
+ */
51
+ static assertionForSignIn (
52
+ enrollmentId : string ,
53
+ otp : string
54
+ ) : TotpMultiFactorAssertion {
55
+ throw new Error ( 'Unimplemented' ) ;
56
+ }
57
+ /**
58
+ * Returns a promise to {@link TOTPSecret} which contains the TOTP shared secret key and other parameters.
59
+ * Creates a TOTP secret as part of enrolling a TOTP second factor.
60
+ * Used for generating a QRCode URL or inputting into a TOTP App.
61
+ * This method uses the auth instance corresponding to the user in the multiFactorSession.
62
+ *
63
+ * @param session A link to {@MultiFactorSession }.
64
+ * @returns A promise to {@link TotpSecret}.
65
+ */
66
+ static async generateSecret (
67
+ session : MultiFactorSession
68
+ ) : Promise < TotpSecret > {
69
+ throw new Error ( 'Unimplemented' ) ;
58
70
}
59
-
60
-
71
+ /**
72
+ * The identifier of the phone second factor: `totp`.
73
+ */
74
+ static FACTOR_ID = FactorId . TOTP ;
75
+ }
0 commit comments