ReadonlyclientDefault slot identifier (d tag value) used by create when no
explicit d is passed in options. Set this to a stable string (e.g.
"my-app-desktop") so all key packages from this manager share a single
addressable slot on relays.
Adds a LocalKeyPackage to the store.
Must include publicPackage and privatePackage.
Optionally include identifier to persist the addressable slot identifier.
The storage key (hex ref string)
Clears all entries (local and tracked) from the store.
Returns the number of locally stored key packages.
Creates a new key package, stores the private material locally, signs and publishes a kind 30443 addressable event to the specified relays, and records the event.
The d (slot identifier) is resolved in order:
options.d (explicit)this.clientId (manager default)Creation options, including required relay URLs
The stored key package (without private material)
Retrieves the full key package from the store.
Retrieves the private key material for a key package. Used internally by MarmotClient when processing Welcome messages.
The key package reference
The private key package, or null if not found
Checks whether a key package exists in local private key storage.
Lists all locally stored key packages, each enriched with their published Nostr events.
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.
The key package reference
Completely purges one or more key packages: publishes a NIP-09 deletion for all known relay event IDs, removes local private key material, and clears the publish records.
One or more key package references (hex string or Uint8Array)
Removes a key package from local private key storage only.
Does not publish a relay deletion and does not touch publish records. Use when the key package was never published, or when relay cleanup has already been handled separately.
The key package reference to remove
Rotates a key package: publishes a new kind 30443 event (reusing the same
d slot so relays replace the old event automatically), then removes the
old private key material.
For legacy kind-443 published events on the entry, a NIP-09 deletion is sent before publishing the replacement. Kind-30443 published events do not need explicit deletion — the new event supersedes them on relays.
The key package reference of the key package to rotate
Optionaloptions: RotateKeyPackageOptionsOptions for the new key package
The new stored key package (without private material)
Observes a Nostr event and, if it is a kind 443 or kind 30443 key package
event with a valid i tag (MIP-00 keyPackageRef), records it in the store.
Any Nostr event; non-key-package events are silently ignored
true if the event was recorded, false if ignored
Watches for any change to key packages or their published events.
Yields the current snapshot on subscription, then re-yields on every subsequent change.
StaticprefixedOptionalcontext: anyCalls each of the listeners registered for a given event.
Return an array listing the events for which the emitter has registered listeners.
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Optionalfn: (Optionalcontext: anyOptionalonce: booleanAdd a listener for a given event.
Optionalcontext: anyAdd a one-time listener for a given event.
Optionalcontext: anyRemove all listeners, or those of the specified event.
Optionalevent: keyof KeyPackageManagerEventsRemove the listeners of a given event.
Optionalfn: (Optionalcontext: anyOptionalonce: boolean
Manages the full lifecycle of MLS key packages — local private material and the Nostr kind-30443 events that advertise this client to potential inviters.
Legacy kind-443 events are supported for reading and deletion only; new events are always published as kind 30443.