Marmot-TS
    Preparing search index...

    Owns the persisted key package entries — the local private material and the tracked kind-30443 events that advertise each package. Pure storage: it never signs or publishes (that is KeyPackagePublisher's job). Mirrors darkmatter's AccountSecretStore seam.

    Hierarchy

    Index
    • Adds a LocalKeyPackage to the store.

      Parameters

      • keyPackage: Pick<LocalKeyPackage, "privatePackage" | "publicPackage"> & Partial<
            Pick<LocalKeyPackage, "published" | "identifier" | "publicationRelays">,
        >

        Must include publicPackage and privatePackage. Optionally include identifier to persist the addressable slot identifier.

      Returns Promise<string>

      The storage key (hex ref string)

    • Appends a kind-30443 Nostr event to the published list of the key package identified by ref. If no entry exists yet, a TrackedKeyPackage is created by decoding the public key package from the event body.

      Throws if the event body cannot be decoded as a valid key package, or if the event's i tag (KeyPackageRef) does not match the decoded body.

      Parameters

      • ref: string | Uint8Array<ArrayBufferLike>
      • event: NostrEvent
      • relays: readonly string[] = []

      Returns Promise<void>

    • Returns the number of locally stored key packages (those with private material).

      Returns Promise<number>

    • Separate stores are not atomic: a crash may delay retirement until recovery. Pre-adoption receipts remain harmless until their group actually exists.

      Parameters

      • hasAdoptedGroup: (groupId: Uint8Array) => Promise<boolean>

      Returns Promise<void>

    • Retrieves the stored key package entry. Returns any entry regardless of whether it has private material.

      Parameters

      • ref: string | Uint8Array<ArrayBufferLike>

      Returns Promise<StoredKeyPackage | null>

    • Retrieves the private key material for a key package.

      Parameters

      • ref: string | Uint8Array<ArrayBufferLike>

        The key package reference

      Returns Promise<PrivateKeyPackage | null>

      The private key package, or null if not found

    • Checks whether a key package with local private material exists.

      Parameters

      • ref: string | Uint8Array<ArrayBufferLike>

      Returns Promise<boolean>

    • Marks a key package as used by setting used = true on the stored entry.

      Does nothing if no entry is found for the given ref.

      Parameters

      • ref: string | Uint8Array<ArrayBufferLike>

        The key package reference

      Returns Promise<void>

    • Records validated intent before adoption, without altering private material.

      Parameters

      • groupId: Uint8Array
      • ref: Uint8Array

      Returns Promise<void>

    • Removes a key package from the backend.

      Parameters

      • ref: string | Uint8Array<ArrayBufferLike>

      Returns Promise<void>

    prefixed: string | boolean
    • Type Parameters

      Parameters

      Returns this

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

      Returns (keyof KeyPackageStoreEvents)[]

    • 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<KeyPackageStoreEvents>[Extract<
                  T,
                  keyof KeyPackageStoreEvents,
              >],
          ) => 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 KeyPackageStoreEvents

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      Parameters

      Returns this