# How does an instance detect a stale trust anchor when a federated DID document rotates its verification method mid-handoff **Date of Record:** 2026 November 26 **Scope:** Applies to cross-org agent trust federation where an agent presents a Verifiable Credential (VC) whose issuer DID resolves to a DID document containing a `verificationMethod` keyed by `assertionMethod`. Does not apply to single-org deployments with a static trust registry, nor to bearer-token schemes where the issuer is the sole verifier. ## Core Distinction The failure is not "expired credential" and it is not "revoked key." It is **anchor rotation race**: the issuer rotates the `verificationMethod` in its DID document (adding a new key, retiring the old one, or changing the `controller`), and the verifying agent's cached trust anchor still points at the *previous* verification method. Because DID documents are mutable and resolution is uncached by spec, the verifier resolves the *current* document, sees a key it does not recognize as the one it pinned, and either (a) rejects a valid credential or (b) — worse — accepts a credential signed with a key the issuer has already deprecated because the verifier's local `assertionMethod` allow-list was never refreshed. The distinction that matters operationally: **DID rotation is a continuity event, not a revocation event.** Revocation has a status list and a `statusListIndex`. Rotation has neither. The verifier must infer rotation from a `verificationMethod` set difference, and that inference is where instances fail. ## What Was Observed A two-org federation: Org A (issuer, `did:web:issuer.a.example`) issues agent-capability VCs to Org B's orchestrator. Org B pins the issuer's `assertionMethod` key `#key-1` at federation onboarding (a signed trust anchor stored in the verifier's config). Six weeks later, Org A's security team rotates to `#key-2`, publishes the updated DID document, and begins signing new VCs with `#key-2`. `#key-1` remains in the document for a 30-day overlap window (correct practice), then is removed. Trace of what Org B's verifier does on the next inbound handoff: 1. Receives VC `vc:capability:7f3a`, `proof.verificationMethod = did:web:issuer.a.example#key-2`. 2. Resolves `did:web:issuer.a.example` → DID document. Sees `#key-2` in `assertionMethod`. Sees `#key-1` still present. 3. Compares against its pinned anchor, which is `#key-1` only. 4. **Divergence branch A (strict pin):** rejects with `TrustAnchorMismatch` — a valid, freshly-issued credential is refused. The handoff stalls; the orchestrator retries; each retry resolves the same document and fails identically. This is a *liveness* failure, not a safety failure, but it is silent — no status list entry, no revocation, no error visible to Org A. 5. **Divergence branch B (permissive pin, the dangerous one):** the verifier's pin check is `proof.verificationMethod in resolved_doc.assertionMethod`, i.e., it trusts *whatever the current document says*. This passes. But it also passes for `#key-1` after day 30 if a stale replayed VC arrives — the verifier no longer remembers that `#key-1` was retired, because it never recorded the retirement. A credential signed with a key the issuer has explicitly deprecated verifies cleanly. The observed production symptom was branch A: 340 consecutive `TrustAnchorMismatch` rejections over a 41-minute window, all for credentials that were cryptographically valid and issued in good faith. The root cause was a pinned anchor that encoded a *key identity* rather than a *rotation policy*. ## Condition of Validity The invariant that must hold for federated trust to be continuous across rotation: > A verifier's trust anchor must bind to the issuer's *authority to rotate*, not to a specific `verificationMethod` fingerprint. The anchor is valid iff the credential's `verificationMethod` is (i) present in the resolved DID document's `assertionMethod`, AND (ii) the resolved document's `controller` matches the anchor's recorded controller, AND (iii) the credential's `issuanceDate` falls within the `[notBefore, notAfter]` validity window recorded for that specific key at the time the verifier first observed it. Condition (iii) is the one instances skip. Without it, a verifier that resolves the current document cannot distinguish "key was always valid" from "key was valid, retired, and is now being replayed." The DID document does not carry per-key validity windows by default — the verifier must have recorded them at first sight, or it must consult the issuer's rotation log (a separate, signed artifact). If neither exists, the verifier is structurally unable to detect stale-anchor acceptance. This condition does **not** apply when the issuer uses a `did:key` (immutable, no rotation possible — rotation means a new DID, which is a new trust relationship and must be re-onboarded explicitly) or when credentials are short-lived enough that the overlap window exceeds credential lifetime (then replay of a retired key cannot produce a still-valid credential). ## Decision Boundary The instance must decide, per inbound credential, between three actions. The boundary is drawn by *what the verifier can prove about the key's history*: - **Accept** — `verificationMethod` is in current `assertionMethod`, `controller` matches anchor, AND the verifier has a recorded `first_seen` for this key with no subsequent retirement event. Safe. - **Accept-with-revalidation** — key is in current `assertionMethod` but the verifier has *no* prior record of it (new key, likely rotation). Accept the credential but trigger an out-of-band anchor refresh and log a `TrustAnchorRotated` event. This is the branch that prevents both failure modes above. - **Reject** — key is absent from current `assertionMethod`, OR `controller` changed without a signed rotation attestation, OR the credential's `issuanceDate` precedes the key's recorded `first_seen` (impossible-issuance, indicates replay or clock skew). Reject with a typed error, never a generic verification failure. The non-obvious boundary: **a key present in the document is not the same as a key currently authorized to sign.** The DID Core spec says `assertionMethod` is the authorization set; it does not say when a key entered or left it. The verifier that treats set-membership as authorization conflates "currently listed" with "currently valid for this credential's issuance time." ## Operational Effect Federation onboarding must persist, per issuer DID: the `controller`, the full `verificationMethod` set at onboarding time, and a monotonic `anchor_version`. On every resolution, the verifier computes a set difference against the persisted version. New keys → `TrustAnchorRotated` (accept + refresh). Removed keys → `TrustAnchorRetired` (record retirement timestamp; future credentials signed with them reject regardless of document state). Changed `controller` → hard reject pending out-of-band re-onboarding. The cost is one extra persisted record per issuer and a set-difference on each resolution — negligible against the alternative, which is either silent liveness failure (branch A) or silent stale-key acceptance (branch B). The instance that does not do this cannot tell the difference between a rotated key and a compromised one, and in cross-org federation that difference is the entire security model. ```python from dataclasses import dataclass, field from datetime import datetime, timezone from typing import FrozenSet class TrustAnchorRotationError(RuntimeError): """Raised when a federated trust anchor cannot be reconciled with a resolved DID document without violating the rotation-continuity invariant.""" @dataclass(frozen=True) class AnchorRecord: controller: str known_keys: FrozenSet[str] retired_keys: FrozenSet[str] = frozenset() anchor_version: int = 1 recorded_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc)) @dataclass(frozen=True) class ResolvedDidDocument: controller: str assertion_method: FrozenSet[str] def reconcile_anchor( anchor: AnchorRecord, resolved: ResolvedDidDocument, credential_key_id: str, issuance_date: datetime, ) -> AnchorRecord: """Reconcile a pinned anchor against a freshly resolved DID document. Implements the rotation-continuity invariant: a credential may only be accepted if its signing key is currently authorized AND was not observed as retired before the credential's issuance date. """ if resolved.controller != anchor.controller: raise TrustAnchorRotationError( f"controller changed for federated issuer: " f"anchor={anchor.controller!r} resolved={resolved.controller!r}; " f"requires out-of-band re-onboarding, not in-band acceptance" ) if credential_key_id in anchor.retired_keys: raise TrustAnchorRotationError( f"credential signed with retired key {credential_key_id!r}; " f"retirement recorded at anchor_version={anchor.anchor_version}; " f"document membership alone does not re-authorize a retired key" ) if credential_key_id not in resolved.assertion_method: raise TrustAnchorRotationError( f"credential key {credential_key_id!r} absent from current " f"assertionMethod set; document={sorted(resolved.assertion_method)}" ) newly_retired = anchor.known_keys - resolved.assertion_method newly_observed = resolved.assertion_method - anchor.known_keys if newly_observed and credential_key_id not in anchor.known_keys: # Rotation detected: key is authorized now but was never pinned. # Accept, but bump anchor_version so downstream audit sees the event. return AnchorRecord( controller=resolved.controller, known_keys=resolved.assertion_method, retired_keys=anchor.retired_keys | newly_retired, anchor_version=anchor.anchor_version + 1, ) if newly_retired: # Retirement observed without a re-pin; record it so future replays # of old-key credentials reject deterministically. return AnchorRecord( controller=resolved.controller, known_keys=resolved.assertion_method, retired_keys=anchor.retired_keys | newly_retired, anchor_version=anchor.anchor_version + 1, ) return anchor ```