TotpMultiFactorGenerator

public final class TotpMultiFactorGenerator


Helper class used to generate a TotpMultiFactorAssertion.

Summary

Constants

static final String
FACTOR_ID = "totp"

Public methods

static @NonNull Task<TotpSecret>

Creates a TOTP secret as part of enrolling a TOTP (time-based one-time password) second factor.

static @NonNull TotpMultiFactorAssertion

Creates an assertion for completing the enrollment flow.

static @NonNull TotpMultiFactorAssertion

Creates an assertion for the sign-in flow.

Constants

FACTOR_ID

public static final String FACTOR_ID = "totp"

Public methods

generateSecret

public static @NonNull Task<TotpSecretgenerateSecret(@NonNull MultiFactorSession session)

Creates a TOTP secret as part of enrolling a TOTP (time-based one-time password) second factor. This method uses the auth instance corresponding to the user in the MultiFactorSession.

getAssertionForEnrollment

public static @NonNull TotpMultiFactorAssertion getAssertionForEnrollment(@NonNull TotpSecret secret, @NonNull String otp)

Creates an assertion for completing the enrollment flow.

Parameters
@NonNull TotpSecret secret

obtained from the generateSecret step.

@NonNull String otp

one-time password obtained from the TOTP App.

getAssertionForSignIn

public static @NonNull TotpMultiFactorAssertion getAssertionForSignIn(@NonNull String enrollmentId, @NonNull String otp)

Creates an assertion for the sign-in flow.

Parameters
@NonNull String enrollmentId

identifies the TOTP second factor being used.

@NonNull String otp

one-time password obtained from the TOTP App.