Class PropsServerSideOtpStore
B3: PROPS-backed . Singleton; resolves
through a fresh DI scope per operation (identical pattern to
PropsSigningKeyStore / RedbXmlRepository) to avoid captive-scope-in-singleton.
Codes are 6 ASCII digits generated via . Only the
SHA-256 hex of the plaintext is persisted (); the
plaintext is returned to the caller exactly once for channel delivery.
Verify runs inside a redb transaction + LockForUpdateAsync on the OTP row so
concurrent verify calls against the same jti serialize cleanly — the first
successful call flips , subsequent calls see the flag
under the lock and return with
Reason = already_consumed.
public sealed class PropsServerSideOtpStore : IServerSideOtpStore
Inheritance
Implements
Methods
IssueAsync(long, string, string, TimeSpan, CancellationToken)
Issues a new OTP. Generates a CSPRNG 6-digit code, persists its SHA-256 hash, and
public Task<OtpIssueResult> IssueAsync(long userId, string method, string destinationMasked, TimeSpan ttl, CancellationToken ct = default)
VerifyAndConsumeAsync(Guid, long, string, CancellationToken)
Verifies and atomically consumes an OTP keyed by jti. On success
public Task<OtpVerifyResult> VerifyAndConsumeAsync(Guid jti, long userId, string code, CancellationToken ct = default)