Skip to content

feat(totp): add TOTP enrollment, management, and step-up#48

Merged
Bccorb merged 2 commits into
mainfrom
feat/totp-mfa
Jul 7, 2026
Merged

feat(totp): add TOTP enrollment, management, and step-up#48
Bccorb merged 2 commits into
mainfrom
feat/totp-mfa

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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> — returns secret + otpauthUrl
  • verifyTotpEnrollment(code): Promise<Response>
  • disableTotp(code): Promise<Response>
  • verifyStepUpWithTotp(code): Promise<StepUpVerificationResult> (typed, like the passkey step-up helpers)

Provider (AuthProvider / useAuth)

  • verifyStepUpWithTotp(code) — refreshes stepUpStatus on success, mirroring verifyStepUpWithPasskey.

Types

  • StepUpMethod now includes 'totp'.
  • New exported types TotpStatus and TotpEnrollmentStartResult.

Tests / docs

  • Client tests for all five methods (success + rejection paths); provider test for TOTP step-up updating stepUpStatus.
  • README: new "TOTP (authenticator apps)" section, step-up section updated, backend-expectations and headless-client lists updated.
  • Full suite: 158 passing. npm run lint clean, npm run build succeeds, TOTP symbols present in dist/index.d.ts.

Dependency

Requires an auth backend exposing /totp/*. That surface is added in seamless-auth-server#47 (@seamless-auth/express 0.6+). Merge/release that first.

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.
@Bccorb Bccorb merged commit 0dac61d into main Jul 7, 2026
2 of 3 checks passed
@Bccorb Bccorb deleted the feat/totp-mfa branch July 7, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant