Marmot-TS
    Preparing search index...

    Class GroupMediaStore

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

    The lookup key is the hex-encoded SHA-256 of the plaintext bytes, matching the sha256 / x field stored in the MIP-04 imeta tag.

    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

    Client - Group Media

    • 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 plaintext.

      Parameters

      • sha256Hex: string

        Hex-encoded SHA-256 of the plaintext blob

      • entry: StoredMedia

        The plaintext data and its MIP-04 attachment metadata

      Returns Promise<void>

    Other

    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