Skip to main content

Module replay_key

Module replay_key 

Source
Expand description

Fixed-size keys for OAuth replay barriers.

A replay barrier keeps one map entry and one heap node for each live key. On the supported 64-bit targets, a [u8; 32] key plus Entry<()> is 56 bytes and a heap node is 56 bytes. HashMap needs at most eight buckets for seven live entries, so the map contributes at most 64 bytes per live key before allocation growth; together that is 120 bytes. Capacity planning rounds this to 128 bytes per live key before allocator slack. Unlike a String, every retained part of this key is fixed-size.

Replay identifiers are controlled by remote callers. Keeping their raw strings in a bounded entry-count cache would still leave retained memory unbounded, and TtlCache stores each key in both its map and expiry heap. A BLAKE3-256 digest makes retained key storage exactly 32 bytes per copy.

Constants§

REPLAY_BARRIER_ENTRY_BYTES
Conservative per-live-entry planning size for a no-refresh replay barrier.

Functions§

atproto_service_assertion_jti
Digest a length-framed issuer/JTI tuple in the ATProto assertion domain.
client_assertion_jti
Digest a length-framed client-ID/JTI tuple in the client-assertion domain.
dpop_jti
Digest a DPoP proof JTI in its own replay domain.
mount_ticket_jti
Digest a one-use mount ticket JTI in its own replay domain.

Type Aliases§

ReplayKey
BLAKE3-256 replay-barrier key.