Skip to content

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.

new InMemoryInvitationReplayGuard(maxEntries?): InMemoryInvitationReplayGuard

Defined in: packages/core/src/invitation-replay-guard.ts:95

number = DEFAULT_INVITATION_REPLAY_GUARD_ENTRIES

InMemoryInvitationReplayGuard

readonly maxEntries: number = DEFAULT_INVITATION_REPLAY_GUARD_ENTRIES

Defined in: packages/core/src/invitation-replay-guard.ts:96

get size(): number

Defined in: packages/core/src/invitation-replay-guard.ts:117

Number of distinct one-time offers currently remembered.

number

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.

InvitationOfferV1

InvitationJoinRequestV1

InvitationAcceptanceV1

number

Promise<InvitationReplayDecision>


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.

InvitationOfferV1

InvitationJoinRequestV1

number

Promise<InvitationReplayDecision>