TotpMultiFactorGenerator class

Provider for generating a TotpMultiFactorAssertion.

Signature:

export declare class TotpMultiFactorGenerator 

Properties

Property Modifiers Type Description
FACTOR_ID static 'totp' The identifier of the TOTP second factor: totp.

Methods

Method Modifiers Description
assertionForEnrollment(secret, oneTimePassword) static 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) static 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) static 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.

Signature:

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.

Signature:

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

Parameters

Parameter Type Description
secret TotpSecret A TotpSecret containing the shared secret key and other TOTP parameters.
oneTimePassword string One-time password from TOTP App.

Returns:

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.

Signature:

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

Parameters

Parameter Type Description
enrollmentId string identifies the enrolled TOTP second factor.
oneTimePassword string One-time password from TOTP App.

Returns:

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.

Signature:

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

Parameters

Parameter Type Description
session MultiFactorSession The MultiFactorSession that the user is part of.

Returns:

Promise<TotpSecret>

A promise to TotpSecret.