Back to Firebase Js Sdk

TotpMultiFactorGenerator class

docs-devsite/auth.totpmultifactorgenerator.md

12.12.15.3 KB
Original Source

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

TotpMultiFactorGenerator class

Provider for generating a TotpMultiFactorAssertion<!-- -->.

<b>Signature:</b>

typescript
export declare class TotpMultiFactorGenerator 

Properties

PropertyModifiersTypeDescription
FACTOR_ID<code>static</code>'totp'The identifier of the TOTP second factor: <code>totp</code>.

Methods

MethodModifiersDescription
assertionForEnrollment(secret, oneTimePassword)<code>static</code>Provides a TotpMultiFactorAssertion to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor.
assertionForSignIn(enrollmentId, oneTimePassword)<code>static</code>Provides a TotpMultiFactorAssertion to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor.
generateSecret(session)<code>static</code>Returns a promise to TotpSecret which contains the TOTP shared secret key and other parameters. Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the user in the multiFactorSession.

TotpMultiFactorGenerator.FACTOR_ID

The identifier of the TOTP second factor: totp<!-- -->.

<b>Signature:</b>

typescript
static FACTOR_ID: 'totp';

TotpMultiFactorGenerator.assertionForEnrollment()

Provides a TotpMultiFactorAssertion to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor.

<b>Signature:</b>

typescript
static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion;

Parameters

ParameterTypeDescription
secretTotpSecretA TotpSecret containing the shared secret key and other TOTP parameters.
oneTimePasswordstringOne-time password from TOTP App.

<b>Returns:</b>

TotpMultiFactorAssertion

A TotpMultiFactorAssertion which can be used with MultiFactorUser.enroll()<!-- -->.

TotpMultiFactorGenerator.assertionForSignIn()

Provides a TotpMultiFactorAssertion to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor.

<b>Signature:</b>

typescript
static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion;

Parameters

ParameterTypeDescription
enrollmentIdstringidentifies the enrolled TOTP second factor.
oneTimePasswordstringOne-time password from TOTP App.

<b>Returns:</b>

TotpMultiFactorAssertion

A TotpMultiFactorAssertion which can be used with MultiFactorResolver.resolveSignIn()<!-- -->.

TotpMultiFactorGenerator.generateSecret()

Returns a promise to TotpSecret which contains the TOTP shared secret key and other parameters. Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the user in the multiFactorSession.

<b>Signature:</b>

typescript
static generateSecret(session: MultiFactorSession): Promise<TotpSecret>;

Parameters

ParameterTypeDescription
sessionMultiFactorSessionThe MultiFactorSession that the user is part of.

<b>Returns:</b>

Promise<TotpSecret<!-- -->>

A promise to TotpSecret<!-- -->.