acdp-registry-rs
Reference ACDP registry server implemented in Rust
Reference registry implementation for the
Agent Context Distribution Protocol
v0.1.0 through v0.5.0. Implements the acdp-registry-core and
acdp-registry-discovery profiles on top of
acdp —
plus, as the corresponding config sections are enabled: the ACDP 0.2.0
trust-hardening surface (the acdp-registry-receipts profile — signed,
atomically-persisted publish receipts, RFC-ACDP-0010 — self-certifying
did:key producers, and a self-hosted /.well-known/did.json,
see docs/RECEIPTS.md), the 0.3.0 lifecycle,
transparency-log, and head-receipt profiles, and 0.4.0 witness cosignature
aggregation (RFC-ACDP-0015), and the 0.5.0 retraction recall profiles
(RFC-ACDP-0018: the acdp-registry-changes feed at GET /changes, and
acdp-registry-events signed change hints via /subscriptions). Version-gated anchors acceptance
(RFC-ACDP-0016, Draft) is unconditional — every deployment advertises
acdp_version >= 0.5.0 and accepts well-formed anchors on every publish,
see docs/HTTP-API.md.
Profiles and the config that advertises them
| Profile | Spec reference | Advertised when |
|---|---|---|
acdp-registry-core | RFC-ACDP-0003 | in the default registry.profiles |
acdp-registry-discovery | GET /contexts/search | in the default registry.profiles |
acdp-registry-federated | cross-registry resolution | listed in registry.profiles |
acdp-registry-receipts | RFC-ACDP-0010 | a [receipt] key is configured |
acdp-registry-head-receipts | RFC-ACDP-0011 | receipt.head_receipts = true |
acdp-registry-transparency-log | RFC-ACDP-0012 | [log] enabled = true |
acdp-registry-lifecycle | RFC-ACDP-0013 | [lifecycle] enabled = true |
acdp-registry-changes | RFC-ACDP-0018 §5 (Draft) | [changes] enabled = true |
acdp-registry-events | RFC-ACDP-0018 §8 (Draft) | [events] enabled = true |
acdp-registry-keyless | RFC-ACDP-0021 §13 (Draft) | [keyless] enabled = true; off by default, and needs a [receipt] key, lifecycle and the log |
The full rules, including which profiles must be listed and which are added automatically, are in docs/CONFIGURATION.md.
What you get
- RFC-ACDP-0003-conformant publish pipeline — full DID-resolution + signature verification + lineage coherence + atomic commit.
- Pluggable storage — Postgres (production), SQLite (dev / CI), and an
in-memory backend, behind a unified
ExtendedRegistryStoretrait. The memory backend is for demos only (ephemeral: everything is lost on restart), and itsq=search is a case-insensitive substring match of the whole query, not the stemmed all-words match of SQLite/Postgres. - DID-bound authentication — challenge / response over Ed25519, short-lived JWTs (HS256 or EdDSA with a published JWKS), token revocation, anonymous public reads opt-in.
- Multi-tenancy — tenant-scoped publish / retrieve / search via a signed JWT
tenantclaim, with an optional strict mode.X-Tenant-Idis honoured only across a declared trust boundary (auth.tenant_header_trust, defaultnone; see docs/MULTI-TENANCY.md). - Cross-registry resolution — foreign
ctx_ids are resolved against their home registry (public-only, SSRF-guarded). - Signed receipts & lifecycle — RFC-ACDP-0010 publish receipts and head receipts, plus RFC-ACDP-0013 retract/republish lifecycle events.
- Transparency log — RFC-ACDP-0012 append-only Merkle log with signed checkpoints, inclusion/consistency proofs, and RFC-ACDP-0015 witness cosignature aggregation.
- Retraction recall — RFC-ACDP-0018 change feed (retractions, supersessions, key revocations, each with its receipt evidence) behind durable encrypted cursors, plus signed, content-free change hints to subscriber callbacks.
- Keyless signing (off by default) — RFC-ACDP-0021 (Draft): a CI job or workload trades its OIDC ID token or SPIFFE JWT-SVID for a short-lived, registry-signed attestation of an ephemeral key, then publishes under its controller's DID with no long-lived key. See the matrix below and docs/OPERATIONS.md.
- HMAC-signed webhooks —
context.published,context.retrieved,context.retracted,context.republished,search.executed. - Abuse controls & observability — per-IP and global
/auth/*rate limiting (per process by default, optionally counted across replicas in Postgres with[rate_limit] backend = "postgres"), per-agent publish and challenge budgets, and an optional Prometheus/metricsendpoint. - Playground mode — a runtime config flag (
[playground] enabled = true, compiled into every build) that skips DID verification for hands-on demos; never enable in production. Only its admin routes are compile-gated behind theplaygroundCargo feature.
Repository layout
acdp-registry-rs/
├── Cargo.toml # workspace
├── crates/
│ ├── acdp-registry-types/ # config, wire types, errors
│ ├── acdp-registry-store/ # ExtendedRegistryStore trait
│ ├── acdp-registry-pg/ # Postgres backend
│ ├── acdp-registry-sqlite/ # SQLite backend (dev / test)
│ ├── acdp-registry-auth/ # DID challenge-response + JWT
│ ├── acdp-registry-webhook/ # HMAC-signed event emitter
│ ├── acdp-registry-core/ # axum router + handlers
│ └── acdp-registry-server/ # binary: `acdp-registry`
├── docker/ # Dockerfile + docker-compose
├── deploy/ # production Compose + Kubernetes examples
├── tools/live-smoke/ # end-to-end check of a deployed registry
├── config/ # example TOML configs
└── docs/ # reference docs (API, auth, config, ops)See docs/ for architecture, the HTTP API, authentication,
configuration, multi-tenancy, webhooks, and operations.
What this repository treats as done, and what it deliberately defers, is in
STATUS.md and DEFERRED.md.
Quick start
Local dev (SQLite)
# `acdp` is pulled from crates.io — no sibling checkout needed.
# Run with default config (SQLite under ./data/registry.db).
cargo run -p acdp-registry-server
# Or with a config file. NOTE: the example is a production-shaped template —
# it sets auth.enabled = true with an empty jwt_secret and
# allow_ephemeral_secret = false, so it will REFUSE to boot without a secret.
# Supply one (the config's own guidance, in its header and above `jwt_secret`):
ACDP_REGISTRY_CONFIG=config/registry.example.toml \
ACDP_REGISTRY_AUTH__JWT_SECRET="$(openssl rand -base64 32)" \
cargo run -p acdp-registry-server
# For a throwaway local run you may instead set
# ACDP_REGISTRY_AUTH__ALLOW_EPHEMERAL_SECRET=true, which mints a random
# process-lifetime key. Tokens do not survive a restart; never use it in
# production.Then:
curl http://localhost:8443/.well-known/acdp.json
curl http://localhost:8443/healthz
# {"status":"ok","storage":true,"version":"<version>"}
curl http://localhost:8443/livez
# {"status":"ok","version":"<version>"}version identifies the running build. A locally built binary reports the bare
package version; an image built by CI reports <version>+g<shortsha>,
which is what actually pins it to a commit. Treat the string as opaque — see
HTTP-API.md.
Postgres + Docker (local)
cd docker
docker compose up --buildThis is a local stack built from source with auth off. It accepts did:key
producers as well as did:web, because a did:web document on this machine
is not fetchable by the registry. For a real deployment
(pinned image or release binary, receipts and lifecycle on, signing-key
handling, TLS, backups, upgrades) follow docs/DEPLOY.md. It
ships a production Compose file and a Kubernetes manifest under
deploy/, and a public reference instance runs at
https://registry.agentcontextdistributionprotocol.io.
Configuration
Configuration starts from built-in defaults, is layered with the TOML file
named by ACDP_REGISTRY_CONFIG (if set — there is no fallback file; with the
variable unset only the built-in defaults apply), and is overridden by
ACDP_REGISTRY_<SECTION>__<FIELD> environment variables (double underscore
separates levels). See config/registry.example.toml
for an annotated, production-shaped template.
An EMPTY ACDP_REGISTRY_* variable is treated as absent, not as an override
(#271). ACDP_REGISTRY_REGISTRY__AUTHORITY="" leaves your TOML value alone
rather than blanking it; unset the variable or give it a value. Any empty
variable that was ignored is named in a startup warn!.
This exists because docker compose renders an unset variable as set-to-empty
rather than absent, so every ${VAR:-} passthrough in a compose environment:
block used to silently overwrite the config file. Note that ${VAR:-false} is
not the same thing — it renders the literal string "false", which is a real
value and still overrides.
Upgrading: see
docs/UPGRADING.md, which is the operator's pre-upgrade read for every version. For this change specifically: before it, an empty value either overrode with""or, for a number, boolean, or list field, failed the config load outright. If you deploydocker/docker-compose.yml, upgrade the image at the same time — the current recipe passes empty values that an older binary would reject at boot.
Selected fields:
| TOML key | Env var | Notes |
|---|---|---|
registry.authority | ACDP_REGISTRY_REGISTRY__AUTHORITY | Bare lowercase DNS name; also the did:web identifier. |
registry.port | ACDP_REGISTRY_REGISTRY__PORT | Default 8443. |
storage.backend | ACDP_REGISTRY_STORAGE__BACKEND | "postgres", "sqlite", or "memory". |
storage.postgres_url | ACDP_REGISTRY_STORAGE__POSTGRES_URL | Required when backend = "postgres". |
auth.jwt_secret | ACDP_REGISTRY_AUTH__JWT_SECRET | Base64-encoded ≥32-byte secret. |
webhook.url | ACDP_REGISTRY_WEBHOOK__URL | HMAC-signed POST target. |
playground.enabled | ACDP_REGISTRY_PLAYGROUND__ENABLED | Skips DID verification — dev only. |
HTTP surface
Selected routes (the full surface, including request/response shapes, is in docs/HTTP-API.md):
| Method | Path | Notes |
|---|---|---|
| GET | /.well-known/acdp.json | Capabilities document. |
| GET | /.well-known/jwks.json | JWKS (EdDSA public key; empty for HS256). |
| GET | /.well-known/did.json | Registry DID document (when a receipt key is configured). |
| GET | /livez | Process liveness — always 200 while the process is up; never touches storage. |
| GET | /healthz | Storage readiness + the running build's version; 503 when the backend is down. |
| GET | /metrics | Prometheus metrics (when metrics.enabled). |
| POST | /contexts | Publish (full RFC-ACDP-0003 §2.1 pipeline). |
| GET | /contexts/{ctx_id} | Retrieve full context. |
| GET | /contexts/{ctx_id}/body | Retrieve body only. |
| GET | /contexts/search | Keyword + filter search. |
| POST | /contexts/{ctx_id}/retract | Producer retraction (RFC-ACDP-0013). |
| POST | /contexts/{ctx_id}/republish | Producer republish (RFC-ACDP-0013). |
| GET | /lineages/{lineage_id} | Full lineage (visibility-filtered). |
| GET | /lineages/{lineage_id}/current | Newest non-superseded version. |
| GET | /log/checkpoint | Signed transparency-log checkpoint (RFC-ACDP-0012). |
| GET | /log/proof | Inclusion / consistency proofs. |
| GET | /log/entries | Log leaves (visibility-filtered). |
| GET | /changes | Change feed: retractions, supersessions, key revocations (RFC-ACDP-0018; when changes.enabled). |
| POST | /subscriptions | Create a change-hint subscription; the secret is shown once (RFC-ACDP-0018 §8; when events.enabled). |
| GET | /subscriptions/{id} | Read your own subscription, without its secret (when events.enabled). |
| DELETE | /subscriptions/{id} | Delete your own subscription (when events.enabled). |
| POST | /auth/challenge | Issue a nonce for DID challenge-response (when auth.enabled). |
| POST | /auth/token | Verify signed challenge → JWT (when auth.enabled). |
| POST | /auth/token/revoke | Revoke your own token by jti (when auth.enabled). |
| GET | /admin/status | Operational snapshot (admin bearer). |
| GET | /admin/lineages/{id}/audit | On-demand lineage integrity audit (admin bearer). |
| POST | /admin/contexts/{id}/retract | Admin retraction (admin bearer). |
| POST | /admin/contexts/{id}/republish | Admin republish (admin bearer). |
| GET | /admin/contexts | Compile-gated by playground (admin bearer). |
| POST | /admin/pinned-keys/reload | Compile-gated by playground (admin bearer). |
Visibility (public / restricted / private) is enforced server-side per
RFC-ACDP-0008 §4.5; authenticated callers identify themselves via
Authorization: Bearer <jwt>. A header the registry does not recognise as a
bearer is treated as anonymous rather than refused on these routes — it
never reaches token validation — while /admin/* refuses it. See
Presenting a bearer.
Full request/response shapes, error envelope, auth flow, config, and ops are
documented under docs/.
When auth.enabled = false, the /auth/challenge, /auth/token, and
/auth/token/revoke routes are not mounted, and any Authorization header is ignored — every caller
is treated as anonymous, so the public/restricted/private gate runs against
None.
Production TLS
The server's [registry.tls] block can serve HTTPS directly via rustls,
but the recommended production topology is to terminate TLS upstream
(Nginx, Caddy, an ALB) and let acdp-registry listen on plain HTTP behind
it. The example config's port = 8443 is a hint that HTTPS is expected at
the edge; the binary itself happily serves plain HTTP on any port. Reasons:
- The DID-web SSRF policy in
acdp-rsrequires HTTPS for outbound resolution; that's separate from how the registry serves inbound traffic. - TLS termination at the load balancer is the standard ops pattern, gives you cert rotation without restarting the registry, and decouples performance tuning from the protocol implementation.
For the playground profile (--features storage-sqlite,playground),
inbound HTTPS is convenient for cross-registry demos; set
registry.tls.enabled = true and point cert_path / key_path at a
self-signed cert.
Running PG integration tests locally
The Postgres-backed integration suite (tests/pg_integration.rs) mirrors the
SQLite suite but exercises PgStore. It's gated on ACDP_REGISTRY_TEST_PG_URL
and skips cleanly when unset, so day-to-day cargo test is unaffected.
docker run --rm -d --name acdp-test-pg -p 5433:5432 \
-e POSTGRES_USER=acdp -e POSTGRES_PASSWORD=acdp -e POSTGRES_DB=acdp_registry \
postgres:16-alpine
ACDP_REGISTRY_TEST_PG_URL=postgres://acdp:acdp@localhost:5433/acdp_registry \
cargo test -p acdp-registry-server \
--no-default-features --features storage-pg \
--test pg_integration
docker stop acdp-test-pgTests run serially (#[serial_test::serial]) and truncate the registry
tables between cases.
Build matrix
cargo build --release # default = SQLite
cargo build --release -p acdp-registry-server \
--no-default-features --features storage-pg # Postgres only
cargo build --release -p acdp-registry-server \
--no-default-features --features storage-memory # In-memory
cargo build --release -p acdp-registry-server \
--features storage-sqlite,playground # PlaygroundThese four are the common ones, not the whole set. The binary's feature space is
eight — 4 backend states (sqlite | pg | memory | none) x playground
on/off — and CI builds all eight on every commit (#200).
Rather than repeat the list here and give it a second place to go stale, the
authoritative index is the comment above the feature steps in the clippy job of
.github/workflows/ci.yml. It carries the arithmetic that generates the count, so
the list can be checked rather than trusted.
Note this is the server binary's feature space, not the workspace's:
acdp-registry-types also builds without its default axum feature, and CI
covers that separately: the clippy job lints it with --no-default-features
(#221).
License
Dual-licensed under either of
- Apache License, Version 2.0
- MIT License
at your option. See LICENSE.