kernl API
    Preparing search index...

    Function createRatchetMessagesBackend

    • A MessagingBackend for ratchet sessions (nostr-double-ratchet), over the active account's signer.

      For each signed-in account the backend runs one NdrRuntime. The account signer signs the owner's device list; the library generates and holds its own device key and per-session ratchet keys, which never leave it except as ciphertext sealed to the account by createSealedRatchetStorage. Opening a runtime registers this browser as a device of the account and publishes its invite, so a correspondent can start a session; sessions and keys survive a reload, the conversation list does not (D-016).

      Only chat messages are filed: typing notices, receipts and controls are dropped. Sessions are one to one, so a send names exactly one other person. When the account changes or signs out the runtime closes and the conversations are cleared.

      Parameters

      Returns MessagingBackend

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

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