Skip to content

Totp algorithm migration#38

Merged
kentcdodds merged 3 commits into
mainfrom
cursor/totp-algorithm-migration-0496
Jan 30, 2026
Merged

Totp algorithm migration#38
kentcdodds merged 3 commits into
mainfrom
cursor/totp-algorithm-migration-0496

Conversation

@kentcdodds
Copy link
Copy Markdown
Member

@kentcdodds kentcdodds commented Jan 30, 2026

Upgrades @epic-web/totp to v4.0.1, addressing breaking changes by:

  • Updating calls to be async.
  • Normalizing algorithm names (e.g., SHA1 to SHA-1) in totp.server.ts for backward compatibility.
  • Adding a Prisma migration to update existing Verification records in the database to the new SHA-X algorithm format.

Test Plan

  • Ran PORT=3001 npm run test:e2e:run -- tests/e2e/2fa.test.ts to verify the 2FA flow.
  • Manually tested enabling 2FA in the browser to confirm end-to-end verification.

Checklist

  • Tests updated
  • Docs updated

Screenshots

https://github.com/epicweb-dev/epic-stack/assets/1500684/10427387-9878-4395-8968-381907720977
2fa-enabled-state


Open in Cursor Open in Web


Note

Medium Risk
Touches login/2FA verification logic and introduces a DB migration that rewrites stored TOTP algorithms; mistakes could break authentication for existing users or invalidate codes.

Overview
Upgrades @epic-web/totp to ^4.0.1 and updates 2FA/verification flows to use the library’s now-async generateTOTP/verifyTOTP APIs (including updating default algorithm strings to SHA-256).

Replaces the totp.server.ts re-export with wrapper functions that normalize algorithm names (SHA1/SHA256/SHA512SHA-1/SHA-256/SHA-512) and adds a Prisma migration to rewrite existing Verification.algorithm values in the DB; e2e 2FA tests are updated to await OTP generation.

Written by Cursor Bugbot for commit 485d703. This will update automatically on new commits. Configure here.

cursoragent and others added 3 commits January 30, 2026 15:15
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 30, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@kentcdodds kentcdodds marked this pull request as ready for review January 30, 2026 16:04
@kentcdodds kentcdodds merged commit 32694b7 into main Jan 30, 2026
6 checks passed
@kentcdodds kentcdodds deleted the cursor/totp-algorithm-migration-0496 branch January 30, 2026 16:31
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.

2 participants