acdp 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. acdp-0.3.0/CHANGELOG.md +164 -0
  2. acdp-0.3.0/Cargo.lock +2848 -0
  3. acdp-0.3.0/Cargo.toml +112 -0
  4. acdp-0.3.0/LICENSE +201 -0
  5. acdp-0.3.0/Makefile +64 -0
  6. acdp-0.3.0/PKG-INFO +10 -0
  7. acdp-0.3.0/README.md +233 -0
  8. acdp-0.3.0/bindings/acdp-py/Cargo.lock +1490 -0
  9. acdp-0.3.0/bindings/acdp-py/Cargo.toml +55 -0
  10. acdp-0.3.0/bindings/acdp-py/README.md +83 -0
  11. acdp-0.3.0/bindings/acdp-py/src/did.rs +194 -0
  12. acdp-0.3.0/bindings/acdp-py/src/helpers.rs +57 -0
  13. acdp-0.3.0/bindings/acdp-py/src/jcs.rs +57 -0
  14. acdp-0.3.0/bindings/acdp-py/src/lib.rs +51 -0
  15. acdp-0.3.0/bindings/acdp-py/src/producer.rs +621 -0
  16. acdp-0.3.0/bindings/acdp-py/src/safe_http.rs +108 -0
  17. acdp-0.3.0/bindings/acdp-py/src/verifier.rs +110 -0
  18. acdp-0.3.0/bindings/acdp-py/tests/test_canonicalizer.py +102 -0
  19. acdp-0.3.0/bindings/acdp-py/tests/test_did.py +138 -0
  20. acdp-0.3.0/bindings/acdp-py/tests/test_producer.py +540 -0
  21. acdp-0.3.0/bindings/acdp-py/tests/test_safe_http.py +124 -0
  22. acdp-0.3.0/bindings/interop/README.md +67 -0
  23. acdp-0.3.0/bindings/interop/expected_surface.json +54 -0
  24. acdp-0.3.0/bindings/interop/node_worker.mjs +227 -0
  25. acdp-0.3.0/bindings/interop/test_interop.py +656 -0
  26. acdp-0.3.0/bindings/interop/test_parity.py +157 -0
  27. acdp-0.3.0/pyproject.toml +21 -0
  28. acdp-0.3.0/src/bin/acdp.rs +753 -0
  29. acdp-0.3.0/src/client/cross_registry.rs +437 -0
  30. acdp-0.3.0/src/client/data_ref.rs +466 -0
  31. acdp-0.3.0/src/client/mod.rs +11 -0
  32. acdp-0.3.0/src/client/registry.rs +660 -0
  33. acdp-0.3.0/src/client/verified.rs +419 -0
  34. acdp-0.3.0/src/crypto/hash.rs +127 -0
  35. acdp-0.3.0/src/crypto/jcs.rs +407 -0
  36. acdp-0.3.0/src/crypto/mod.rs +12 -0
  37. acdp-0.3.0/src/crypto/sign.rs +601 -0
  38. acdp-0.3.0/src/crypto/verify.rs +318 -0
  39. acdp-0.3.0/src/did/document.rs +459 -0
  40. acdp-0.3.0/src/did/mod.rs +8 -0
  41. acdp-0.3.0/src/did/web.rs +498 -0
  42. acdp-0.3.0/src/error.rs +453 -0
  43. acdp-0.3.0/src/lib.rs +91 -0
  44. acdp-0.3.0/src/limits.rs +23 -0
  45. acdp-0.3.0/src/pagination.rs +195 -0
  46. acdp-0.3.0/src/producer/builder.rs +751 -0
  47. acdp-0.3.0/src/producer/mod.rs +3 -0
  48. acdp-0.3.0/src/profile.rs +122 -0
  49. acdp-0.3.0/src/registry/mod.rs +11 -0
  50. acdp-0.3.0/src/registry/rate_limit.rs +84 -0
  51. acdp-0.3.0/src/registry/safe_http.rs +9 -0
  52. acdp-0.3.0/src/registry/server.rs +1314 -0
  53. acdp-0.3.0/src/registry/store.rs +1378 -0
  54. acdp-0.3.0/src/registry/validator.rs +426 -0
  55. acdp-0.3.0/src/safe_http.rs +968 -0
  56. acdp-0.3.0/src/time.rs +44 -0
  57. acdp-0.3.0/src/types/body.rs +211 -0
  58. acdp-0.3.0/src/types/capabilities.rs +116 -0
  59. acdp-0.3.0/src/types/data_ref.rs +348 -0
  60. acdp-0.3.0/src/types/mod.rs +14 -0
  61. acdp-0.3.0/src/types/primitives.rs +581 -0
  62. acdp-0.3.0/src/types/publish.rs +264 -0
  63. acdp-0.3.0/src/types/search.rs +447 -0
  64. acdp-0.3.0/src/types/serde_helpers.rs +74 -0
  65. acdp-0.3.0/src/validation.rs +1466 -0
@@ -0,0 +1,164 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-05-19
9
+
10
+ First public release. Full conformance with the **ACDP v0.1.0 Final**
11
+ specification (promoted to Final on 2026-05-19): the complete spec
12
+ conformance fixture suite, the `sig-001` / `can-001` / `lin-001` golden
13
+ vectors, and the `acdp-consumer` profile.
14
+
15
+ ### Added — repository hygiene
16
+ - Project metadata: repository, homepage, documentation, README, exclude rules,
17
+ `[package.metadata.docs.rs]` for all-features doc builds.
18
+ - GitHub Actions CI: rustfmt, clippy (default + no-default-features),
19
+ cross-platform tests (Linux/macOS/Windows + beta), MSRV check (1.86),
20
+ doc build with `-D warnings`, cargo-deny, cargo-audit, llvm-cov coverage.
21
+ - `release-plz` workflow for automated crates.io publishing.
22
+ - Dependabot configuration for cargo and github-actions.
23
+ - `rustfmt.toml`, `deny.toml`, and `.gitignore`.
24
+ - HTTP-mocked tests for `RegistryClient` and `WebResolver` (wiremock).
25
+ - Property-based tests for JCS canonicalization (proptest).
26
+ - `CONTRIBUTING.md`, `SECURITY.md`.
27
+
28
+ ### Changed — wire-shape conformance (Phase 0)
29
+ - **BREAKING:** `PublishResponse` no longer carries `content_hash`; gains
30
+ `version: u32` and `status: Status` per
31
+ `acdp-publish-response.schema.json` (fixture pub-007).
32
+ - **BREAKING:** `SearchResponse.results` renamed to `matches` per
33
+ `acdp-search-response.schema.json` (fixture vis-003); back-compat
34
+ accessor `results()` provided.
35
+ - **BREAKING:** `SearchResult` (the `match_summary` projection) gains
36
+ `summary: Option<String>`, types `context_type` as `ContextType`, drops
37
+ `tags` and `description`.
38
+ - **BREAKING:** `DataRef` rewritten — `ref_type: DataRefType` is required
39
+ (closed enum); `description`, `size_bytes`, `schema_version` added;
40
+ `location: Option<Location>` (URI or structured locator); typed
41
+ constructors (`uri`, `uri_verified`, `structured`,
42
+ `embedded_{json,utf8,base64}`).
43
+ - **BREAKING:** `DataPeriod.start` and `.end` are now required (was
44
+ `Option`).
45
+ - **BREAKING:** `Status` is now an open enum with `Other(String)` for
46
+ forward-compat (e.g. `retracted` per RFC-ACDP-0009 §2.1); helper methods
47
+ `is_active`, `is_superseded`, `is_expired`, `as_other`.
48
+ - `summary: Option<String>` added to `Body`, `PublishRequest`, and
49
+ `RequestBuilder`; included in the ProducerContent hash preimage.
50
+ - `RequestBuilder::version` setter required for v2+ supersession;
51
+ `Producer::supersede_body(&Body)` propagates `version + 1` and
52
+ `expected_lineage_id`. v1+supersedes and v2+ without version both
53
+ rejected.
54
+ - `assign_identifiers` now takes `first_version_ctx_id`; derives
55
+ `lineage_id` from the v1 ctx_id on supersession (was incorrectly
56
+ derived from the new ctx_id).
57
+ - `RegistryClient` applies RFC-ACDP-0006 §7.4 timeouts (5s connect,
58
+ 30s total).
59
+ - Producer-side `expires_at` and `data_period` setters truncate to
60
+ millisecond precision per RFC-ACDP-0001 §5.3.
61
+
62
+ ### Added — validation (Phase 1)
63
+ - New `validation` module providing `validate_publish_request`,
64
+ `validate_body`, `validate_data_ref`, `validate_metadata`,
65
+ `validate_identifiers`, `compute_embedded_hash`, `verify_embedded_hash`.
66
+ - `RequestBuilder::build()` runs full schema validation before emission.
67
+ - Runtime checks: public-no-audience, array uniqueness/size, string
68
+ length, `data_period.start ≤ end`, `DataRef` oneOf + URI credential
69
+ rejection + structured-scheme pattern + embedded ≤ 64 KB +
70
+ `utf8`/`base64` content must be string, metadata depth ≤ 8 / JCS size
71
+ ≤ 64 KB / ≤ 100 properties, `did:web` enforcement, signature length
72
+ for `ed25519` / `ecdsa-p256`, embedded `content_hash` semantics
73
+ (`json` → JCS, `utf8` → raw bytes, `base64` → decoded bytes).
74
+
75
+ ### Added — error taxonomy and typed IDs (Phase 2)
76
+ - 13 new `AcdpError` variants matching RFC-ACDP-0007 §5 wire codes:
77
+ `NotFound`, `NotAuthorized`, `RateLimited`, `PayloadTooLarge`,
78
+ `EmbeddedTooLarge`, `SupersededTarget { reason, message }`,
79
+ `UnsupportedAlgorithm`, `NotImplemented`, `CursorExpired`,
80
+ `InvalidCursor`, `DuplicatePublish`, `CrossRegistryResolutionFailed`,
81
+ `RegistryInternal`. New `SupersessionReason` enum.
82
+ - `RegistryClient::parse_success` now maps `WireError.code` to typed
83
+ variants via `AcdpError::from_wire_error`.
84
+ - `CtxId::parse`, `LineageId::parse`, `ContentHash::parse`,
85
+ `AgentDid::parse`, `AgentDid::parse_web` perform full pattern
86
+ validation per `acdp-common.schema.json`. `CtxId::uuid()` extracts the
87
+ v4 UUID component.
88
+
89
+ ### Added — builder and API (Phase 3)
90
+ - `RequestBuilder::expected_lineage_id` for v2+ self-verification (v1
91
+ publications reject this field per RFC-ACDP-0003 §2.2).
92
+ - `PublishRequest.lineage_id: Option<LineageId>`.
93
+ - `SearchParams` gains `data_period_start_after`,
94
+ `data_period_end_before`, `expires_after`, `expires_before` filters
95
+ (RFC-ACDP-0005 §2.1). New `SearchParamsBuilder` accepting
96
+ `DateTime<Utc>`.
97
+ - `PublishValidator::for_authority` rejects cross-registry supersession
98
+ with `SupersededTarget { CrossRegistrySupersessionUnsupported }`.
99
+ - `CapabilitiesDocument.extensions: Map<String, Value>` (`#[serde(flatten)]`)
100
+ preserves unknown forward-compat capability flags.
101
+ - `ContextType` deserializer rejects strings that are neither standard
102
+ values nor namespaced custom types matching
103
+ `^[a-z][a-z0-9_]*:[a-z][a-z0-9_-]*$`.
104
+
105
+ ### Added — protocol completeness (Phase 4)
106
+ - `CrossRegistryResolver` (RFC-ACDP-0006 §4.1): seven-step algorithm
107
+ with `walk_derived_from`, cycle detection, configurable `max_depth`
108
+ (default 10), and optional authority allowlist.
109
+ - `registry::safe_http::SsrfPolicy` (RFC-ACDP-0006 §7): URL filtering
110
+ for HTTPS-only, IP-literal rejection, RFC 1918 / loopback /
111
+ link-local / multicast / IMDS (`169.254.169.254`) and IPv6
112
+ equivalents (`::1`, `fc00::/7`, `fe80::/10`, IPv4-mapped); same-
113
+ authority redirect check; constants `MAX_CONTEXT_BYTES` (1 MB),
114
+ `MAX_METADATA_BYTES` (64 KB), `MAX_REDIRECTS` (3).
115
+ - `tests/conformance.rs` validates all 16 spec conformance fixtures
116
+ parse, plus deserialization checks for every example under
117
+ `examples/**/*.json`. The harness locates the spec via
118
+ `ACDP_SPEC_DIR` (with a sibling-path fallback) and skips gracefully
119
+ when neither is available.
120
+
121
+ ### Added — quality of life (Phase 5)
122
+ - `FullContext.registry_receipt: Option<Value>` reserved for
123
+ RFC-ACDP-0009 §2.7.
124
+ - `WebResolver` cache backed by `lru::LruCache` (default capacity 1000),
125
+ with `WebResolver::with_capacity(n)`.
126
+ - `PublishValidator::validate_post_schema` alias with RFC-aligned
127
+ documentation.
128
+ - Optional `tracing` feature: `RegistryClient::{capabilities, publish,
129
+ retrieve}` and `WebResolver::resolve` carry `#[tracing::instrument]`
130
+ spans when enabled.
131
+
132
+ ### Deferred
133
+ - IMP-09 — standalone `acdp-cli` crate (sign / verify / publish /
134
+ retrieve / search). Out of scope for this revision.
135
+ - IMP-05 — auto-populating `acdp_version = "0.0.1"` in the builder
136
+ would change the content_hash and break the `sig-001` golden vector;
137
+ v0.0.1 producers MAY include it explicitly via
138
+ `RequestBuilder::acdp_version`.
139
+
140
+ ### Fixed
141
+ - `crypto::jcs` now compiles cleanly (missing `io::Write` import,
142
+ `serde_json::Value::String` shadowing, map indexing).
143
+ - `producer::RequestBuilder::build` no longer emits JSON `null` for unset
144
+ optional fields; the canonical form now matches the wire format produced by
145
+ serde with `skip_serializing_if = "Option::is_none"`, so the `content_hash`
146
+ for a minimal request matches the spec golden vector
147
+ (`sig-001-ed25519-golden`).
148
+ - Or-pattern bug in `Visibility::Restricted` audience check.
149
+
150
+ ### Security
151
+ - Cross-registry resolution builds its per-authority `RegistryClient`
152
+ with `new_pinned`: the foreign authority's DNS is resolved up-front,
153
+ every resolved IP is filtered through the `SsrfPolicy`, and the
154
+ connection is pinned to that address — closing a DNS-rebinding /
155
+ internal-host SSRF gap (SEC-01).
156
+ - `HttpsDataRefFetcher` builds its HTTP client with a `SafeDnsResolver`
157
+ DNS hook and a same-authority redirect cap, so a producer-controlled
158
+ `DataRef` location resolving into a private range is refused at DNS
159
+ time and cross-authority redirects are rejected (SEC-02).
160
+ - `validate_origin_registry` rejects uppercase, underscores, and
161
+ malformed labels by delegating to the shared DNS-authority validator
162
+ (BUG-02).
163
+
164
+ [0.1.0]: https://github.com/agentcontextdistributionprotocol/acdp-rs/releases/tag/v0.1.0