Expand description
§acdp — Rust library for the Agent Context Distribution Protocol
Reference implementation of ACDP v0.1.0 Final (specification promoted to Final on 2026-05-19).
ACDP lets agents publish immutable, producer-signed context descriptors, retrieve and verify them locally, discover them by keyword, and follow signed references across registries.
§Quick start — producer
// In production, load from secure storage; `generate` uses OsRng.
let key = SigningKey::generate();
let prod = Producer::new(
key,
AgentDid::new("did:web:agents.example.com:my-agent"),
"did:web:agents.example.com:my-agent#key-1",
);
let req = prod.publish_request()
.title("Q1 snapshot")
.context_type(ContextType::DataSnapshot)
.visibility(Visibility::Public)
.build()
.unwrap();
println!("content_hash: {}", req.content_hash);§Quick start — consumer (feature = “client”)
use acdp::{client::{RegistryClient, VerifiedContext}, did::WebResolver, types::CtxId};
let client = RegistryClient::new("https://registry.example.com")?;
let resolver = WebResolver::new();
let ctx_id = CtxId("acdp://registry.example.com/…".into());
let ctx = VerifiedContext::fetch(&client, &resolver, &ctx_id).await?;
println!("title: {}", ctx.body().title);Re-exports§
pub use acdp_types as types;pub use acdp_producer as producer;pub use acdp_validation as validation;pub use acdp_verify as verify;pub use acdp_did as did;pub use acdp_safe_http as safe_http;pub use acdp_client as client;client
Modules§
- crypto
- Cryptographic primitives — re-exports the
acdp-cryptocrate plus the high-level verification helpers (which live incrate::verify, one layer up) under their historicalcrate::crypto::*paths. - error
- Error types for the ACDP library.
- limits
- Network-policy constants shared by client and server code.
- pagination
server - Cursor-pagination helpers for registry store backends.
- profile
- ACDP conformance profiles (RFC-ACDP-0001 §9.1).
- registry
server - time
- Time helpers shared by the producer builder and search-params formatter.
Structs§
- Agent
Did - A Decentralized Identifier — v0.1.0 mandates
did:web. - Body
- The immutable stored body of an ACDP context (RFC-ACDP-0002).
- Capabilities
Document - Registry capabilities document served at
GET /.well-known/acdp.json. - Content
Hash sha256:<64-lowercase-hex>— content-addressable hash with algorithm prefix.- CtxId
acdp://<authority>/<uuid-v4>— registry-assigned context identifier.- DataRef
- A reference to a piece of data the context describes.
- Full
Context - The full context object returned by
GET /contexts/{ctx_id}. - KeyRevocation
- Typed, shape-validated view of a
key-revocationcontext body (RFC-ACDP-0014 §4). - Lifecycle
Event - A lifecycle event (RFC-ACDP-0013 §4) — one entry of
registry_state.lifecycle_events. - Lineage
Id lin:sha256:<64-lowercase-hex>— registry-assigned lineage identifier.- LogCheckpoint
- A registry-signed checkpoint (signed tree head): the registry’s
commitment that, as of
timestamp, the loglog_idhastree_sizeleaves and Merkle rootroot_hash(RFC-ACDP-0012 §6). - LogConsistency
Proof - A consistency-mode
GET /log/proofresponse (RFC-ACDP-0012 §8.2): the RFC 6962 §2.1.2 proofPROOF(first, D[second])that the tree atfirst_tree_sizeis a prefix of the tree atsecond_tree_size— the history-rewrite detector. The verifier supplies its own retained root forfirst_tree_size(that retained root is the whole point, §9.2). - LogCosignature
- A witness-signed cosignature of a transparency-log checkpoint (RFC-ACDP-0015 §4).
- LogInclusion
- An inclusion proof that one leaf is committed by a checkpointed
transparency-log tree (RFC-ACDP-0012 §8.2, §9.1): the RFC 6962
§2.1.1 audit path for
leaf_indexattree_size, together with the signed checkpoint it verifies against. - LogLeaf
- One transparency-log leaf: the closed object binding one accepted publish event (RFC-ACDP-0012 §4).
- Publish
Request - Wire-ready publish request body (
POST /contexts). - Publish
Response - Successful publish response (HTTP 201).
- Registry
State - Mutable, registry-derived state returned alongside the Body on retrieval.
- Search
Params - Query parameters for
GET /contexts/search. - Search
Response - Response from
GET /contexts/search. - Wire
Error - Wire error envelope returned by the registry on all error responses.
- Witness
Signer - Witness-side cosignature minting identity: the witness’s signing key plus the DID URL it is published under in the witness’s own DID document (RFC-ACDP-0015 §5, §9).
- Witnessed
Checkpoint - The identity-bearing subset of the RFC-ACDP-0012 §6 checkpoint the
witness observed:
{log_id, tree_size, root_hash, timestamp}, copied verbatim from the verified checkpoint (RFC-ACDP-0015 §4).
Enums§
- Acdp
Error - Top-level error type.
- Context
Type - Registered context types plus open-ended custom namespace.
- Data
RefType - Role of a data reference. Closed enum per
acdp-data-ref.schema.jsontype. - Lifecycle
Event Type - The lifecycle event kind — an open vocabulary
(
registries/lifecycle-event-types.md): v1 registersretractedandrepublished; unknown values matching the RFC-ACDP-0004 §4.1 pattern (^[a-z][a-z0-9_]*$, 1–64 chars) are tolerated with no effect on retraction state and round-trip verbatim — mirroring howStatushandles unknown values. Registries MUST NOT accept unregistered values through the RFC-ACDP-0013 §6 endpoints in 0.3.0 (§7.3): openness is for future versions and consumers, not a free-form producer channel. - Location
- Locator for
DataRef.location— either a URI string or a structured locator object. Seeacdp-data-ref.schema.jsonlocation.oneOf. - Revocation
Trust Class - The two trust classes of RFC-ACDP-0014 §5–§6. They carry different authority and MUST be reported distinguishably — never collapsed (§6).
- Status
- Registry-derived lifecycle status.
- Supersession
Reason - Sub-reason for
AcdpError::SupersededTarget. Mirrors thedetails.reasonvalues defined byacdp-error.schema.json. - Visibility
- Visibility level of a context.
Constants§
- ACDP_
SCHEMA_ NAMESPACE - The JSON Schema namespace (
$idprefix) for this protocol version, e.g.<ACDP_SCHEMA_NAMESPACE>/acdp-error.schema.json. - ACDP_
VERSION - The ACDP protocol version this library implements.