agent-cid (Rust)
Idiomatic Rust port of @p-vbordei/agent-cid. Content-addressed artifact manifest for AI agents — CIDv1 + Ed25519 + DID + RFC 8785 JCS. Byte-deterministic-compatible with the TS reference; passes the same C1–C5 conformance suite.
What's in the box
build(bytes, opts)— compute CIDv1, fill the manifest, sign with one or more Ed25519 keys.verify(manifest, bytes, opts)— schema + size + CID + signature + retention.verify_chain(&[(manifest, bytes)], opts)— traverseparent_cidchain.pubkey_to_did_key()/did_key_to_pubkey()— round-trip Ed25519 todid:key.fetch_did_web_pubkey(did)— HTTPS resolution with 64 KiB size cap and 5 s timeout.
Install
[]
= "0.1"
= { = "1", = ["macros", "rt-multi-thread"] }
Quickstart
use Arc;
use ;
use ;
async
Run it:
# built v1: bafkreih...
# verify v1: true
# verify tampered: false
# built v2 (parent_cid set): true
How it relates
| Repo | Role |
|---|---|
agent-cid (TS) |
Reference implementation + normative SPEC + conformance vectors. |
agent-cid-py |
Idiomatic Python port; same vectors. |
agent-cid-rs (this) |
Idiomatic Rust port; same vectors. |
Conformance
Vectors in vectors/ are copied verbatim from the TS conformance suite. Every C1–C5 vector must pass byte-identical to the TS reference.
| Clause | Vector | Check |
|---|---|---|
| C1 | c1-roundtrip |
Build then verify a 1 KiB body. |
| C2 | c2-tampered-body |
Flip a byte; verify fails with cid mismatch. |
| C3 | c3-parent-chain |
3-version chain; tampered middle signer is flagged. |
| C4 | c4-canonical |
JCS bytes match the reference. |
| C5 | c5-did-web |
did:web resolver returns embedded DID doc pubkey. |
Architecture
See docs/architecture.md.
Development
License
Apache-2.0 — see LICENSE.