Skip to content

Commit e95521d

Browse files
committed
TotpSecret class definition
1 parent e3bf175 commit e95521d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

packages/auth/lib/index.d.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,52 @@ export namespace FirebaseAuthTypes {
275275
assertion(credential: AuthCredential): MultiFactorAssertion;
276276
}
277277

278+
/**
279+
* Provider for generating a {@link TotpMultiFactorAssertion}.
280+
*
281+
* Stores the shared secret key and other parameters to generate time-based OTPs.
282+
* Implements methods to retrieve the shared secret key and generate a QR code URL.
283+
* @public
284+
*/
285+
export declare class TotpSecret {
286+
private readonly sessionInfo;
287+
private readonly auth;
288+
/**
289+
* Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs.
290+
*/
291+
readonly secretKey: string;
292+
/**
293+
* Hashing algorithm used.
294+
*/
295+
readonly hashingAlgorithm: string;
296+
/**
297+
* Length of the one-time passwords to be generated.
298+
*/
299+
readonly codeLength: number;
300+
/**
301+
* The interval (in seconds) when the OTP codes should change.
302+
*/
303+
readonly codeIntervalSeconds: number;
304+
/**
305+
* The timestamp (UTC string) by which TOTP enrollment should be completed.
306+
*/
307+
readonly enrollmentCompletionDeadline: string;
308+
private constructor();
309+
/* Excluded from this release type: _fromStartTotpMfaEnrollmentResponse */
310+
/* Excluded from this release type: _makeTotpVerificationInfo */
311+
/**
312+
* Returns a QR code URL as described in
313+
* https://github.com/google/google-authenticator/wiki/Key-Uri-Format
314+
* This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator.
315+
* If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used.
316+
*
317+
* @param accountName the name of the account/app along with a user identifier.
318+
* @param issuer issuer of the TOTP (likely the app name).
319+
* @returns A QR code URL string.
320+
*/
321+
generateQrCodeUrl(accountName?: string, issuer?: string): string;
322+
}
323+
278324
export interface TotpMultiFactorGenerator {
279325
FACTOR_ID: FactorId.TOTP;
280326

0 commit comments

Comments
 (0)