Events 2.3.0 (phase 1c): two-factor with an authenticator app, recovery codes

- TOTP (RFC 6238) next to email and WhatsApp: QR code and key to set up,
  the app's first code confirms it, a code can't be used twice, nothing
  is sent. The secret is stored encrypted.
- 10 single-use recovery codes whenever two-factor is turned on, shown
  once; accepted at sign-in in place of any code; a new set on request.
- Admins see each account's method; Reset 2FA clears the app and codes.
- Profile & Security, sign-in and Users pages; API types; 10 new tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 14:55:22 +02:00
co-authored by Claude Opus 5.5
parent b207d17db8
commit ee65ff358c
18 changed files with 815 additions and 60 deletions
+19
View File
@@ -7,6 +7,25 @@ and this project follows [Semantic Versioning](https://semver.org/).
## [Unreleased]
Planned as 2.3.0 (ROADMAP-v3 phase 1c).
### Added
- **Two-factor with an authenticator app** (TOTP, RFC 6238) next to email and WhatsApp: Profile &
Security → Two-factor → "An authenticator app" shows a QR code (drawn in the browser) and the key;
the app's first code confirms it. Codes can't be used twice; nothing is sent, so there's no resend.
The secret is stored encrypted (`User.totpSecret`).
- **Recovery codes**: 10 single-use codes each time two-factor is turned on (any method), shown
once with Download and Copy; one works at sign-in in place of any code ("Use a recovery code").
A new set from Profile & Security (password needed). Using one, and making a new set, show in
the account's activity.
- **Admins see each account's method** in Users ("2FA: app / email / WhatsApp"); Reset 2FA also
removes the app's secret and the recovery codes.
- API (v2): `authenticator` in `/me/two-factor/enable` (answers with `secret` and `otpauthUrl`),
`recoveryCodes` from `/me/two-factor/confirm`, `POST /me/two-factor/recovery-codes`;
`twoFactorMethod` and `recoveryCodesLeft` on `/me`, `twoFactorMethod` on users.
- Migration `20261118150000_authenticator_app`.
## [2.2.0] - 2026-11-17
Cross Events moves into the `crosscode-platform` monorepo (ROADMAP-v3 phase 1b,