Jump to top

TotpSecret

interface

Represents a TOTP secret that is used for enrolling a TOTP second factor. Contains the shared secret key and other parameters to generate time-based one-time passwords. Implements methods to retrieve the shared secret key, generate a QR code URL, and open the QR code URL in an OTP authenticator app.

Differs from standard firebase JS implementation in three ways: 1- there is no visibility into ony properties other than the secretKey 2- there is an added openInOtpApp method supported by native SDKs 3- the return value of generateQrCodeUrl is a Promise because react-native bridge is async

Properties

auth

</>

used internally to support non-default auth instances

auth: any;

secretKey

</>

Shared secret key/seed used for enrolling in TOTP MFA and generating OTPs.

secretKey: string;

Methods

generateQrCodeUrl

</>

Returns a QR code URL as described in https://github.com/google/google-authenticator/wiki/Key-Uri-Format This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator. If the optional parameters are unspecified, an accountName of userEmail and issuer of firebaseAppName are used.

generateQrCodeUrl(accountName?: undefined | string, issuer?: undefined | string): Promise<string>;

openInOtpApp

</>

Opens the specified QR Code URL in an OTP authenticator app on the device. The shared secret key and account name will be populated in the OTP authenticator app. The URL uses the otpauth:// scheme and will be opened on an app that handles this scheme, if it exists on the device, possibly opening the ecocystem-specific app store with a generic query for compatible apps if no app exists on the device.

openInOtpApp(qrCodeUrl: string): string;