The type of the history store to use for the group, must implement the BaseGroupHistory interface. (Default is no history store)
The type of the history store to use for the group, must implement the BaseGroupHistory interface. (Default is no history store)
ReadonlyciphersuiteThe ciphersuite implementation to use for the group
ReadonlyhistoryThe storage interface for the groups application message history
The group id as a hex string
ReadonlymediaThe storage interface for the groups media
ReadonlymediaOptional media helper for group encrypted attachments.
ReadonlynetworkThe nostr relay pool to use for the group
ReadonlyruntimeRuntime publisher for driving session effects through transport.
ReadonlysessionProtocol state owner for this group. Prefer this over convenience methods.
ReadonlysignerThe signer used for the clients identity
ReadonlystoreThe key-value backend where serialized group state bytes are persisted
The group's derived convergence status (group-state.md §Convergence
status, B5): Syncing / Resolving / Settled / Blocked. Recomputed on
read against the clock, so it advances to Settled once the quiescence
window elapses with no further convergence-relevant input.
The live full-fork history tree: every group state observed (the canonical
branch and every fork), keyed by MLS confirmation tag. Exposes synchronous
structural queries (node, childrenOf, tips, path, ancestors,
lowestCommonAncestor) and async snapshot access (stateAt,
commitMessageOf). For a serializable rendering snapshot use
forkTreeView.
Complete group info/debug model for chat panels and diagnostics.
The group's lifecycle state (group-state.md). A new local commit may only
be prepared while Stable; the commit flow moves through PendingPublish
(commit prepared, publish unconfirmed) and Merging (publish acked, staged
commit applying) and back to Stable.
Read the current group state
Decrypts an encrypted-media-v1 attachment downloaded from a blob store.
On the first call for a given file the plaintext bytes are derived via
key-derivation + ChaCha20-Poly1305 decryption (after verifying the
ciphertext and plaintext hashes) and stored in {@link media}. Subsequent
calls for the same attachment.ciphertextSha256 are served directly from
the cache, skipping key-derivation entirely.
Destroys the group and purges the group history
Releases in-memory resources without touching persisted state (B5): cancels the settle-check timer and fails any queued outbound. Call on unload so a timer/promise does not outlive the cached instance.
Encrypts a media file for sharing in a group message (encrypted-media-v1).
Derives the per-file key from the current MLS epoch, encrypts with ChaCha20-Poly1305, and returns the ciphertext alongside a populated MediaAttachment (hashes, nonce, media type, filename) with no locators yet.
Caller responsibilities:
encrypted to a blob store (ciphertextSha256 is the content id).{ kind, value }) onto attachment.locators.encodeMediaImetaTag and include the tag on the rumor.Evaluates whether a candidate's KeyPackage event (kind 30443) can be added
to this group — cipher-suite match, required_capabilities,
agent-text-stream-QUIC required_member_roles, and already-a-member. Use
this before GroupsManager.invite to surface why a KeyPackage can't be
added; an eligible: true result is safe to invite. Never throws.
A plain, serializable snapshot of the fork-history tree for debugging UIs — every node with its epoch, parent/children, tip flag, and whether it lies on the canonical path to the live tip (the branch convergence settled on, i.e. the node matching state). Computed on demand.
ingests an array of group messages and applies commits to the group state.
Processing happens in two stages:
After both stages, recursively retry unreadable messages until no more can be read. Events that can never be processed are yielded as UnreadableIngestResult.
Array of Nostr events containing encrypted MLS messages
Optionaloptions: { maxRetries?: number }DispositionedIngestResult - The processing result plus its inbound-processing Disposition.
Creates and publishes a proposal as a private MLS message.
Promise resolving to the publish response from the relays
Creates and publishes a proposal as a private MLS message.
Promise resolving to the publish response from the relays
Persists any pending changes to the group state in the store.
When true, writes the current state even if dirty is
false. Useful for persisting the initial state of a freshly constructed
group (e.g. after createGroup / joinGroupFromWelcome / import) without
having to mutate dirty externally.
Performs a self-update commit (no proposals) to rotate this member's leaf key material.
This is required by MIP-02 for forward secrecy after joining from a Welcome.
Unlike admin commits (see GroupsManager.commit), this operation is allowed for non-admin members.
Sends a proposal to the group relays
Convergence-gated outbound entry point (B5). While convergence is Settled
and the lifecycle allows outbound, the intent is built, encrypted, and
published immediately. Otherwise it is queued and the returned promise stays
pending until the quiescence window settles and the queue drains — so app
payloads are held, and group-state commits are (re)generated only against the
canonical post-settle state. leave() and the self_remove auto-committer
bypass this gate by design (departures and convergence progress, not fresh
local intents).
StaticfromCreates a new MarmotGroup instance from a ClientState object
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 MarmotGroupEvents<THistory, TMedia>Remove the listeners of a given event.
Optionalfn: (Optionalcontext: anyOptionalonce: boolean
The main class for interacting with a MLS group