@aroha-sdk/registry
v1.3.5
Published
Aroha registry SDK: blockchain contract wrapper, IPFS manifest storage, capability discovery
Readme
@aroha-sdk/registry
Discover and register agents on the Aroha network — find agents you can issue mandates to.
Install
npm install @aroha-sdk/registryQuick example
import { registerAgent, resolveAgent, listAgents } from "@aroha-sdk/registry";
// Register an agent so others can discover it and issue mandates to it
await registerAgent({
did: "did:aroha:flight-agent",
manifestCID: "QmXxx…",
publicKeyB64: "MFkwEw…",
endpointUrl: "https://flight-agent.fly.dev",
capabilities: ["book-flights", "search-flights"],
});
// Resolve an agent by DID hash before issuing a mandate
const agent = await resolveAgent("did:aroha:flight-agent");
// agent.endpointUrl, agent.publicKeyB64, agent.capabilities
// Find agents by capability
const flightAgents = await listAgents({ capability: "book-flights" });
// Issue a mandate to flightAgents[0].did, then call flightAgents[0].endpointUrlWhy this exists in the mandate chain
A mandate is issued to a specific DID. The registry is how you find the DID (and public key) of the agent you want to delegate to — so you can issue a correctly targeted, verifiable mandate before making any call.
API
registerAgent(opts)— register an agent manifest. Requiresdid,manifestCID,publicKeyB64,endpointUrl.resolveAgent(did)— fetch the registry record and manifest for a DID. Returns{ did, endpointUrl, publicKeyB64, capabilities, manifestCID }.listAgents(filter?)— list registered agents, optionally filtered bycapabilityorname.resolveManifest(manifestCID)— fetch the IPFS-pinned agent manifest.
License
MIT
