Giao diện
identity / mfa
Trang sinh tự động
Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.
3 bảng. Quay lại identity.
mfa_factors
P1-07. SECRET_BEARING Admin MFA factor (TOTP), one live (non-REMOVED) row per account. The secret is AES-256-GCM sealed outside the DB; attempt/lock columns are the MFA lockout (AD-AUTH-05-locked).
public.mfa_factors · 17 cột · 10 check · 0 unique · 2 index · 0 policy · 0 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
account_id | uuid | NOT NULL | FK → accounts | |
factor_type | text | NOT NULL | ||
status | text | NOT NULL | ||
totp_ciphertext | bytea | NOT NULL | ||
totp_nonce | bytea | NOT NULL | ||
totp_key_id | text | NOT NULL | ||
enroll_expires_at | timestamptz | NOT NULL | ||
verified_at | timestamptz | |||
last_used_step | bigint | |||
attempt_count | integer | NOT NULL | ||
attempt_window_started_at | timestamptz | |||
locked_until | timestamptz | |||
removed_at | timestamptz | |||
removed_reason | text | |||
created_at | timestamptz | NOT NULL | ||
version | integer | NOT NULL |
Khoá chính: id
Trỏ ra (1):
account_id→accounts·ON DELETE RESTRICT
Được trỏ tới (2): mfa_reset_requests, mfa_step_up_grants
mfa_reset_requests
P1-07. PERM_GATED maker/checker MFA reset (AD-03 mfa_reset.request, AD-04 mfa_reset.approve); one open request per target; executes on approval; COMPLETED when the target re-enrolls.
public.mfa_reset_requests · 14 cột · 8 check · 0 unique · 2 index · 0 policy · 2 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
target_account_id | uuid | NOT NULL | FK → accounts | |
requested_by | uuid | NOT NULL | FK → accounts | |
reason | text | NOT NULL | ||
status | text | NOT NULL | ||
requested_at | timestamptz | NOT NULL | ||
expires_at | timestamptz | NOT NULL | ||
approved_by | uuid | FK → accounts | ||
approved_at | timestamptz | |||
removed_factor_id | uuid | FK → mfa_factors | ||
revoked_sessions | integer | |||
completed_at | timestamptz | |||
correlation_id | correlation_ref | NOT NULL | ||
version | integer | NOT NULL |
Khoá chính: id
Trỏ ra (4):
approved_by→accounts·ON DELETE RESTRICTremoved_factor_id→mfa_factors·ON DELETE RESTRICTrequested_by→accounts·ON DELETE RESTRICTtarget_account_id→accounts·ON DELETE RESTRICT
Được trỏ tới: không có
mfa_step_up_grants
P1-07. SYSTEM_ONLY step-up grant: one MFA verification -> one privileged command, bound to account, app, Supabase session, action (matrix res.act) and expiry; consumed once inside the command transaction.
public.mfa_step_up_grants · 12 cột · 4 check · 0 unique · 2 index · 0 policy · 2 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
account_id | uuid | NOT NULL | FK → accounts | |
app | app_code | NOT NULL | ||
factor_id | uuid | NOT NULL | FK → mfa_factors | |
session_id | uuid | NOT NULL | ||
action | text | NOT NULL | ||
expires_at | timestamptz | NOT NULL | ||
consumed_at | timestamptz | |||
revoked_at | timestamptz | |||
revoked_reason | text | |||
created_at | timestamptz | NOT NULL | ||
correlation_id | correlation_ref | NOT NULL |
Khoá chính: id
Trỏ ra (2):
account_id→accounts·ON DELETE RESTRICTfactor_id→mfa_factors·ON DELETE RESTRICT
Được trỏ tới: không có