TotpMultiFactorGenerator class
Stay organized with collections
Save and categorize content based on your preferences.
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
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
Returns:
Promise<TotpSecret>
A promise to TotpSecret.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-19 UTC.
[null,null,["Last updated 2024-01-19 UTC."],[],[],null,["# TotpMultiFactorGenerator class\n\nProvider for generating a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface).\n\n**Signature:** \n\n export declare class TotpMultiFactorGenerator \n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-----------------------------------------------------------------------------------|-----------|--------|---------------------------------------------------|\n| [FACTOR_ID](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorfactor_id) | `static` | 'totp' | The identifier of the TOTP second factor: `totp`. |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|--------------------------------------------------------------------------------------------------------------------------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [assertionForEnrollment(secret, oneTimePassword)](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforenrollment) | `static` | Provides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor. |\n| [assertionForSignIn(enrollmentId, oneTimePassword)](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorassertionforsignin) | `static` | Provides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor. |\n| [generateSecret(session)](./auth.totpmultifactorgenerator.md#totpmultifactorgeneratorgeneratesecret) | `static` | Returns a promise to [TotpSecret](./auth.totpsecret.md#totpsecret_class) 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. |\n\nTotpMultiFactorGenerator.FACTOR_ID\n----------------------------------\n\nThe identifier of the TOTP second factor: `totp`.\n\n**Signature:** \n\n static FACTOR_ID: 'totp';\n\nTotpMultiFactorGenerator.assertionForEnrollment()\n-------------------------------------------------\n\nProvides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor.\n\n**Signature:** \n\n static assertionForEnrollment(secret: TotpSecret, oneTimePassword: string): TotpMultiFactorAssertion;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------------|-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|\n| secret | [TotpSecret](./auth.totpsecret.md#totpsecret_class) | A [TotpSecret](./auth.totpsecret.md#totpsecret_class) containing the shared secret key and other TOTP parameters. |\n| oneTimePassword | string | One-time password from TOTP App. |\n\n**Returns:**\n\n[TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)\n\nA [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) which can be used with [MultiFactorUser.enroll()](./auth.multifactoruser.md#multifactoruserenroll).\n\nTotpMultiFactorGenerator.assertionForSignIn()\n---------------------------------------------\n\nProvides a [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor.\n\n**Signature:** \n\n static assertionForSignIn(enrollmentId: string, oneTimePassword: string): TotpMultiFactorAssertion;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------------|--------|---------------------------------------------|\n| enrollmentId | string | identifies the enrolled TOTP second factor. |\n| oneTimePassword | string | One-time password from TOTP App. |\n\n**Returns:**\n\n[TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface)\n\nA [TotpMultiFactorAssertion](./auth.totpmultifactorassertion.md#totpmultifactorassertion_interface) which can be used with [MultiFactorResolver.resolveSignIn()](./auth.multifactorresolver.md#multifactorresolverresolvesignin).\n\nTotpMultiFactorGenerator.generateSecret()\n-----------------------------------------\n\nReturns a promise to [TotpSecret](./auth.totpsecret.md#totpsecret_class) 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.\n\n**Signature:** \n\n static generateSecret(session: MultiFactorSession): Promise\u003cTotpSecret\u003e;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| session | [MultiFactorSession](./auth.multifactorsession.md#multifactorsession_interface) | The [MultiFactorSession](./auth.multifactorsession.md#multifactorsession_interface) that the user is part of. |\n\n**Returns:**\n\nPromise\\\u003c[TotpSecret](./auth.totpsecret.md#totpsecret_class)\\\u003e\n\nA promise to [TotpSecret](./auth.totpsecret.md#totpsecret_class)."]]