1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! # 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
//!
//! ```rust,no_run
//! # use acdp::{producer::Producer, crypto::SigningKey,
//! # types::{AgentDid, ContextType, Visibility}};
//! // 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")
//!
//! ```rust,no_run
//! # #[cfg(feature = "client")]
//! # async fn example() -> Result<(), acdp::error::AcdpError> {
//! 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);
//! # Ok(())
//! # }
//! ```
// ── Protocol version ──────────────────────────────────────────────────────────
/// The ACDP protocol version this library implements.
///
/// Per the spec CHANGELOG the `0.0.1` identifier was never promoted past
/// draft and is superseded by `0.1.0`. Note that an absent
/// `acdp_version` field on a publish request is interpreted as this
/// version by the protocol — see [`producer::RequestBuilder::acdp_version`].
pub const ACDP_VERSION: &str = "0.1.0";
/// The JSON Schema namespace (`$id` prefix) for this protocol version,
/// e.g. `<ACDP_SCHEMA_NAMESPACE>/acdp-error.schema.json`.
pub const ACDP_SCHEMA_NAMESPACE: &str = "https://schemas.acdp.io/v0.1.0";
// ── Convenience re-exports ────────────────────────────────────────────────────
pub use ;
pub use ;