Merge branch 'feat/totp'

This commit is contained in:
2026-11-17 22:23:11 +02:00
23 changed files with 949 additions and 67 deletions
+18 -1
View File
@@ -5,10 +5,27 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project follows [Semantic Versioning](https://semver.org/).
## [Unreleased]
## [2.3.0] - 2026-11-17
Authenticator-app sign-in and recovery codes (ROADMAP-v3 phase 1c), and what installs and
updates from the Hub need (crosscode agent 1.0, Hub 2.1.0).
### 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`.
- `env.template.json`: every `.env` variable with its layer, for installs and updates from the Hub.
- `scripts/export-church.ts`: the church's data as `crosscode.church-export/1` (for `crosscode export`).
- A site installed from the Hub registers by itself on first start when `HUB_LICENCE_KEY` is set