Skip to main content

Crate acdp

Crate acdp 

Source
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-crypto crate plus the high-level verification helpers (which live in crate::verify, one layer up) under their historical crate::crypto::* paths.
error
Error types for the ACDP library.
limits
Network-policy constants shared by client and server code.
paginationserver
Cursor-pagination helpers for registry store backends.
profile
ACDP conformance profiles (RFC-ACDP-0001 §9.1).
registryserver
time
Time helpers shared by the producer builder and search-params formatter.

Structs§

AgentDid
A Decentralized Identifier — v0.1.0 mandates did:web.
Body
The immutable stored body of an ACDP context (RFC-ACDP-0002).
CapabilitiesDocument
Registry capabilities document served at GET /.well-known/acdp.json.
ContentHash
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.
FullContext
The full context object returned by GET /contexts/{ctx_id}.
KeyRevocation
Typed, shape-validated view of a key-revocation context body (RFC-ACDP-0014 §4).
LifecycleEvent
A lifecycle event (RFC-ACDP-0013 §4) — one entry of registry_state.lifecycle_events.
LineageId
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 log log_id has tree_size leaves and Merkle root root_hash (RFC-ACDP-0012 §6).
LogConsistencyProof
A consistency-mode GET /log/proof response (RFC-ACDP-0012 §8.2): the RFC 6962 §2.1.2 proof PROOF(first, D[second]) that the tree at first_tree_size is a prefix of the tree at second_tree_size — the history-rewrite detector. The verifier supplies its own retained root for first_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_index at tree_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).
PublishRequest
Wire-ready publish request body (POST /contexts).
PublishResponse
Successful publish response (HTTP 201).
RegistryState
Mutable, registry-derived state returned alongside the Body on retrieval.
SearchParams
Query parameters for GET /contexts/search.
SearchResponse
Response from GET /contexts/search.
WireError
Wire error envelope returned by the registry on all error responses.
WitnessSigner
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).
WitnessedCheckpoint
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§

AcdpError
Top-level error type.
ContextType
Registered context types plus open-ended custom namespace.
DataRefType
Role of a data reference. Closed enum per acdp-data-ref.schema.json type.
LifecycleEventType
The lifecycle event kind — an open vocabulary (registries/lifecycle-event-types.md): v1 registers retracted and republished; 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 how Status handles 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. See acdp-data-ref.schema.json location.oneOf.
RevocationTrustClass
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.
SupersessionReason
Sub-reason for AcdpError::SupersededTarget. Mirrors the details.reason values defined by acdp-error.schema.json.
Visibility
Visibility level of a context.

Constants§

ACDP_SCHEMA_NAMESPACE
The JSON Schema namespace ($id prefix) for this protocol version, e.g. <ACDP_SCHEMA_NAMESPACE>/acdp-error.schema.json.
ACDP_VERSION
The ACDP protocol version this library implements.