@zanii/erc8004
v0.1.1
Published
Register & resolve agents as ERC-8004 on-chain identities wired to their Zanii proof endpoints - build the registration file, resolve one back, and verify the agent's history offline.
Readme
@zanii/erc8004
Register & resolve agents as ERC-8004 on-chain identities, wired to their Zanii
proof endpoints. ERC-8004 mints an agentId whose agentURI resolves to a
registration file; this is where Zanii plugs in — the agent's DID, its
transparency-log proof endpoints, and its audit-bundle export. Build that file,
resolve one back, and verify the agent's full history offline.
npm install @zanii/erc8004 @zanii/coreUsage
import { buildRegistrationFile, toDataUri, resolveRegistration, verifyResolvedAgent } from '@zanii/erc8004';
// build the registration file (serve it at the agentURI, or inline it):
const file = buildRegistrationFile({
name: 'Acme Bot', description: 'a provable agent',
agentDid, ownerDid, logId, logUrl: 'https://ledger.zanii.agency',
});
const agentUri = toDataUri(file); // or host the JSON at an https/ipfs URL
// resolve one back and verify the agent's whole history — zero trust in the resolver:
const { agent, verified } = await verifyResolvedAgent(agentUri);
if (verified) { /* this ERC-8004 identity's proofs all check out */ }The registration file advertises supportedTrust: ["proof-of-action:zanii-v1"] and
carries the agent's DID + proof/export endpoints. verifyResolvedAgent fetches the
audit bundle and runs verifyAuditBundle, so verified reflects the bundle's own proofs.
Minting is on-chain. This packages the parts that don't need a wallet (build / resolve / verify). Mint the
agentIdwith your own signer, or the server mint tooling, then pass the{ agentId, agentRegistry }back-reference intobuildRegistrationFile.
Changelog
- 0.1.0 — initial release:
buildRegistrationFile,toDataUri,resolveRegistration,verifyResolvedAgent.
License
Apache-2.0.
