Marmot-TS
    Preparing search index...

    A group-scoped cache of decrypted StoredMedia entries used by MarmotGroup to avoid redundant key-derivation and decryption on repeated reads of the same media attachment.

    The lookup key is the hex-encoded SHA-256 of the ciphertext bytes, matching the ciphertext_sha256 field of the encrypted-media-v1 imeta tag (the preferred blob content id).

    Emits events whenever the cache state changes, enabling reactive UIs to update without polling.

    If no backend is provided a simple in-memory store is used, giving an ephemeral in-process cache with no disk persistence.

    Hierarchy

    Implements

    Index
    • Adds a decrypted blob to the cache if it is not already present.

      Emits mediaAdded when a new entry is stored. If an entry for the given key already exists the call is a no-op and no event is emitted. The key is the hex-encoded SHA-256 of the ciphertext.

      Parameters

      • sha256Hex: string

        Hex-encoded SHA-256 of the ciphertext blob

      • entry: StoredMedia

        The plaintext data and its attachment metadata

      Returns Promise<void>

    • Returns true if a cached entry exists for the given key.

      Parameters

      • sha256Hex: string

        Hex-encoded SHA-256 of the ciphertext blob

      Returns Promise<boolean>

    • Removes the cached entry for the given key. Emits mediaRemoved if an entry existed.

      Parameters

      • sha256: string

        Hex-encoded SHA-256 of the ciphertext blob

      Returns Promise<void>

    • Async generator that yields the full list of MediaAttachment entries whenever the store changes. The current snapshot is emitted immediately on subscription, then again after every mediaAdded, mediaRemoved, or cleared event.

      Changes during reads or paused consumption are coalesced. Abort, return, throw, or async disposal promptly releases listeners, even while a storage read is pending. Explicitly close iterators when no longer needed.

      Parameters

      • options: { signal?: AbortSignal } = {}

      Returns AsyncGenerator<MediaAttachment[]>

    prefixed: string | boolean
    • Type Parameters

      Parameters

      Returns this

    • Return an array listing the events for which the emitter has registered listeners.

      Returns (keyof GroupMediaStoreEvents)[]

    • Return the number of listeners listening to a given event.

      Parameters

      Returns number

    • Return the listeners registered for a given event.

      Type Parameters

      Parameters

      • event: T

      Returns (
          (
              ...args: ArgumentMap<GroupMediaStoreEvents>[Extract<
                  T,
                  keyof GroupMediaStoreEvents,
              >],
          ) => void
      )[]

    • Type Parameters

      Parameters

      Returns this

    • Add a listener for a given event.

      Type Parameters

      Parameters

      Returns this

    • Add a one-time listener for a given event.

      Type Parameters

      Parameters

      Returns this

    • Remove all listeners, or those of the specified event.

      Parameters

      • Optionalevent: keyof GroupMediaStoreEvents

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      Parameters

      Returns this