ENC Registry client (Node.js) — RegistryRestClient, RegistryWsClient
Registry Node SDK — REST + WebSocket clients for real servers.
npm install @enc-protocol/registry-node --registry https://npm-registry.ocrybit.workers.dev/import { RegistryRestClient, createIdentity } from "@enc-protocol/registry-node/rest.js"
const owner = createIdentity("alice")
const client = await RegistryRestClient.create("http://localhost:8787", owner)
const result = await client.regnode({ seq_pub: "...", endpoints: "...", protocols: "...", enc_v: "..." })
console.log(result.ok)
const events = await client.query("Reg_Node")
await client.grant(bob, "Member")import { RegistryWsClient } from "@enc-protocol/registry-node/ws.js"
const ws = new RegistryWsClient("ws://localhost:8787", identity, enclaveId)
await ws.connect()
ws.onEvent((event) => console.log("New:", event.type, event.content))
// later: ws.close()| Method | Params | Returns |
|---|---|---|
async regnode(seq_pub, endpoints, protocols, enc_v) | seq_pub, endpoints, protocols, enc_v | { ok, error? } |
async regenclave(enclave_id, node_pub, manifest, app) | enclave_id, node_pub, manifest, app | { ok, error? } |
async regidentity(pub_key, display_name, avatar, bio) | pub_key, display_name, avatar, bio | { ok, error? } |
async query(type?) | string | Event[] |
async grant(target, role) | Identity, string | { ok, error? } |
static async create(url, owner) | string, Identity | RegistryRestClient |
| Method | Description |
|---|---|
async connect() | Open WebSocket, authenticate |
onEvent(fn) | Subscribe to events, returns unsubscribe fn |
close() | Disconnect |
@enc-protocol/app-node@enc-protocol/registry