bothy-sdk
    Preparing search index...

    Class MemoryInboxStore

    An in-memory InboxStore for tests; it behaves like FileInboxStore but is lost on exit. Entries are kept in arrival order, so entries without seq keep their arrival order.

    const verifier = new InvocationVerifier({ instanceId, agentId, jwks, replay: new MemoryInboxStore() });
    

    Implements

    Index

    Constructors

    Methods

    • Stores a new entry with a copy of its envelope.

      Parameters

      Returns Promise<void>

      A promise that resolves when stored.

      RangeError when the event is already stored, its ID is not a UUID or the envelope carries a token.

    • Nothing to release.

      Returns Promise<void>

      A resolved promise.

    • Returns the entries of a run in seq order.

      Parameters

      • runId: string

        The run.

      Returns Promise<InboxEntry[]>

      The entries.

    • Returns the entry of eventId.

      Parameters

      • eventId: string

        The envelope id.

      Returns Promise<InboxEntry | undefined>

      The entry, or undefined.

    • Returns whether jti is remembered beyond nowMs.

      Parameters

      • jti: string

        The token ID.

      • nowMs: number

        The current wall time.

      Returns Promise<boolean>

      Whether the jti is still remembered.

    • Drops the expired jti rows.

      Parameters

      • nowMs: number

        The current wall time.

      Returns Promise<void>

      A promise that resolves when done.

    • Counts a redelivery; see InboxStore.redelivered.

      Parameters

      • eventId: string

        The envelope id.

      • token: Secret | undefined

        The token of the redelivery, if any.

      • iat: number | undefined

        Its iat.

      • jti: string | undefined

        Its jti.

      Returns Promise<InboxEntry>

      The entry after the update.

      RangeError when the event is not stored.

    • Remembers jti until untilMs (an earlier end never shortens a later one).

      Parameters

      • jti: string

        The token ID.

      • untilMs: number

        When the token cannot pass anymore (exp plus the leeway).

      Returns Promise<void>

      A promise that resolves when stored.

    • Replaces the token unconditionally.

      Parameters

      • eventId: string

        The envelope id.

      • token: Secret

        The granted token.

      • iat: number

        Its iat.

      • jti: string

        Its jti.

      Returns Promise<void>

      A promise that resolves when stored.

      RangeError when the event is not stored.

    • Sets the state of an entry.

      Parameters

      • eventId: string

        The envelope id.

      • state: EntryState

        The new state.

      Returns Promise<void>

      A promise that resolves when stored.

      RangeError when the event is not stored.