4. @fleetmesh/circles#

@fleetmesh/circles provides TypeScript implementations of two distinct subsystems:

  1. Circle governance (the browser counterpart to fleetmesh_core.network and meshctl circle): circle controller documents (kind 30834), member co-signed capability grants (kinds 30832 and 30833), fleet enrollment tokens, private fleet rosters (kind 30835), and brand verification.

  2. Social circle client helpers: group DID documents, UCAN and W3C Verifiable Credential objects, per-circle epoch keys, circle-scoped sealed storage, invitation tracking, and member count utilities.

4.1. Installation#

npm install @fleetmesh/circles@next @fleetmesh/textile@next @fleetmesh/leaf@next

Runtime dependencies are @fleetmesh/leaf, @fleetmesh/textile, @noble/curves, and @noble/hashes.

Note

fleetmesh_protocols.circles (Circle Rooms (fleetmesh_protocols.circles)) implements the host-side social circle-rooms store and is unrelated to circle governance.

4.2. Governance#

A FleetMesh circle possesses neither a shared private key nor a central server. Its controller document enumerates member public keys and per-tier quorum thresholds, and is published alongside grants on standard NIP-01 relays. Governance workflows query events at deterministic coordinates, evaluate state transitions locally, and publish resulting signed events. These modules port the Python reference implementation and are validated against its conformance vectors (core/vectors/*.json, mirrored in test/vectors/).

Module

Description

group

Kind 30834 controller documents: groupRead parses a single document, groupResolve resolves observed documents into the active signing set for a did:group (or throws GroupRefused), and controllerDocument constructs an unsigned kind 30834 event for member publication.

circleFlows

Circle founding and epoch rotation, corresponding to meshctl circle create and amend: cleanSlug, chooseSlug, found (epoch 0, signed by the founder), amend (member copy for the next epoch), extend, and loadGroup.

circleGrants

Multi-party grant quorum assembly from identical member copies: propose, cosign (one vote per member key), copies, matching, status (signed count, threshold, enacted state), bundle, and revoke.

grant, grantToken, grantVerify

Kinds 30832 and 30833: grant minting via an abstract signer (browser key or NIP-07 extension without exposing private key material), token envelope serialization, and delegation chain verification (verify, decide).

positions

Named capability bundles at a single tier (such as maintainer), allowing applications to present role abstractions over the protocol’s capability vocabulary. Positions are purely client-side metadata; nodes evaluate the underlying grant capabilities.

enrolToken

Fleet enrollment tokens: kind 30832 grants of the fleet enrol capability bound to the enrolling node’s public key and encoded as fmenrol1… strings (mintEnrol, verifyEnrol, decideEnrol).

roster

Owner’s private fleet roster (kind 30835), NIP-44 encrypted to the owner’s own key: sealRoster, openRoster, addNode, removeNode, and fleetFromRoster.

brand

NIP-32 label-based brand verification combining an authority’s kind 1985 endorsement with the tool’s self-claim, which are valid only jointly (readEndorsement, readClaim, members).

circleRelay

Relay transport abstraction: CircleRelay (publish, query), circleRelayFor (wrapping a leaf relay connection), and MemoryRelay for testing and dry runs.

schemaConstants, operatorDid, schnorr

Schema-derived event kinds, tiers, capability vocabularies, and refusal codes; operator DID parsing; BIP-340 Schnorr signing.

Every governance operation reports rejections via typed exceptions (GroupRefused, FlowRefused, ChainRefused, TokenRefused, RosterRefused, BrandRefused) carrying a canonical refusal code defined in the schema.

4.3. Social Circles#

Module

Description

circleDidAndUcanCore

computeCircleGroupDid and buildCircleDidDocument for circle records; mintUcanGrantTokenObject and mintCircleMemberCredentialObject for generating member UCAN and W3C Verifiable Credential objects.

circleKeys, vaultKey

Per-circle epoch key management (circleScope) and device vault key accessors (getVaultKey, setVaultKey).

sealedStore

Circle-scoped XChaCha20-Poly1305 encrypted storage (rememberScopeKey, sealIntoScope, loadSealed).

circleInviteStore, circleMemberCount

Pending invitation persistence and member roster counting and formatting utilities.

hostAdapter

configureCirclesHost registration for listing, fetching, and uploading user fibers and posting circle keys. When unconfigured, read operations return null and write operations throw HostNotConfiguredError.

types

Type definitions for circle and member records.