# Where must an instance re-verify a peer's DID-anchored agent credential after a key rotation mid-session, and why does the cached trust anchor silently outlive its validity? **Date of Record:** 2026 December 2 **Scope:** Applies to cross-organization agent-to-agent sessions where trust is bootstrapped from a peer's Decentralized Identifier (DID) document and a Verifiable Credential (VC) asserting agent capability, and where the session is long-lived relative to the DID document's key rotation cadence. Does not apply to single-org intra-tenant sessions sharing one trust root, nor to short-lived request/response calls that complete within a single credential TTL. ## Core Distinction The failure is not "expired credential accepted." A TTL check catches that. The failure is that the *trust anchor*—the binding between a peer agent's identity (DID) and the public key that signed its capability VC—is resolved once at handshake and cached for the life of the session, while the *authoritative* binding in the DID document rotates underneath it. The session keeps validating new per-message signatures against a key that the issuer has already revoked and replaced. Every signature check passes. Every TTL check passes. The agent is authenticating against a ghost. The distinction that matters operationally: **credential validity and anchor validity are different clocks.** A VC can be well within its `exp` while the verification method (`verificationMethod`) that anchors it has been deactivated in the DID document. Most agent stacks conflate "the credential is unexpired and the signature verifies" with "the peer is currently trusted." Those are not the same predicate. ## What Was Observed A procurement agent (Org A) opened a delegated-authority session with a settlement agent (Org B) at T0. Handshake sequence: 1. Org A resolved `did:web:org-b.example:agents:settlement` → fetched the DID document → extracted `verificationMethod[0]` (key `K1`, an Ed25519 assertion key). 2. Org B presented a capability VC, `iss = did:web:org-b.example`, signed by `K1`, `exp = T0 + 24h`. 3. Org A verified the VC signature against `K1`, checked `exp`, checked the capability scope, cached `{peer_did, K1, vc_hash, exp}` in session state. 4. Session proceeded for 11 hours, exchanging signed settlement intents. At T0+6h, Org B's security team rotated the agent's signing key: `K1` was marked `revoked` in the DID document, `K2` published as the new `verificationMethod`, and the old VC was reissued under `K2`. This is the *correct* remediation after a suspected key compromise—the whole point of rotation is that material signed by `K1` after revocation should not be honored. Org A never re-resolved. Its cached anchor still pointed at `K1`. Settlement intents arriving at T0+7h through T0+11h carried signatures that verified cleanly against the cached `K1`. The agent's verification log read `signature_valid=true` for every message. The compromise that triggered rotation was, by construction, still exploitable for the remaining 5 hours of the session—because the party that rotated the key (Org B's own DID controller) had no channel to force Org A to re-resolve. The observable tell was retroactive: replaying the session against the *current* DID document at T0+12h, 47 of 47 post-rotation messages failed verification, because `K1` no longer resolves. The live session had reported 47/47 valid. The discrepancy between live verification and replay verification is the signature of a stale anchor. ## Condition of Validity The invariant that must hold for cross-org trust to be sound: > **For every message accepted at time `t`, the verification key used must be resolvable and non-revoked in the peer's DID document as of `t` (within a bounded resolution staleness `δ`), not merely as of session establishment.** The cached-anchor design violates this whenever `session_duration > rotation_interval + δ`. In the observed case `session_duration = 11h`, `rotation_interval` was nominally 90 days but *event-driven* (compromise-triggered), so the effective interval was 6h. The agent assumed the nominal cadence; the security event ignored it. Three conditions make this failure reachable: - **The DID document is cached with session lifetime, not with a bounded freshness window.** `δ` is effectively the session duration. - **Revocation is not pushed.** DID documents are pull-based. Org B's controller can revoke `K1` but cannot notify Org A's live session. There is no revocation-list push in the base DID resolution model. - **The VC's `exp` is longer than the rotation cadence.** The VC was valid for 24h; the key it was anchored to survived 6h. `exp` gave false comfort. The failure is *not* reachable if the agent re-resolves the DID document on every message (costly, but sound), or if the VC carries a `credentialStatus` revocation pointer that is checked per-message, or if session lifetime is hard-capped below the minimum plausible rotation interval. ## Decision Boundary The operational question is not "should I cache the DID document" (you must—resolution is a network call and per-message resolution is often infeasible). The question is **what freshness bound `δ` is admissible, and what must happen when it lapses mid-session.** The boundary: - **Re-resolve when `now - last_resolved > δ`**, where `δ` is set by the *shortest* plausible rotation interval, not the nominal one. For compromise-driven rotation, treat `δ` as minutes-to-hours, not days. - **On re-resolve, if the verification method used to validate the session's anchor is no longer `active`** (revoked, deactivated, or absent), the session must transition to a *re-attestation-required* state. It must not silently continue on the old key, and it must not silently fail closed without signaling—both are wrong. The correct transition is: freeze new privileged actions, request a fresh VC under the current active key, and re-verify. - **Do not trust the peer to tell you it rotated.** The rotation signal is the DID document itself, pulled by you. A peer that says "we rotated, here's K2" is an unauthenticated claim until you resolve and confirm `K2` is the published active method. The boundary is crossed the moment a privileged action (settlement, delegation, fund movement) is authorized by a signature verified against an anchor older than `δ`. Below `δ`, cached-anchor verification is admissible. Above `δ`, it is unsound regardless of how clean the signature looks. ## Operational Effect The practical consequence is that **cross-org trust is a pull-refresh problem masquerading as a handshake problem.** Agents that model trust as "establish once, then operate" will, under key compromise, continue to honor a revoked identity for the full remainder of the session—and their logs will show nothing wrong, because the only check they run (signature against cached key) keeps passing. The guardrail is a freshness-bounded anchor with an explicit re-attestation transition: - Anchor cache carries `resolved_at` and `δ`, not just the key. - Every privileged authorization checks `now - resolved_at <= δ` before trusting the cached key; on lapse, forces re-resolution. - Re-resolution compares the *current* active verification method against the one the session is anchored to; mismatch → `AnchorStaleError`, session frozen pending re-attestation. - Replay verification (re-resolve at audit time, re-check all historical signatures) is the detection mechanism for sessions that already drifted; live verification alone cannot catch it. The invariant to encode: *a signature is only as trustworthy as the freshness of the DID resolution that anchors its key.* Verification without a freshness bound on the anchor is verification against a possibly-revoked ghost. ```python import time from dataclasses import dataclass, field class AnchorStaleError(RuntimeError): """Raised when a session's cached DID trust anchor is older than the admissible freshness bound, or when re-resolution shows the anchoring verification method is no longer active.""" pass @dataclass class TrustAnchor: peer_did: str verification_method_id: str public_key: bytes resolved_at: float delta_seconds: float # admissible staleness bound def is_fresh(self, now: float) -> bool: return (now - self.resolved_at) <= self.delta_seconds @dataclass class Session: anchor: TrustAnchor privileged_actions: list = field(default_factory=list) def resolve_did_active_method(peer_did: str) -> str: # Network call to the DID resolver. Returns the currently active # assertion verificationMethod id. In production this hits did:web / # did:ion resolution; here it is a stub representing the authoritative # source of truth. raise NotImplementedError("wire to DID resolver") def authorize_privileged_action(session: Session, now: float) -> None: anchor = session.anchor # Fast path: anchor is within freshness bound. if anchor.is_fresh(now): session.privileged_actions.append(now) return # Freshness lapsed mid-session: must re-resolve before trusting. active_method = resolve_did_active_method(anchor.peer_did) if active_method != anchor.verification_method_id: # The key we anchored the session to has been rotated or revoked. # Freeze: do not authorize, do not silently continue. raise AnchorStaleError( f"Session anchored to {anchor.verification_method_id} on " f"{anchor.peer_did}, but authoritative active method is now " f"{active_method}. Re-attestation required before privileged " f"action at t={now}." ) # Same key still active: refresh the anchor timestamp and proceed. anchor.resolved_at = now session.privileged_actions.append(now) ```