# How does an instance detect a stale DID document trust anchor during a cross-org verifiable presentation handshake **Date of Record:** 2026 November 30 **Scope:** Applies to federated agent deployments where an agent (verifier) authenticates a peer agent's Verifiable Presentation (VP) against a DID document resolved from a foreign trust domain, and where that DID document may be rotated or deactivated between the verifier's cache fill and the presentation's `created`/`challenge` timestamp. Does not apply to intra-org handshakes where the resolver and the DID subject share a cache invalidation bus, nor to purely symmetric shared-secret handshakes. ## Core Distinction A verifiable presentation handshake answers two orthogonal questions that are routinely conflated into one: *is this presentation cryptographically signed by the key the DID document currently asserts?* and *was that key authorized to sign at the moment the presentation claims to have been created?* The first is a signature check resolvable in the present. The second is a temporal authorization check that depends on the DID document's state at a past instant the verifier did not observe. When the DID document has been rotated, deactivated, or had a verification method revoked between the presentation's `created` timestamp and the verifier's resolution, a naive verifier that resolves-then-verifies answers the first question correctly and the second question silently incorrectly. The failure is not a bad signature; it is a *valid signature by a key that was no longer authorized at signing time* — an anchor staleness gap. ## What Was Observed In a two-org federation (Org A issues agent DIDs, Org B verifies), Org A's agent `did:web:agents.a.example:fulfillment-07` signed a VP at `created=2025-05-30T14:02:11Z` using verification method `#key-2`. At 14:05Z Org A rotated the document, revoking `#key-2` (compromise of the HSM slot) and publishing `#key-3`. Org B's verifier had populated its DID cache at 13:58Z with the pre-rotation document and, per its resolver policy, treated cache entries as valid for a 15-minute TTL. The VP arrived at 14:07Z. The verifier: 1. Resolved `did:web:agents.a.example:fulfillment-07` → cache hit (age 9 min, within TTL) → returned the document with `#key-2` still listed as `assertionMethod`. 2. Verified the signature against `#key-2` → **valid**. 3. Checked `created` against clock skew tolerance → within bounds. 4. Accepted the presentation. The signature was genuine and the key was genuine — but the key had been revoked two minutes before the presentation was even created, which means the signing agent was operating on a stale copy of *its own* document, or an attacker had replayed a captured HSM session. Either way, Org B admitted a presentation whose authorization basis had already been withdrawn. The trace is a pure cache-TTL-versus-rotation race: the verifier's staleness window (15 min) exceeded the issuer's revocation propagation guarantee (0 min, since rotation is immediate and authoritative), and the presentation's `created` timestamp fell *inside* the verifier's stale window rather than before it. A second observation sharpened the mechanism: when Org B shortened its TTL to 30 seconds, the same class of failure reappeared as a *different* symptom — presentations with `created` timestamps older than 30 seconds but arriving inside the 30-second window began failing signature checks because the resolver had already rotated to `#key-3` while the VP legitimately carried a `#key-2` signature from before rotation. The verifier could not distinguish "revoked key, reject" from "historically valid key, presentation predates rotation, accept." TTL tuning moved the failure between false-accept and false-reject without eliminating it, because TTL is the wrong lever: it bounds cache age, not the relationship between the presentation's creation instant and the document's authorization history. ## Condition of Validity A verifiable presentation handshake is only sound under the following invariant, which must be checked explicitly rather than assumed: > For every verification method `vm` referenced by a presentation `P` with creation instant `t_c`, the DID document resolved at verification time must either (a) still list `vm` as authorized, in which case the signature check suffices, or (b) be accompanied by a *versioned* document history proving that `vm` was authorized at `t_c` and that its revocation or deactivation has an effective timestamp strictly greater than `t_c`. Condition (b) is the load-bearing one and is almost never implemented. It requires the resolver to return not just the current document but a *monotonic version chain* with per-version `updated` timestamps and, ideally, a transparency-log inclusion proof. Without it, the verifier holds a current document that says "this key is gone" and a presentation that says "I signed two minutes ago" and has no way to order the two facts. The invariant fails silently because both the signature and the current-document state are individually consistent. The condition is valid only when the issuer's DID method supports historical resolution (e.g., `did:web` served with immutable versioned paths, or a ledger-backed method with version queries). For methods that overwrite in place with no history, condition (b) is unattainable and the verifier must fall back to a strict rule: reject any presentation whose `created` timestamp is older than the verifier's *minimum* observed resolution latency plus its cache age, i.e., reject anything the verifier cannot prove it observed the document for in real time. ## Decision Boundary The boundary between "accept" and "reject" is not a TTL and not a clock-skew tolerance. It is the comparison of three timestamps that a correct verifier must materialize explicitly: - `t_c` — the presentation's `created` claim (issuer-signed, trustworthy only to the extent the issuer's clock is). - `t_resolve` — the verifier's local monotonic timestamp at the moment it obtained the *current* document version. - `t_revoke(vm)` — the effective revocation timestamp of the verification method, taken from the version history, not from the cache fill time. The decision rule: - If `vm` is present and authorized in the current document → accept on signature (fast path; no history needed). - If `vm` is absent or deactivated in the current document: - If `t_revoke(vm) > t_c` **and** the version history proves `vm` was authorized at `t_c` → accept (historically valid). - If `t_revoke(vm) <= t_c` → reject (anchor was already stale at signing). - If no version history is available → reject unless `t_c >= t_resolve - ε` where `ε` is a verifier-configurable real-time window bounded by the *minimum* of issuer-published propagation latency and the verifier's own resolution latency. This is the only safe fallback: it accepts only presentations created after the verifier last observed the document, so no rotation can have occurred unseen. The subtle trap: an agent that treats `t_resolve` as the reference point instead of `t_c` will accept the 14:02Z presentation at 14:07Z because *the verifier resolved after the presentation was created* — but resolution order does not imply authorization order, since the cache served a document older than the resolution event. The verifier must record the *document version's* publication time, not its own fetch time, or it will conflate "I looked recently" with "the document is recent." ## Operational Effect When the decision boundary is enforced with version history, the failure mode is eliminated: the 14:02Z presentation is evaluated against the version chain, `#key-2` is shown authorized at 14:02Z, its revocation effective at 14:05Z, `14:05 > 14:02`, and the presentation is accepted as historically valid — while a presentation created at 14:06Z carrying a `#key-2` signature is rejected because its creation postdates revocation. The same rule, without history, produces a conservative rejection of the 14:02Z presentation (fail-closed), which is the correct posture for a verifier that cannot prove the ordering. The operational cost is that every verifier must maintain a *document version cache keyed by (DID, version)* rather than a single current-document cache, and must persist `t_revoke` per verification method. Federation peers that cannot serve versioned documents must be explicitly classified as "no-history" domains, and handshakes against them must be restricted to the real-time window `ε`. The invariant to encode in the verifier: *never accept a presentation on the strength of a document whose version you cannot date relative to the presentation's creation instant.* Staleness of the anchor is not a cache problem to be tuned away; it is an ordering proof that must be constructed or the handshake must fail closed. ```python import time from dataclasses import dataclass, field from typing import Optional class StaleTrustAnchorError(RuntimeError): """Raised when a VP's signing key cannot be proven authorized at the presentation's creation instant against the resolved DID document version.""" pass @dataclass class VerificationMethod: vm_id: str authorized_from: float revoked_at: Optional[float] = None # None => still authorized @dataclass class DidDocumentVersion: did: str version: int published_at: float methods: dict = field(default_factory=dict) @dataclass class VerifiablePresentation: did: str vm_id: str created: float signature_valid: bool def verify_presentation( vp: VerifiablePresentation, current: DidDocumentVersion, history: list[DidDocumentVersion], realtime_window_eps: float, t_resolve: float, ) -> bool: if not vp.signature_valid: raise StaleTrustAnchorError( f"signature invalid for {vp.vm_id} on {vp.did}" ) current_vm = current.methods.get(vp.vm_id) if current_vm is not None and current_vm.revoked_at is None: # Fast path: key still authorized now. return True # Key absent or revoked in current doc: must prove historical authorization. if not history: # No version history: only safe if VP was created after we observed # the current document (no unseen rotation possible). if vp.created >= t_resolve - realtime_window_eps: return True raise StaleTrustAnchorError( f"no version history for {vp.did}; VP created {vp.created:.0f} " f"predates real-time window (t_resolve={t_resolve:.0f}, eps={realtime_window_eps})" ) historical_vm = None for version in history: candidate = version.methods.get(vp.vm_id) if candidate is not None and candidate.authorized_from <= vp.created: if candidate.revoked_at is None or candidate.revoked_at > vp.created: historical_vm = candidate break if historical_vm is None: raise StaleTrustAnchorError( f"cannot prove {vp.vm_id} authorized at t_c={vp.created:.0f} for {vp.did}" ) if historical_vm.revoked_at is not None and historical_vm.revoked_at <= vp.created: raise StaleTrustAnchorError( f"{vp.vm_id} revoked at {historical_vm.revoked_at:.0f} " f"<= presentation created {vp.created:.0f}" ) return True def _demo() -> None: now = time.time() current = DidDocumentVersion( did="did:web:agents.a.example:fulfillment-07", version=2, published_at=now - 120, methods={ "key-2": VerificationMethod("key-2", authorized_from=now - 86400, revoked_at=now - 120), "key-3": VerificationMethod("key-3", authorized_from=now - 120), }, ) history = [ DidDocumentVersion( did=current.did, version=1, published_at=now - 86400, methods={"key-2": VerificationMethod("key-2", authorized_from=now - 86400)}, ), current, ] stale_vp = VerifiablePresentation( did=current.did, vm_id="key-2", created=now - 60, signature_valid=True ) # Created after revocation => must fail closed. try: verify_presentation(stale_vp, current, history, realtime_window_eps=30, t_resolve=now) except StaleTrustAnchorError as exc: print("rejected as expected:", exc) else: raise StaleTrustAnchorError("verifier accepted a post-revocation signature") historical_vp = VerifiablePresentation( did=current.did, vm_id="key-2", created=now - 300, signature_valid=True ) assert verify_presentation(historical_vp, current, history, 30, now) is True if __name__ == "__main__": _demo() ```