InMemoryInvitationReplayGuard
Defined in: packages/core/src/invitation-replay-guard.ts:84
Bounded, fail-closed replay memory for one-time public invitations.
observeJoin lets an inviter claim an offer for exactly one signed join
request. observeAcceptance additionally enforces every recipient,
KEM-key, role, document, issuer, digest, and lifetime binding before it
records a single acceptance. A repeat of the same signed fields returns
replay, even under a different valid signature, so an integration can
return or apply its cached result without repeating ACL or key mutations.
Reuse of an identifier with different signed fields, or a second
request/acceptance for the same offer, fails closed.
This guard intentionally does not verify signatures. Callers MUST verify the offer, join request, and acceptance with their bound public identities before recording them here. The guard stores identifiers and SHA-256 digests only; it never retains sealed Welcomes, bootstrap ciphertext, or key material.
Live entries are never silently evicted because eviction would make an old invitation replayable. Records are retired only after the signed offer’s hard expiry, when the envelope can no longer be accepted.
Omit the optional time argument to sample wall time again after hashing. An explicit timestamp supplies a trusted, fixed clock observation. Effective time never moves backwards within this guard instance.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new InMemoryInvitationReplayGuard(
maxEntries?):InMemoryInvitationReplayGuard
Defined in: packages/core/src/invitation-replay-guard.ts:95
Parameters
Section titled “Parameters”maxEntries?
Section titled “maxEntries?”number = DEFAULT_INVITATION_REPLAY_GUARD_ENTRIES
Returns
Section titled “Returns”InMemoryInvitationReplayGuard
Properties
Section titled “Properties”maxEntries
Section titled “maxEntries”
readonlymaxEntries:number=DEFAULT_INVITATION_REPLAY_GUARD_ENTRIES
Defined in: packages/core/src/invitation-replay-guard.ts:96
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get size():
number
Defined in: packages/core/src/invitation-replay-guard.ts:117
Number of distinct one-time offers currently remembered.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”observeAcceptance()
Section titled “observeAcceptance()”observeAcceptance(
offer,request,acceptance,nowMs?):Promise<InvitationReplayDecision>
Defined in: packages/core/src/invitation-replay-guard.ts:164
Record an issuer acceptance after checking its complete recipient binding.
An acceptance with the same signed fields is idempotent and returns
replay, whatever its signature bytes. A second acceptance for the offer
or reuse of an acceptance ID with other signed fields is rejected. This
method also records the matching join claim when called on a fresh
recipient-side guard.
Parameters
Section titled “Parameters”request
Section titled “request”acceptance
Section titled “acceptance”nowMs?
Section titled “nowMs?”number
Returns
Section titled “Returns”Promise<InvitationReplayDecision>
observeJoin()
Section titled “observeJoin()”observeJoin(
offer,request,nowMs?):Promise<InvitationReplayDecision>
Defined in: packages/core/src/invitation-replay-guard.ts:128
Record a recipient’s signed request for a usable offer.
A request with the same signed fields is idempotent and returns replay,
whatever its signature bytes. A different request for the same offer,
including one that changes only recipient or KEM key, is rejected.
Parameters
Section titled “Parameters”request
Section titled “request”nowMs?
Section titled “nowMs?”number
Returns
Section titled “Returns”Promise<InvitationReplayDecision>