TOTP (Time-Based One-Time Password) is the primary 2FA method for launch. It is compatible with any RFC 6238 compliant authenticator app including Google Authenticator and Authy. It implements the TwoFactorProvider contract.
Setup Flow
Before TOTP can be used, the user must configure it. The setup flow:
- A TOTP secret is generated for the user and stored against their account in a pending state
- A QR code URI is returned to the client for the user to scan with their authenticator app
- The user submits a code generated by their app to confirm setup
- The code is verified against the pending secret — on success the secret is marked as active and TOTP is enabled for the user
TOTP is not considered enabled until the user has successfully confirmed setup. A pending secret that is never confirmed should be discarded.
Verification
TOTP verification uses the active secret stored against the user to verify a submitted code against the current time window. A small window of tolerance is applied to account for clock drift between the server and the user's device.
Disabling
A user can disable TOTP by submitting a valid code. Disabling TOTP removes the active secret from their account.
User Storage
The User entity gains a nullable totp_secret field representing the active TOTP secret, and a nullable totp_pending_secret field for the unconfirmed setup secret.
Tasks
TOTP (Time-Based One-Time Password) is the primary 2FA method for launch. It is compatible with any RFC 6238 compliant authenticator app including Google Authenticator and Authy. It implements the
TwoFactorProvidercontract.Setup Flow
Before TOTP can be used, the user must configure it. The setup flow:
TOTP is not considered enabled until the user has successfully confirmed setup. A pending secret that is never confirmed should be discarded.
Verification
TOTP verification uses the active secret stored against the user to verify a submitted code against the current time window. A small window of tolerance is applied to account for clock drift between the server and the user's device.
Disabling
A user can disable TOTP by submitting a valid code. Disabling TOTP removes the active secret from their account.
User Storage
The
Userentity gains a nullabletotp_secretfield representing the active TOTP secret, and a nullabletotp_pending_secretfield for the unconfirmed setup secret.Tasks
TotpProvidersatisfying theTwoFactorProvidercontracttotp_secretandtotp_pending_secretfields toUser