Repository navigation
feat(react): authenticator app enrollment, sign-in and settings screens - #219
Merged
Merged
Conversation
…ngs screens Adds /register-authenticator and /authenticator-code, offers an authenticator app on the sign-in fallback and on a recovery session's passkey step, asks for an authenticator code when replacing recovery codes needs a step-up, and adds the AuthenticatorAppSettings section to AccountSecurity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #213. Stacked on #218 (shared client pieces); merge that first.
Summary
Authenticator app (TOTP) screens for the React prebuilt UI.
AuthRoutesserves two new screens:/register-authenticator(AuthenticatorRegistration) shows a QR code fromqrCode(), the setup key in groups of four with a copy button, and anotpauth://link for this device. It verifies the first code, shows "Authenticator app added", then continues to/recovery-codeswithreturnTo, as passkey enrollment does./authenticator-code(AuthenticatorCodeLogin) signs in withsignInWithTotp./loginnever liststotp, and the API answers/totp/verify-loginfor any identifier, so the offer reveals nothing about the account.PassKeyRegistrationalways offers "Use an authenticator app" to a recovery session. It is the primary action on a device without passkeys.403 login_method_disabled), so an app set up there could never sign the user in.refreshSession(), sorecoverySessionis already false when the screen moves on.RecoveryCodeSettingsand/recovery-codes) now asks for an authenticator code when the account has one, and falls back to the passkey otherwise.AuthenticatorAppSettings, exported from the root and rendered byAccountSecurity. It shows status and last use, sets up an app inline, and turns it off with a current code (the API's own proof for/totp/disable).totpErrorMessage, which covers:401)423)429)403)409)otpauth://URL is rendered as a link or QR code.signInWithTotp,totpErrorMessage,formatTotpSecret,qrCode,TOTP_CODE_LENGTHandQrCode.RecoveryCodeSettingsnow says "You will be asked to confirm it is you first" instead of naming the passkey.Tests
AuthenticatorViews.test.tsxcovers:AccountSecurity,RecoveryViews,RegisterPassKey,loginandAuthRoutesfor the settings section, the step-up prompt, the recovery-session and unsupported-device offers, and the routes.Checks
lint, typecheck, format:check, build and test (jest 812 passed, vitest 42 passed) all pass.