# In what scenarios must an instance reject a DID-anchored verifiable credential handshake when the trust anchor's key rotation outpaces the credential's proof chain **Date of Record:** 2026 November 24 **Scope:** Applies to federated agent handshakes where an agent instance validates a peer's Verifiable Credential (VC) whose `proof.verificationMethod` resolves through a DID document controlled by a cross-org trust anchor. Does not apply to same-org SPIFFE/mTLS handshakes or to VCs anchored to a single static key with no rotation policy. ## Core Distinction The failure is not "the credential is invalid." It is a *temporal* mismatch between three clocks that the agent layer treats as one: (1) the wall-clock at which the VC was issued and signed, (2) the DID document's `updated` timestamp at which the signing key was still authoritative, and (3) the wall-clock at which the receiving instance dereferences the DID to verify. When a trust anchor rotates its verification key *and* prunes or supersedes the old key entry faster than the VC's proof chain can be re-resolved, a credential that was perfectly valid at issue time becomes unverifiable at verify time — yet the peer agent's *identity claim* is still semantically true. The boundary is this: a DID resolver returning "key not found" is indistinguishable, at the agent layer, from "key never existed" (a forgery) unless the instance separately consults the DID document's version history / `alsoKnownAs` / deactivated-key registry. Most agent frameworks collapse these two into a single `VerificationError`, which is the defect. ## What Was Observed A cross-org handoff between two agent swarms. Org A's orchestrator agent presents a VC to Org B's intake agent asserting capability `tool:execute:sql` with `proof.created = T0`. The VC's `verificationMethod` is `did:web:anchor-a.example#key-3`. At `T0 + 90s`, Anchor A rotates: `key-3` is removed from the current DID document, `key-4` added, and the document's `updated` field bumped. The old key is retained only in a versioned history endpoint that Org B's resolver does not query by default. Org B's intake agent re-verifies the VC during a *second* handshake leg (baton re-pass after a checkpoint/resume, per the swarm's continuation protocol). The resolver dereferences `did:web:anchor-a.example`, finds no `key-3`, and raises `VerificationError: verificationMethod not found`. The intake agent's retry policy treats this as a transient resolution failure and retries three times with backoff — each retry now firmly in the post-rotation window. After exhaustion, the agent emits a *terminal* rejection and, critically, writes a "peer untrusted" fact into its episodic memory. That fact is later distilled into semantic memory as "Anchor A is untrustworthy," poisoning all future handshakes with Org A for the remainder of the session, even though the underlying credential and identity were sound. The observable signature in logs: a burst of `verificationMethod not found` errors clustered within a ~5s window that straddles a DID document `updated` timestamp, followed by a *silent* semantic-memory write. No error surfaces at the swarm level; the orchestrator simply sees a peer that "went dark." ## Condition of Validity The invariant a receiving instance must hold is: > A VC is verifiable iff there exists a DID document version `V` such that `proof.created ∈ [V.validFrom, V.validUntil)` and `proof.verificationMethod` is present in `V`. The *current* document is only one such version; verification MUST be performed against the version whose validity interval contains the proof timestamp, not against the head. This condition is *valid* (the instance may proceed on the peer's identity) only when the instance can reconstruct or dereference the historical document version. It is *violated* — and the instance must reject, not retry — when: 1. The resolver returns a head document whose `updated > proof.created` **and** the referenced key is absent from head, **and** 2. The versioned-history endpoint either does not exist or returns a version whose `validUntil < proof.created` (meaning the key was already retired before signing — a genuine forgery or clock-skew attack), **and** 3. No `deactivated` assertion exists for the key (a *deactivated* key is a hard reject; a *rotated* key is a soft path to history). The subtle trap: condition (2) requires comparing the proof timestamp against the *historical* document's validity interval, not against the head's `updated`. An instance that only checks "was this key ever in any document version" will accept a credential signed with a key that was retired *before* the signature — the replay-after-rotation attack. ## Decision Boundary The decision boundary between "retry resolution" and "terminal reject with memory poisoning suppressed" is: - **Head-miss + history-hit with `validFrom ≤ proof.created < validUntil`** → the credential is valid; the peer identity stands; do **not** write an untrustworthy fact. Log a `stale-anchor-rotation` event and continue. This is the common case and the one most frameworks mishandle. - **Head-miss + history-hit with `proof.created ≥ validUntil`** → the key was already retired when the signature was made. This is either a replay or a clock-skew attack. Terminal reject, quarantine the peer, and escalate to the trust-anchor's revocation channel — *not* to episodic memory as a generic "untrusted" fact. - **Head-miss + history-miss + no deactivation record** → resolution is genuinely incomplete (resolver outage, partition). Retry with bounded backoff, but the retry budget must be *shorter than the anchor's minimum rotation interval*; otherwise the retry itself guarantees you land post-rotation. If the budget is exhausted, reject as `AnchorUnresolvable` — a *different* exception class than `CredentialInvalid`, so downstream memory distillation does not conflate "couldn't reach the anchor" with "the peer lied." - **Deactivated key** → hard reject regardless of history. Deactivation is an explicit revocation signal; history is irrelevant. The single most important guardrail: **the exception taxonomy must be three-valued at minimum — `CredentialInvalid`, `AnchorUnresolvable`, `AnchorRotatedButValid` — and only `CredentialInvalid` may feed the "untrusted peer" memory write.** A two-valued `VerificationError` collapses the rotation case into the forgery case and produces the memory-poisoning cascade observed above. ## Operational Effect When the instance correctly distinguishes the three outcomes, the observable behavior changes in three ways. First, the swarm's continuation protocol survives anchor rotation without a spurious baton drop — the resume leg re-verifies against history and proceeds. Second, episodic memory no longer accumulates false "untrusted" facts about peers whose only sin was being signed by a key that rotated mid-handshake; the semantic distillation that runs at session close stays clean. Third, and least obvious, the receiving agent's *own* outgoing VCs become safer to issue with longer `proof.created`-to-verify gaps, because peers can now rely on history resolution rather than racing the rotation clock. When the instance does *not* distinguish them, the failure is silent and compounding: a single rotation event within a handshake window produces a terminal rejection, a poisoned semantic fact, and — because the orchestrator sees only "peer went dark" — a retry storm against Org A's intake that re-triggers the same rotation race on every fresh handshake. The system does not fail loudly; it fails by slowly concluding that a healthy federation partner is hostile. The architectural invariant to encode: **verification is a function of (proof, historical DID version, deactivation registry), not of (proof, current DID document).** Any agent instance that resolves only the head document is, by construction, unable to distinguish rotation from forgery and must be treated as non-compliant for cross-org federation. ```python class AnchorRotationAmbiguity(RuntimeError): """Raised when a VC's signing key is absent from the DID head document and the instance cannot determine whether the key was rotated (valid, proof predates retirement) or never existed / was retired before signing (invalid, replay or skew). Callers MUST NOT map this to a generic 'untrusted peer' memory write.""" pass def verify_federated_vc(proof_created: float, verification_method: str, head_doc: dict, history: list[dict], deactivated_keys: set[str]) -> str: key_id = verification_method.split("#", 1)[-1] if key_id in deactivated_keys: # Explicit revocation: hard reject, distinct from ambiguity. raise AnchorRotationAmbiguity( f"key {key_id} is deactivated; credential is revoked, not rotated" ) head_keys = {k["id"] for k in head_doc.get("verificationMethod", [])} if key_id in head_keys: return "valid-current" # Head-miss: must resolve against a historical version whose validity # interval contains the proof timestamp. for version in history: keys = {k["id"] for k in version.get("verificationMethod", [])} if key_id not in keys: continue if version["validFrom"] <= proof_created < version["validUntil"]: return "valid-rotated" # Key present but proof timestamp outside its validity window: # signed with a retired key -> replay or clock skew. raise AnchorRotationAmbiguity( f"key {key_id} present in version but proof_created " f"{proof_created} outside [{version['validFrom']}, " f"{version['validUntil']}); possible replay/skew" ) # Key absent from head and from all history: unresolvable, NOT invalid. raise AnchorRotationAmbiguity( f"key {key_id} absent from head and history; anchor unresolvable, " f"do not poison peer-trust memory" ) ```