@enc-protocol/group-sdk
v0.9.0
Published
ENC Protocol per-app SDK for the "group" app — group chat. Enclaves: Group, Personal.
Readme
@enc-protocol/group-sdk
Per-app SDK for the group app on ENC Protocol. Enclaves: Group, Personal.
Auto-generated by
lib/codegen/readme-codegen.mjsfromapps/group/{app,schema}.json. Do not hand-edit — regenerate viaenc gen readme group.
Install
Recommended — via the enc CLI
# Install the global enc CLI once (any project)
npm install -g @enc-protocol/cli
# Install the skill into the current project (.claude/commands/group.md)
enc skill add groupThe skill is the recommended consumption surface for Claude Code — adds an /enc group slash command. The skill package is published as @enc-protocol/skill-group.
Programmatic — for direct SDK use
npm install @enc-protocol/group-sdkQuick example
import { GroupSdk } from '@enc-protocol/group-sdk'
const sdk = new GroupSdk({ mode: 'cf', nodeUrl: process.env.NODE_URL })
await sdk.init()
await sdk.submitMessages({"message_draft":"example"})
const events = await sdk.queryMessages()API reference
new GroupSdk(opts)
Constructor. Accepts:
| Option | Type | Description |
|--------|------|-------------|
| mode | 'mem' \| 'cf' | Backend: in-process mem or HTTP cf |
| identity | Identity | Required for cf mode (signing keypair) |
| nodeUrl | string | cf-mode node URL (or set NODE_URL env) |
| repoRoot | string | Path to repo root for finding apps/<id>/ and enclaves/<Name>.json (defaults to package location) |
| encHome | string | Optional state directory (defaults to ~/.enc) |
async init()
Initialize the SDK: load app definition, register all 2 enclaves (Group, Personal), wire dataview, mint cf enclaves if needed.
Write methods
| Method | Data type | Resolves to | Encrypted | Ops | Operators |
|--------|-----------|-------------|-----------|-----|-----------|
| submitMessages(args) | messages | Group.message | ✓ | CDU | MEMBER | Sender | admin | dataview |
Read methods
| Method | Read | Source | Fields |
|--------|------|--------|--------|
| queryMessages() | messages | Group.message | body, outgoing |
| queryProfiles() | profiles | dataview (cross_enclave) | all |
Encryption
Data types messages are flagged encrypt in the app schema. The SDK calls this._encrypt(dataType, args) before submit. The default _encrypt is a pass-through.
To add real encryption (e.g. MLS for DM), subclass and override:
class EncryptedGroupSdk extends GroupSdk {
async _encrypt(dataType, args) {
// produce ciphertext for `args`
return { ciphertext: /* ... */ }
}
}Composition
- Enclaves:
Group,Personal - tableMap:
messages→message - encrypt:
messages - derived views:
members,pending,my_instances,active_instance
See also
cli.json— full app metadata + fuzz contractskill/SKILL.md— Claude Code skill bundle (install viaenc skill install group)@enc-protocol/app-sdk-base— base class (AppSdk,AppClient,DataView)
