Registry receipts (ACDP 0.2.0 / RFC-ACDP-0010)

A registry receipt is the registry's signed, non-repudiable attestation of what it did at publish time: the identifiers it assigned (ctx_id, lineage_id), the timestamp it stamped (created_at), the content hash it verified, and — critically — the fingerprint of the producer key it actually resolved for signature verification. That last binding is what makes contexts verifiable years later, after the producer has rotated keys or let its domain lapse.

This doc is the operator runbook. The receipt wire format, signing construction, and consumer-side verification procedure are normative in RFC-ACDP-0010; the verifying client lives in acdp-rs (VerificationPolicy, ReceiptPolicy::Require).

Enabling receipts

Generate a 32-byte Ed25519 seed and configure it:

openssl rand -base64 32
[receipt]
signing_key_seed_b64 = "<that value>"     # or signing_key_path = "/etc/acdp/receipt-key.seed"
key_id_fragment      = "receipt-key-1"

Env-only deployments set ACDP_REGISTRY_RECEIPT__SIGNING_KEY_SEED_B64.

With a key configured the registry:

  • advertises the acdp-registry-receipts profile in /.well-known/acdp.json (acdp_version itself is unconditionally "0.5.0" as of REG-3 — RFC-ACDP-0016 §10's anchors claim always wins the version max() — so it no longer moves with [receipt]; the receipts profile is what actually signals this capability is active);
  • mints a receipt for every publish, atomically with the context row (one INSERT, one transaction — a context can never exist without its receipt, and a failed mint aborts the publish);
  • returns the receipt as the top-level registry_receipt member of the publish response and of GET /contexts/{ctx_id} (never of GET /contexts/{ctx_id}/body);
  • serves its own DID document at GET /.well-known/did.json (below).

Advertising the profile is a hard commitment — there is no receipt_unavailable error and no degraded mode. That is also why a fully unverified playground and [receipt] are mutually exclusive at startup: with playground.pinned_only = false the publish path accepts any signature from a non-pinned agent without checking it, so any fingerprint it attested would be false.

playground.pinned_only = true with at least one pinned key is a different matter and is supported alongside receipts: every publish is then verified — a pinned did:web agent against its pinned key, a did:key agent against the DID itself — producing exactly the same verified (agent_did, content_hash) pair a receipt attests, regardless of how the key was resolved. Pinned-only with an empty pinned_keys list is refused at startup whether or not [receipt] is configured — not because it locks the registry down, but because it does the opposite: pinned_only has no effect while pinned_keys is empty, so publishes would fall through to the fully unverified path. That is a playground rule rather than a receipts rule; see CONFIGURATION.md.

Event receipts (ACDP 0.5.0 / RFC-ACDP-0017 §10)

An event receipt attests that the registry accepted one lifecycle event (a producer retract/republish, or an /admin/* lifecycle action) at position index of a context's lifecycle_events, at accepted_at. It binds the exact served event JSON, signature included, by event_hash.

There is no switch of its own. The registry mints event receipts when all three hold:

  • [lifecycle] enabled = true (advertises acdp-registry-lifecycle);
  • a [receipt] key is configured (advertises acdp-registry-receipts);
  • the registry claims acdp_version >= 0.5.0 (always true today).

The same receipt key signs them, under the same key_id, so the rotation procedure and the retention rule below cover event receipts too: a receipt signed before a rotation keeps verifying against the retired key in did.json's verificationMethod.

  • accepted_at is the registry clock in canonical milliseconds, clamped up so it is never earlier than the context's created_at or the previous event's accepted_at.
  • The receipt commits in the same transaction as the event: both land or neither does. A byte-identical retry of an event serves the stored receipt and mints nothing.
  • registry_state.event_receipts is served, parallel to lifecycle_events, only when every event has a receipt. Events that predate receipts are receipted by a sweep on every start, before the registry serves a request, and by the next lifecycle event on their context (see UPGRADING.md and OPERATIONS.md).
  • It is served everywhere lifecycle_events is: GET /contexts/{id}, the retract/republish responses (producer and /admin/*), and each member of GET /lineages/{id} and /lineages/{id}/current, which also carry their registry_receipt (RFC-ACDP-0017 §11). A federated retrieval passes the origin registry's receipts through untouched.

To verify one (§10.3): parse it against the closed schema, check that it binds to the served event at its position (ctx_id, index, event_id, event_hash = sha256 over the JCS of the event including its signature, registry_did = the origin's did:web, accepted_at >= created_at), then verify the signature against the key did.json publishes for its key_id. The acdp SDK does all of it: EventReceipt::check_binding and verify_signature_against_hash, or acdp::chain::verify_chain over a whole bundle, which admits an event on the registry basis only when its receipt verifies.

Lineage-head receipts (ACDP 0.3.0 / RFC-ACDP-0011)

Registry receipts attest publish-time facts; a lineage-head receipt attests a serve-time claim: "as of as_of, the head of lineage_id is head_ctx_id at head_version with head_status". Enable it on top of a configured receipt key:

[receipt]
signing_key_seed_b64 = "<seed>"
key_id_fragment      = "receipt-key-1"
head_receipts        = true              # ACDP 0.3.0 / RFC-ACDP-0011

With head_receipts = true the registry:

  • advertises the acdp-registry-head-receipts profile (prerequisite: acdp-registry-receipts — startup validation refuses the flag without a signing key); acdp_version itself is unconditionally "0.5.0" as of REG-3 (see above) and no longer moves with head_receipts;
  • mints a fresh receipt on every GET /lineages/{id}/current response, as the top-level lineage_head_receipt member, and never attaches one to GET /contexts/{ctx_id}/body; when /current 404s (all versions superseded-or-retracted) there is no head claim to attest;
  • never persists head receipts — each is minted for one response;
  • signs with the same receipt key, so there is no new key, DID-document entry, or rotation procedure to operate.

What a head receipt attests — as_of semantics, the byte-match against the served head, freshness, and key lifecycle — is normative in RFC-ACDP-0011 §6–§8 and is not restated here.

Because head receipts are requester-relative (the head is selected under the requester's visibility), /current responses must not be cached across differently-authorized requesters.

The registry marks them (#205). /current, /contexts/*, /lineages/*, the search endpoint and /log/proof//log/entries all emit:

Cache-Control: private
Vary: authorization, x-tenant-id

private rather than no-store deliberately: the threat is a shared cache reusing one requester's copy for another, and that is exactly what private excludes. no-store would add protection only against caches that ignore directives — which ignore no-store too — while permanently forbidding legitimate same-requester client caching.

Vary names both axes because tenant scope comes from x-tenant-id as well as from the bearer token, and with auth.enabled = false the header is the only tenant signal. Vary: Authorization alone would be wrong for this registry.

Credential and operational responses go further and emit Cache-Control: no-store: /auth/*, the /admin/* routes, and /healthz (on the degraded arm as well as the healthy one — a cached "ok" masks an outage).

The three /.well-known/* documents keep public, max-age=300 (capabilities, registry_did_document and jwks in crates/acdp-registry-core/src/handlers/meta.rs). None of them is requester-relative, and every_well_known_document_keeps_public_caching pins all three against a downgrade. (/.well-known/did.json exists only when a receipt key is configured; its 404 arm answers no-store — a cached 404 would mask the document from every resolver that saw the miss once an operator adds a key.)

GET /metrics is requester-relative — it gates on metrics.bearer_token, so its 200-vs-401 depends on the caller — and now answers no-store on every arm: 200, 401 and 405 (#218). The directive is attached to that route alone, not to the group it shares with the /.well-known/* documents, which keep public, max-age=300.

What this does not buy you

Defense in depth, not a guarantee. Two limits worth stating plainly:

  • A CDN configured to "cache everything" / ignore origin headers defeats both private and Vary. No header the origin sends can fix that. If you front the registry with a shared cache, still confirm it honours origin directives on /contexts/*, /lineages/* and the search endpoint.
  • private carries no validators. There is no ETag, no Last-Modified and no max-age, so a requester's own cache may briefly reuse a context that has since been retracted. Accepted: they already held those bytes. The fix if it ever matters is ETags plus explicit freshness — not no-store.

Serving /.well-known/did.json

A receipt's signature references did:web:<authority>#<fragment>, and did:web:<authority> resolves to https://<authority>/.well-known/did.json. The registry generates and serves that document itself from the [receipt] section — no out-of-band hosting needed, but note:

  • the registry must be reachable over HTTPS at the bare authority it mints (registry.authority); DID resolution is HTTPS-only;
  • if a CDN or proxy fronts the registry, make sure /.well-known/did.json is routed through (it is cacheable, max-age=300).

The active signing key appears in both verificationMethod and assertionMethod. Retired keys appear in verificationMethod only.

The key-retention rule (read before rotating)

The rule is RFC-ACDP-0010 §9 (MUST), and it is what keeps old receipts verifiable after rotation. For an operator it comes down to one thing: removing a retired key from verificationMethod bricks every receipt that key ever signed. In this registry a key stays there for exactly as long as it is configured — as the active key or as a [[receipt.retired_keys]] entry — so the procedure below never deletes one. The only sanctioned removal is on confirmed key compromise; read §9 before doing it.

Rotation procedure

  1. Generate a new seed; pick a fresh fragment (receipt-key-2).

  2. Move the old key's public half into [[receipt.retired_keys]]:

    [receipt]
    signing_key_seed_b64 = "<new seed>"
    key_id_fragment      = "receipt-key-2"
    
    [[receipt.retired_keys]]
    public_key_b64  = "<base64 of the OLD raw 32-byte public key>"
    key_id_fragment = "receipt-key-1"
  3. Restart. did.json now lists both keys in verificationMethod and only receipt-key-2 in assertionMethod.

  4. Never delete the retired_keys entry (see above).

Keyless (applies when keyless.enabled, which is off by default). RFC-ACDP-0021 key attestations are bodies signed with the receipt key, so the same rule covers them. Under RFC-ACDP-0021 §8.1 step 1 (0.5.0-draft.4) an attestation whose signing key has left assertionMethod but is still in verificationMethod keeps verifying through its own receipt. So the procedure above is also the attestation rotation: rotate by removing the key from assertionMethod only (step 3 does exactly that). Removing it from verificationMethod invalidates every attestation it signed, both live ones and the historical placement of every keyless body resting on them (attestation_invalid). That is the compromise signal and nothing else. After a compromise, producers must obtain fresh attestations under the successor key; past ones cannot be re-issued, so bodies resting on them become unverifiable. Consumers apply this only once their verifier implements draft.4 (kl-005 M, N).

Backfill policy: none

Contexts published before receipts were enabled stay receipt-less, and their registry_receipt member is simply absent. We deliberately do not backfill: a receipt attests publish-time facts — above all the producer key the registry actually resolved at that moment — and minting one later would be a false attestation.

Deviation from a SHOULD in RFC-ACDP-0010 §7 (pinned spec): a registry advertising acdp-registry-receipts SHOULD backfill receipts for previously published contexts, attesting the stored created_at. This implementation does not, for the reason above, so those contexts are served without a receipt. The same applies to transparency-log leaves (see CONFIGURATION.md · [log]).

Event receipts are the exception, and they do not contradict the rule. An event receipt attests only that the registry accepted the event at accepted_at, and accepted_at is never backdated. A legacy event receipted by the startup sweep carries the sweep's clock, which is true: the registry holds that event and vouches for it from then on. A consumer evaluating an as-of time before the sweep does not count that receipt, which is the honest answer.

The GET /admin/lineages/{lineage_id}/audit report exposes receiptless_contexts so you can see how much pre-receipts history a lineage carries.

did:key producers

Enable with:

[auth]
did_methods = ["did:web", "did:key"]

did:key publishes verify offline — the DID is the key, so there is no DID-document fetch, no SSRF surface, and no assertionMethod check. When the method is not advertised, a did:key publish is rejected with key_resolution_failed (HTTP 400, permanent — fixture dk-003).

Receipts matter more for did:key producers: the DID has no document to attest anything else, and a new key is a new identity (no rotation, so lineage continuity ends with the key). The recommended pattern is two-tier: organizations anchor on did:web, ephemeral/archival producers use did:key.

Lineage anchoring and the audit endpoint

The publish path validates a v(N+1) against the immediate predecessor's persisted row (lineage anchoring, RFC-ACDP-0001 §5.6.2) instead of walking the chain back to v1 — a deep lineage with an unretrievable intermediate can no longer fail a publish. The full walk still exists, as an on-demand integrity check:

GET /admin/lineages/{lineage_id}/audit
Authorization: Bearer <auth.admin_tokens entry>

It verifies version contiguity, supersedes links, the lineage_id derivation from v1, producer continuity, and the single-tip invariant, and reports receipt coverage. Run it periodically (or after restoring from backup) — it detects storage corruption the anchored fast path would silently inherit.

KMS / HSM

Key loading is isolated in acdp-registry-core::receipt (config → acdp::types::receipt::ReceiptSigner). A KMS/HSM-backed deployment plugs in at that seam; note that today's acdp ReceiptSigner holds raw key material, so non-extractable keys additionally need an upstream acdp signer abstraction — tracked as future work, the publish path will not change.

Verifying end-to-end

Consumer-side verification is the SDK's job, not this registry's: set ReceiptPolicy::Require on the VerificationPolicy of the acdp-client verified module (re-exported by acdp), as described in acdp-rs · Consuming & Verifying. It checks the receipt against this registry's /.well-known/did.json — so run it from a machine that reaches the registry over TLS at its bare authority — and applies the RFC-ACDP-0010 §8 procedure. A receipt failure does not invalidate the body; the SDK reports the two verdicts separately.