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
92
93
94
95
96
97
//! # 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.
///
/// `0.2.0` carries the Trust & Hardening amendments (registry receipts
/// — RFC-ACDP-0010, `did:key` producers, mandatory explicit
/// `acdp_version`, lineage anchoring); those RFC sections are Draft
/// until the 0.2.0 conformance pack passes two independent
/// implementations. Every v0.1.0 body, signature, and `content_hash`
/// remains valid. Note that an absent `acdp_version` field on a publish
/// request is interpreted as `0.1.0` by the protocol — see
/// [`producer::RequestBuilder::acdp_version`]; 0.2.0 builders MUST
/// emit the field explicitly (RFC-ACDP-0001 §6), which this library's
/// builder does by default.
pub const ACDP_VERSION: &str = "0.2.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 ;