@agenomics/capability-manifest-validator
v0.1.0
Published
ADR-060 reference validator for AEP capability manifests. Validates schema, RFC-8785 canonical-JSON hash, and Ed25519 signature.
Maintainers
Readme
@agenomics/capability-manifest-validator
Reference validator for the AEP capability manifest format defined in ADR-060.
Agents in the Agenomics Protocol publish a signed, off-chain capability manifest that describes what they can do, in what I/O shape, with what cost, and under what preflight gates. The Registry program stores only a content hash + signature; the manifest itself lives on IPFS or Arweave. This package validates a manifest body against the on-chain commitment.
What it checks
- Schema — the JSON conforms to the ADR-060 §2 v1.0
CapabilityManifestinterface (base58 pubkeys, kebab-case capability names, valid side-effects, recognized preflight gates, stability enum, required fields). - Canonical JSON hash — the bytes fed in, serialized with RFC-8785 canonicalization and SHA-256'd, match the on-chain
manifest_hash. Eliminates whitespace / key-order drift. - Ed25519 signature — the on-chain
manifest_signatureis a valid Ed25519 signature overmanifest_hashby the agent's authority pubkey. - Authority binding — the manifest's self-declared
agent.pubkeymatches the on-chain authority passed in (defense-in-depth against manifest-author confusion).
Install
npm install @agenomics/capability-manifest-validatorPeer dependencies: @noble/curves@^1.4.0, @noble/hashes@^1.4.0, canonicalize@^2.0.0, zod@^3.23.
Usage
import { validateManifest } from "@agenomics/capability-manifest-validator";
// Bytes fetched from IPFS/Arweave via the manifest_cid stored on-chain.
const manifestBytes: Uint8Array = await fetchManifestBody(cid);
// On-chain commitments from AgentProfile.
const onChainHash: Uint8Array = profile.manifest_hash;
const onChainSignature: Uint8Array = profile.manifest_signature;
const authorityPubkey: Uint8Array = profile.authority;
const result = validateManifest(
manifestBytes,
onChainHash,
onChainSignature,
authorityPubkey,
);
if (!result.ok) {
// Typed error: { code: 'HASH_MISMATCH' | 'SIGNATURE_INVALID' | 'SCHEMA_INVALID' | ... , message, details? }
throw new Error(`manifest invalid: ${result.error.message}`);
}
const manifest = result.value;
console.log(manifest.agent.name, manifest.capabilities.length);Non-goals
This package does not fetch the manifest from IPFS/Arweave, the Registry account from Solana, or SAS attestations. Those concerns live upstream (in a downstream integration) or in @agenomics/sas-resolver. This package is pure, synchronous-ish (Ed25519 is fast), and has no network dependency.
Related
- ADR-060 — manifest format + on-chain commitments
- ADR-061 — the
owner_attestationfield reserved for SAS @agenomics/sas-resolver— resolves SAS attestations referenced by a validated manifest
License
Part of the Agenomics Protocol. See repository root.
