Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

@enc-protocol/group-cli — GroupSdk

Group chat: MLS-encrypted group messages with admin moderation, muting, and member-state management (PENDING / MEMBER / BLOCKED).

Extends AppSdk. Enclaves: Group, Personal. Encrypted data_type: messages (mls-lazy).

Install

npm config set @enc-protocol:registry https://npm-registry.ocrybit.workers.dev/
npm install @enc-protocol/group-cli

Construct

import { GroupSdk } from '@enc-protocol/group-cli'
 
const sdk = new GroupSdk({ mode: 'cf', nodeUrl: process.env.NODE_URL, identity })
await sdk.init()

Options are the standard AppSdk constructor.

Data types

data_typeshapeencryptionroutes to
messages{ message_draft: string }mls-lazyGroup.message

Methods

submitMessages(args)

await sdk.submitMessages({ message_draft: 'hi everyone' })   // → Group.message (encrypted)

Encrypts the draft to the current group epoch with mls-lazy (a binary ratchet tree giving O(log N) key distribution) and writes it to the Group enclave.

queryMessages()

Read decrypted group messages. Row fields: body, outgoing.

queryProfiles()

Cross-enclave dataview read of Personal.Shared(profile) — the latest profile per member.

Membership

The Group enclave models membership with RBAC states (PENDING, MEMBER, BLOCKED) and traits (owner, admin, muted). Joins, promotions, mutes, and blocks are access-control events on the enclave — issue them via the lower-level adapter or the enc group CLI; see the Group enclave profile.

Example

import { GroupSdk } from '@enc-protocol/group-cli'
 
const sdk = new GroupSdk({ mode: 'cf', nodeUrl: process.env.NODE_URL, identity })
await sdk.init()
 
await sdk.submitMessages({ message_draft: 'gm all' })   // MLS-encrypted (mls-lazy)
 
const msgs    = await sdk.queryMessages()
const members = await sdk.queryProfiles()               // cross-enclave profiles

See also