15 lines
828 B
SQL
15 lines
828 B
SQL
-- 2FA fuer Admin-Login (BSI-Mindeststandard, Cyber-Versicherung).
|
|
-- ====================================================================
|
|
-- TOTP-Secrets werden im admin_users-Eintrag selbst gespeichert (keine
|
|
-- separate Tabelle — 1:1-Beziehung, kein Sharding-Sinn). `totp_secret`
|
|
-- wird Base32 gespeichert (otplib-Konvention), `totp_enabled` markiert
|
|
-- den Aktivierungs-Status nach erfolgreichem Setup.
|
|
-- Backup-Codes als Array von SHA256-Hashes — Klartext nur einmal beim
|
|
-- Setup an den User zurueckgegeben, danach nicht mehr abrufbar.
|
|
|
|
alter table public.admin_users
|
|
add column if not exists totp_secret text,
|
|
add column if not exists totp_enabled boolean not null default false,
|
|
add column if not exists totp_backup_codes text[] not null default '{}',
|
|
add column if not exists totp_enabled_at timestamptz;
|