Skip to main content

Module nonce_cache

Module nonce_cache 

Source
Expand description

Replay-protected packet receiver — no_std edition.

Mirrors tf-types::constrained::PacketReceiver. The receiver keeps a sliding window of recently-seen (packet_id, expires_at) pairs:

  • On observe, if expires_at < now, return Reject(Expired).
  • Otherwise, if packet_id is already in the window, return Reject(Replay).
  • Otherwise, accept and record. The window evicts FIFO once it reaches its bounded capacity.

With the alloc feature, the cache is backed by a VecDeque / BTreeSet pair sized at runtime (capacity is still bounded). With --no-default-features, the cache uses heapless::Deque and a membership probe over the deque, both with a const-generic N.

Structs§

PacketReceiveralloc
PacketReceiver with a VecDeque-backed window. Available with the alloc feature.

Enums§

ReceiverDecision
Result of PacketReceiver::observe.
RejectReason
Why a PacketReceiver rejected a packet.

Constants§

PACKET_ID_CAP
Maximum length of a packet ID (per TF-0001 actor-id sizing — packet IDs are short ULIDs / UUIDs but we leave headroom).
TIMESTAMP_CAP
Maximum length of an expires_at ISO-8601 timestamp (YYYY-MM-DDTHH:MM:SSZ).