RequestSeal.Replay.Claim (RequestSeal v0.3.1)

Copy Markdown View Source

Bounded caller uniqueness and exclusive retention end in Unix seconds.

Retention ends above 253,402,300,799 reject because no accepted sweep clock can evict them. Stores reject invalid claims with their existing failure.

Summary

Functions

Validate the bounded shape of a replay claim without claiming or storing it.

Types

t()

@type t() :: %RequestSeal.Replay.Claim{
  key: binary(),
  namespace: binary(),
  retain_until: integer()
}

Functions

valid?(claim)

@spec valid?(term()) :: boolean()

Validate the bounded shape of a replay claim without claiming or storing it.

Requires exactly a RequestSeal.Replay.Claim struct with namespace and key binaries of 1–256 bytes each and retain_until from -9,223,372,036,854,775,808 through 253,402,300,799. Negative ends remain valid already-expired claims. Binaries need not be UTF-8. Other values, maps, and structs with extra fields return false. Validation does not check a clock, require a future retention end, derive uniqueness, or establish replay protection. Stores enforce the exclusive Unix-second retention end when claiming.

iex> claim = %RequestSeal.Replay.Claim{namespace: "scope", key: "nonce", retain_until: 0}
iex> RequestSeal.Replay.Claim.valid?(claim)
true
iex> RequestSeal.Replay.Claim.valid?(%{claim | key: ""})
false