Class MfaOtpProps

Assembly: redb.Identity.Core.dll

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

Object→MfaOtpProps

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; }

IssuedAt

Issue timestamp (UTC).

public DateTimeOffset IssuedAt { get; set; }

Jti

Random per-issuance identifier. Matches .

public string Jti { get; set; }

Method

Delivery method that issued this OTP: sms or email.

public string Method { get; set; }

UserId

Owner user id (joined to _users).

public long UserId { get; set; }