Class RedbDpopReplayStore
PROPS-backed mirroring
. Singleton; resolves
through a fresh DI scope per operation to avoid
captive-scope-in-singleton.
Atomicity (RFC 9449 §11.1, at most once): the reservation row carries
ValueUnique = SHA-256 of jkt|jti, so the database index decides who wins, not
the lookup. Two presentations of one proof racing past FirstOrDefaultAsync both try
to insert; the index lets exactly one through and the other gets
, reported as a replay. The lookup stays as the
fast path — an already-consumed proof is refused without a failing statement — and an
expired reservation is refreshed in place rather than inserted a second time.
The key is hashed for the reason the idempotency record's is:
jti is chosen by the client and unbounded, while ValueUnique is capped at 440
characters. Rows written before the key existed carry none; the lookup still finds them,
and the cleanup timer removes them within one TTL.
public sealed class RedbDpopReplayStore : IDpopReplayStore
Inheritance
Implements
Methods
TryReserveAsync(string, string, TimeSpan, CancellationToken)
Attempts to reserve the given jti bound to the proof's
public Task<bool> TryReserveAsync(string jkt, string jti, TimeSpan ttl, CancellationToken ct = default)