18
18
/**
19
19
* Stores the shared secret key and other parameters to generate time-based OTPs.
20
20
* Implements methods to retrieve the shared secret key, generate a QRCode URL.
21
+ * @public
21
22
*/
22
-
23
23
export class TotpSecret {
24
24
constructor (
25
25
readonly secretKey : string ,
26
26
readonly hashingAlgorithm : string ,
27
27
readonly codeLength : number ,
28
28
readonly codeIntervalSeconds : number
29
29
) { }
30
- /**
31
- * Returns the shared secret key/seed used to generate time-based one-time passwords.
32
- *
33
- * @returns Shared secret key/seed used for enrolling in TOTP MFA and generating otps.
34
- */
35
- sharedSecretKey ( ) : string {
36
- return this . secretKey ;
37
- }
38
-
39
- /**
40
- * Returns the hashing algorithm used to generate time-based one-time passwords.
41
- *
42
- * @returns Hashing algorithm used.
43
- */
44
- getHashingAlgorithm ( ) : string {
45
- return this . hashingAlgorithm ;
46
- }
47
-
48
- /**
49
- * Returns the length of the OTP codes to be generated.
50
- *
51
- * @returns Length of the one-time passwords to be generated.
52
- */
53
- getCodeLength ( ) : number {
54
- return this . codeLength ;
55
- }
56
-
57
- /**
58
- * Returns the interval(in seconds) when the OTP codes should change.
59
- *
60
- * @returns The interval (in seconds) when the OTP codes should change.
61
- */
62
- getCodeIntervalSeconds ( ) : number {
63
- return this . codeIntervalSeconds ;
64
- }
65
-
66
30
/**
67
31
* Returns a QRCode URL as described in
68
32
* https://github.com/google/google-authenticator/wiki/Key-Uri-Format
@@ -73,8 +37,7 @@ export class TotpSecret {
73
37
* @param issuer issuer of the TOTP(likely the app name).
74
38
* @returns A QRCode URL string.
75
39
*/
76
-
77
- generateQrCodeUrl ( _accountName ?: string , issuer ?: string ) : string {
78
- return null as any ;
40
+ generateQrCodeUrl ( _accountName ?: string , _issuer ?: string ) : string {
41
+ throw new Error ( 'Unimplemented' ) ;
79
42
}
80
43
}
0 commit comments