✨ types(auth): E-Mail-Rückfallebene und gemerkte Geräte

- `AdminMfaChallenge` trägt `mfaEnrollmentRecommended` und `rememberDeviceDays`.
- `AdminMfaStatus.emailFallback` markiert die erzwungene Rückfallebene.
- `AdminTrustedDevice`/`AdminTrustedDevices` für die Geräteliste.
- `AdminAuthMethod` kennt `trusted_device` und `impersonation`; `AdminMfaMethod`
  schließt beide aus.
This commit is contained in:
apairon committed 2026-11-06 21:27:31 +00:00
1 parent 2187ef3d1c
commit 59841adf9c
1 file changed
+31 -3
Vendored
+31 -3
View File
@@ -2486,10 +2486,17 @@ declare global {
// admin UI and any client use the same contract as the server.
/** Every method that can appear in the `amr` claim, including the password. */
export type AdminAuthMethod = "pwd" | "totp" | "recovery" | "email" | "webauthn"
export type AdminAuthMethod =
| "pwd"
| "totp"
| "recovery"
| "email"
| "webauthn"
| "trusted_device"
| "impersonation"
/** Factors the login offer can contain (no password). */
export type AdminMfaMethod = Exclude<AdminAuthMethod, "pwd">
/** Factors the login offer can contain (no password, no session markers). */
export type AdminMfaMethod = Exclude<AdminAuthMethod, "pwd" | "trusted_device" | "impersonation">
/** Step-1 answer when a second factor is required. */
export interface AdminMfaChallenge {
@@ -2501,6 +2508,10 @@ declare global {
methods: AdminMfaMethod[]
/** Masked address when the e-mail factor is one of the methods. */
emailHint?: string
/** A real factor is still worthwhile (e-mail fallback relieved the login). */
mfaEnrollmentRecommended?: boolean
/** >0 when the server allows remembering this browser after the factor. */
rememberDeviceDays?: number
}
/** Step-1 answer for an account without an active factor. */
@@ -2523,11 +2534,28 @@ declare global {
/** Masked verified address, e.g. `a***@example.com`. */
email?: string
emailVerified: boolean
/** Server forces an e-mail code although no factor is enrolled. */
emailFallback: boolean
recoveryCodesRemaining: number
enforced: boolean
policy: "off" | "optional" | "required"
}
/** One browser that skips the login challenge. */
export interface AdminTrustedDevice {
id: string
label: string
createdAt: string
lastUsedAt?: string
expiresAt: string
}
export interface AdminTrustedDevices {
enabled: boolean
days: number
devices: AdminTrustedDevice[]
}
export interface AdminMfaTotpEnrollment {
secret: string
otpauthUri: string