Interface IWebAuthnChallengeStore
MFA-3: server-side single-use marker for consumed WebAuthn challenges.
Closes the replay window between challenge issuance and natural TTL expiry. The challenge
itself is encrypted into the client-facing setup-token / mfa_state for convenience (no
DB hit on issue), but completion of the ceremony writes a row here, and a second
completion attempt with the same challenge fails fast with replay_detected.
We persist only the SHA-256 hash of the challenge bytes — sufficient for equality on
consume, no exposure of live challenges if the DB is leaked. Atomicity guaranteed by
the calling transaction: WebAuthnMfaMethod.Complete*Async writes this row in the
same TX as the credential persistence (registration) or sign-counter advance (assertion).
public interface IWebAuthnChallengeStore
Methods
ConsumeAsync(byte[], long, string, TimeSpan, CancellationToken)
Atomically marks a challenge as consumed by the given user for the given operation.
Task<WebAuthnConsumeResult> ConsumeAsync(byte[] challenge, long userId, string operation, TimeSpan ttl, CancellationToken ct = default)