Class MfaOtpProps
B3: server-side OTP material for SMS / Email MFA methods.
The plaintext OTP lives only in memory between generation and delivery; what we
persist is the SHA-256 hash of the plaintext (so a database leak does not disclose
live codes). is a per-issuance random identifier; the client-side
state (see ) carries it instead of the plaintext code, so the
code never appears in URLs / HTTP logs / referer headers.
Consumption is single-use: flips to true atomically under
LockForUpdate during verify, and subsequent attempts against the same
are rejected regardless of code correctness. Expired
( < now) or consumed rows are soft-deleted by the
timer://identity-mfa-otp-cleanup route.
[RedbScheme("identity.mfa_otp")]
public class MfaOtpProps
Inheritance
Properties
Attempts
Count of verify attempts (success+fail). Used by the cleanup route to highlight abuse
public int Attempts { get; set; }
CodeHash
SHA-256 of the plaintext OTP, lowercase hex. Never store plaintext.
public string CodeHash { get; set; }
Consumed
True once a successful verify has consumed the code. Mutated under LockForUpdate
public bool Consumed { get; set; }
DestinationMasked
Masked destination for UI display (e.g. +71234, u).
public string DestinationMasked { get; set; }
ExpiresAt
Absolute expiry — verify requests after this instant fail regardless of code.
public DateTimeOffset ExpiresAt { get; set; }