kernl API
    Preparing search index...

    Function createGroupMessagesBackend

    • A MessagingBackend for group sessions (Marmot, MLS over Nostr) over the active account's signer, built on @internet-privacy/marmot-ts.

      The account signer proves who each member is and opens invitations; the group library holds the group secrets, which move on with every commit, and kernl seals everything the library stores to the account with nip44 (D-018). When an account first uses the backend it publishes a key package (kind 30443) to its inbox relays and outbox tier, so others can start a group with it, and publishes a fresh one after each invitation uses it up.

      A send to people goes to the group with exactly those members, else to a new one that invites each of them by their key package; a recipient with none is refused with unavailable:recipient-not-ready. Group events (kind 445) go to the outbox and super tiers. Invitations arrive as gift wraps on the user's inbox relays and are joined as they open. When the account changes or signs out, the session closes and its messages are forgotten.

      Conversation ids are the group id in hex. A device is one member, so a second device of the same account sees only groups it was invited to.

      Parameters

      • options: GroupMessagingOptions

        Store, pool, tiers, storage, and the active account's signer and public key.

      Returns MessagingBackend

      A backend for the group provider; available while the signer has nip44.

      const backend = createGroupMessagesBackend({
      store: kernl.eventStore,
      pool: kernl.pool,
      tiers: kernl.relays,
      storage: localStorage,
      signer: () => kernl.accounts.active,
      selfPubkey: () => kernl.accounts.active?.pubkey,
      });
      await backend.send({ recipients: [alice, bob], content: 'hello both' });