feat(auth): add TOTP two-factor authentication (#495) - #772
Open
chbndrhnns wants to merge 1 commit into
Open
Conversation
chbndrhnns
force-pushed
the
feature/totp-2fa
branch
from
September 4, 2026 16:46
23d745b to
7e6e039
Compare
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.
Fixes #495
Summary
Adds TOTP-based two-factor authentication (2FA) for user accounts using Better Auth's
twoFactorplugin, including TOTP verification, backup recovery codes, database schema migrations, export/import secret handling, and dashboard account security settings.Key Changes
Backend & Auth Configuration (
apps/api):twoFactorplugin inapps/api/src/lib/auth.ts.two_factor.secretandtwo_factor.backup_codesin system data-transfer.apps/api/test/lib/two-factor-auth.test.tsandapps/api/src/modules/system/data-transfer/secret-codec.test.ts.Database Schema & Migrations (
packages/db):twoFactorEnabledcolumn tousertable and definedtwoFactortable inpackages/db/src/schema/auth.ts.0117_mature_wasp.sqland updated snapshot meta and database dump definitions.Dashboard UI & Auth Flow (
apps/dashboard):/settings) to enable/disable 2FA, display QR code / manual setup key, and generate/view backup codes./two-factor) with support for TOTP code input and backup code fallback./login) to route to two-factor challenge when required.en/auth.json,en/settings.json) and tests for login redirection, two-factor next routing, and i18n parity.