Class WebAuthnConsumedChallengeProps

Assembly: redb.Identity.Core.dll

MFA-3: server-side single-use marker for consumed WebAuthn challenges.

The 32-byte challenge issued at register/begin or assert/begin 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 rejects retries with the same challenge.
This closes the replay window between issue and natural TTL expiry — without it, a captured
`setup_token` containing a still-fresh challenge could be replayed within the 5-min TTL.


We persist (SHA-256 hex of challenge bytes) — not the raw
challenge — so a database leak does not expose live challenges to an attacker who would
otherwise need a stolen DataProtector key to forge them. The hash is sufficient for
equality-detection on consume.


Atomicity: WebAuthnMfaMethod writes this row inside the same transaction as
the credential persistence (registration) or sign-counter advance (assertion); a unique
index on makes second-consume race-safe — duplicate insert
fails fast with replay_detected. Cleanup runs via
timer://identity-mfa-webauthn-challenge-cleanup once is past.

[RedbScheme("identity.webauthn_consumed_challenge")]
public class WebAuthnConsumedChallengeProps

Inheritance

Object→WebAuthnConsumedChallengeProps

Properties

ChallengeHash

SHA-256 hex (lowercase) of the raw challenge bytes. Indexed for replay detection.

public string ChallengeHash { get; set; }

ConsumedAt

When the consumed marker was written (UTC). Equal to ceremony-completion time.

public DateTimeOffset ConsumedAt { get; set; }

ExpiresAt

Absolute expiry of the original challenge — after this point the marker can be cleaned

public DateTimeOffset ExpiresAt { get; set; }

Operation

Operation that consumed the challenge: register or assert.

public string Operation { get; set; }

UserId

Owner user id; cross-checked at consume time to reject cross-user replay.

public long UserId { get; set; }