feat(totp): add TOTP enrollment, management, and step-up#48
Merged
Conversation
Wrap the auth API's TOTP surface in the React SDK. The headless client gains getTotpStatus, startTotpEnrollment, verifyTotpEnrollment, and disableTotp for enrollment/management, plus verifyStepUpWithTotp(code) for TOTP-based step-up. AuthProvider/useAuth expose verifyStepUpWithTotp(code), which refreshes stepUpStatus on success alongside the existing passkey step-up helpers. The StepUpMethod type now includes 'totp', and TotpStatus and TotpEnrollmentStartResult are exported. TOTP applies to step-up verification, not to login: the auth API issues a full session on the first factor and does not gate login on TOTP. Requires a backend exposing the /totp/* routes (@seamless-auth/express 0.6+). Adds client and provider tests, README docs, and a changeset.
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.
Summary
Wraps the auth API's TOTP (authenticator app) surface in the React SDK. Previously the API supported TOTP fully but the SDK exposed none of it. Scoped to what the API supports today: enrollment, management, and TOTP-based step-up verification.
TOTP is not wired as a login second factor, because the auth API issues a full session on the first factor and does not gate login on TOTP. (See the discussion in the review — adding login-gating would require API changes plus recovery/backup codes to avoid hard lockout.)
Headless client (
createSeamlessAuthClient)getTotpStatus(): Promise<Response>startTotpEnrollment(): Promise<Response>— returnssecret+otpauthUrlverifyTotpEnrollment(code): Promise<Response>disableTotp(code): Promise<Response>verifyStepUpWithTotp(code): Promise<StepUpVerificationResult>(typed, like the passkey step-up helpers)Provider (
AuthProvider/useAuth)verifyStepUpWithTotp(code)— refreshesstepUpStatuson success, mirroringverifyStepUpWithPasskey.Types
StepUpMethodnow includes'totp'.TotpStatusandTotpEnrollmentStartResult.Tests / docs
stepUpStatus.npm run lintclean,npm run buildsucceeds, TOTP symbols present indist/index.d.ts.Dependency
Requires an auth backend exposing
/totp/*. That surface is added in seamless-auth-server#47 (@seamless-auth/express0.6+). Merge/release that first.