@zanii/core
v0.4.0
Published
Zanii protocol: verifiable identity, signed action receipts, Merkle transparency-log proofs. Pure, no I/O.
Readme
@zanii/core
The Zanii protocol as pure functions — no I/O, no network, no trusted party.
Agent identities (did:key), scoped delegation certificates, signed action
receipts, RFC 6962 Merkle transparency-log proofs, and self-contained audit
bundles. Everything here is deterministic; use it to build proofs, or to
verify them independently of any Zanii server.
If you want to instrument a live agent (batching, HTTP ingest, tool wrapping),
use @zanii/sdk, which builds on
this.
npm install @zanii/coreVerify a receipt, offline
import {
generateKeypair,
createCert,
createReceipt,
hashPayload,
verifyReceipt,
} from '@zanii/core';
const owner = generateKeypair();
const agent = generateKeypair();
const cert = createCert(
{ issuer: owner.did, subject: agent.did, scopes: ['crm.*'], exp: '2027-01-01T00:00:00Z' },
owner.privateKey,
);
const receipt = createReceipt(
{
agentId: agent.did,
delegation: [cert],
action: 'tool_call',
target: 'crm.lookup',
payloadHash: hashPayload(JSON.stringify({ email: '[email protected]' })),
ts: new Date().toISOString(),
prev: null,
},
agent.privateKey,
);
// Checks the signature, the delegation chain, and that the action is in scope —
// with no server and no trust.
const result = verifyReceipt(receipt);
if (!result.ok) throw new Error(result.error);verifyAuditBundle(bundle) does the same for a complete exported history at
once: every receipt's signature and Merkle inclusion, the per-agent hash chain,
revocations, and on-chain anchor consistency.
Links
- Docs & concepts — https://ledger.zanii.agency/docs
- Live transparency log — https://ledger.zanii.agency
Changelog
- 0.4.0 — optional signature-covered
subject_tagreceipt field (per-subject auditability,@zanii/subject). - 0.3.0 —
saltedPayloadHash/verifyPayload,createConfirmation/verifyConfirmation,createCoSignature/verifyCoSignature, and optional receipt provenance fields (runtime_hash/model_id/manifest_hash). - 0.2.0 — version bump in lockstep with the package family (no API changes).
- 0.1.0 — initial release:
did:keyidentity, scoped/expiring delegation, signed hash-chained receipts, RFC 6962 Merkle inclusion + consistency proofs, signed tree heads, audit-bundle verification, and cross-org (A2A) receipts.
License
Apache-2.0.
