FirebaseAuth Framework Reference

TOTPMultiFactorGenerator

class TOTPMultiFactorGenerator : NSObject

The data structure used to help initialize an assertion for a second factor entity to the Firebase Auth/CICP server. Depending on the type of second factor, this will help generate the assertion. This class is available on iOS only.

  • 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.

    Declaration

    Swift

    class func generateSecret(with session: MultiFactorSession) async throws -> TOTPSecret

    Parameters

    session

    The multiFactorSession instance.

    completion

    Completion block

  • Initializes the MFA assertion to confirm ownership of the TOTP second factor. This assertion is used to complete enrollment of TOTP as a second factor.

    Declaration

    Swift

    class func assertionForEnrollment(with secret: TOTPSecret, oneTimePassword: String) -> TOTPMultiFactorAssertion

    Parameters

    secret

    The TOTP secret.

    oneTimePassword

    one time password string.

  • Initializes the MFA assertion to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as a second factor.

    Declaration

    Swift

    class func assertionForSignIn(withEnrollmentID enrollmentID: String, oneTimePassword: String) -> TOTPMultiFactorAssertion

    Parameters

    enrollmentID

    The ID that identifies the enrolled TOTP second factor.

    oneTimePassword

    one time password string.