Marmot-TS
    Preparing search index...

    Class MarmotClient<THistory, TMedia>

    Type Parameters

    Index

    Client - Marmot Client

    capabilities: Capabilities

    The capabilities to use for the client

    cryptoProvider: CryptoProvider

    Crypto provider for cryptographic operations

    Manages group lifecycle: persistence, caching, creation, loading, leaving

    invites: InviteManager

    Manages invite lifecycle: ingestion, decryption, and storage

    keyPackages: KeyPackageManager

    Manages key package lifecycle: local storage, publishing, and rotation

    The nostr relay pool to use for the client

    signer: EventSigner

    The signer used for the clients identity

    • Joins a group from a Welcome message received via NIP-59 gift wrap.

      This method:

      1. Decodes the Welcome message from the kind 444 event
      2. Finds the matching local KeyPackage private material from the store
      3. Calls ts-mls joinGroup() to create a new ClientState
      4. Persists the resulting ClientState via this.groups.adoptClientState()
      5. Marks the consumed key package as used via this.keyPackages.markUsed()
      6. Returns a MarmotGroup instance

      After joining, callers can list used key packages with (await client.keyPackages.list()).filter(p => p.used) and rotate them via client.keyPackages.rotate(ref) to publish fresh ones to relays.

      Parameters

      • options: { welcomeRumor: Rumor }
        • welcomeRumor: Rumor

          The unwrapped kind 444 rumor event containing the Welcome message

      Returns Promise<{ group: MarmotGroup<THistory, TMedia> }>

      Promise resolving to the joined group

      Error if no matching KeyPackage is found or if joining fails

    • Reads the GroupInfo from a Welcome rumor without joining the group.

      Finds the local key package that matches one of the welcome's recipient slots, then decrypts the group info using that key package. Useful for previewing group metadata (name, relays, admins) before deciding to join.

      Parameters

      • welcomeRumor: Rumor | Welcome

        The decrypted kind 444 welcome rumor

      Returns Promise<GroupInfo | null>

      The decrypted GroupInfo, or null if no matching key package is found or decryption fails