feat(auth): add single-use totp recovery codes

Codes are stored as SHA-256 hashes and consumed with one conditional
update, so concurrent use of the same code succeeds at most once.

Refs #40

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 00:35:20 +01:00
1 parent 3f21361995
commit dbea42e7a5
9 files changed
+248

No files matched your search

+7
View File
@@ -26,6 +26,13 @@ type Org struct {
RequireTotp bool
}
type RecoveryCode struct {
UserID uuid.UUID
CodeHash []byte
UsedAt *time.Time
CreatedAt time.Time
}
type SsoProvider struct {
ID uuid.UUID
OrgID uuid.UUID