# How should an instance detect DID-document key-rotation lag before validating a cross-org AAIF verifiable credential **Date of Record:** 2026 November 29 **Scope:** Applies to any AAIF (Agent Authorization & Identity Framework) instance that validates inbound Verifiable Credentials (VCs) issued by a foreign organization whose Decentralized Identifier (DID) resolves through a cached or federated resolver. Does not apply to same-org credentials validated against a locally pinned trust anchor, nor to symmetric-key session tokens that bypass DID resolution entirely. ## Core Distinction The failure is not "an invalid signature was accepted." The failure is **temporal**: an instance validated a credential against a DID document that was *internally consistent* but *temporally stale relative to the credential's issuance window*. The verifier held a cached DID document whose `verificationMethod` still listed a key that the issuer had rotated out, and the credential was signed with that retired key. Every local check passed — signature valid, `exp` in the future, `iss` matches the DID — yet the credential was cryptographically valid against a trust state the issuer no longer endorsed. This is distinct from revocation. Revocation is an explicit negative signal ("this credential is no longer good"). Key-rotation lag is the absence of a positive signal: the verifier never learned that the *key itself* had been superseded, so it continued treating a de-authorized signing key as authoritative. The verifier's trust anchor drifted behind the issuer's actual trust state, and the drift window is exactly the resolver cache TTL plus resolution latency. ## What Was Observed A cross-org handoff between Org-A (issuer) and Org-B (verifier). Org-A rotated the signing key for its agent DID `did:web:agents.org-a.example:planner` at 14:02:11Z, publishing a new DID document with a fresh `verificationMethod` (`key-2`) and removing `key-1` from the `authentication` relationship. Org-B's resolver had cached the prior DID document at 13:47:00Z with a 30-minute TTL. At 14:09:33Z, Org-A's planner agent presented a VC to Org-B's auditor agent, signed with `key-1` — a key that had been retired seven minutes earlier but whose private material was still resident in the agent's in-process keystore because the rotation event had not propagated to the running instance. Org-B resolved the DID from cache, got the 13:47 document, found `key-1` under `authentication`, verified the signature, checked `exp` (valid), checked `iss` (matches), and admitted the credential. The trace: 1. `rotate_key(did, key-2)` at issuer → DID document v2 published, `key-1` removed from `authentication`. 2. Issuer agent process **not restarted**; keystore still holds `key-1`, signing path unchanged. 3. Verifier `resolve(did)` → cache hit, returns v1 document (TTL not expired). 4. Verifier `verify(vc, did_doc=v1)` → `key-1` present → signature valid → **ACCEPT**. 5. Auditor agent acts on a credential backed by a key the issuer had already disavowed. The signature was genuinely produced by `key-1`. Nothing was forged. The instance was compromised not by an attacker but by a **clock skew between two organizations' notions of the issuer's key set**. The retired key remained live in the signing path and authoritative in the verifying path simultaneously. ## Condition of Validity The verification is sound only when the DID document used to check the signature is **not older than the credential's issuance instant**, or when the credential carries an explicit binding to the DID document version it was signed under. Concretely, the invariant is: > `did_doc.retrieved_at >= vc.issuance_time` **OR** the credential embeds `did_doc_version` / `key_id` that the verifier confirms is still present in a freshly resolved document. Absent that, the verifier is validating against a historical trust anchor and cannot distinguish "key still valid" from "key retired but cache hasn't caught up." The condition of validity therefore requires the verifier to either (a) force a cache-bypassing resolution when `vc.issuance_time` falls within the cache window, or (b) require the VC to name the specific `verificationMethod` id and confirm that id survives a fresh resolution before admitting. A bare signature check against a cached document is valid only when the cache entry is provably newer than the credential. ## Decision Boundary The boundary is the comparison between three timestamps: `did_doc.cached_at`, `vc.issuance_time`, and `now`. - If `did_doc.cached_at >= vc.issuance_time`: cached document postdates issuance; a key present in it was authoritative at signing time. **Accept on cache.** - If `did_doc.cached_at < vc.issuance_time` **and** `now - did_doc.cached_at < rotation_grace_window`: ambiguous zone — the credential may have been signed with a key rotated out during the cache window. **Force fresh resolution; do not accept on cache.** - If fresh resolution returns a document in which the signing `key_id` is absent from `authentication`: the key was retired before or during the credential's life. **Reject with rotation-lag fault**, regardless of signature validity. - If fresh resolution fails (resolver timeout, DID unreachable): **fail closed** — a verifier that cannot confirm current key state must not admit a credential whose signing key's currency is unconfirmed. The non-obvious edge: a credential with a long `exp` but short issuance-to-now gap is *more* dangerous than a short-lived one, because the long validity window means the retired key stays admissible for the credential's entire life if the verifier only checks once. ## Operational Effect An instance that admits a rotation-lagged credential grants authority to an agent operating on a key its own issuer has disavowed. Downstream, that authority propagates: the auditor's attestation is signed, forwarded to a third org, and the third org's validation inherits the stale anchor transitively. The blast radius is not the single handoff but the **warrant chain** — each hop re-verifies against its own possibly-stale cache, so rotation lag compounds across orgs. The guardrail is a verifier-side rule: **never validate a VC against a DID document older than the VC's issuance time without a fresh resolution**, and treat resolver unavailability as a hard reject rather than a cache fallback. The issuer-side complement is to invalidate in-process signing keys *at the moment of rotation*, not at process restart — a rotation that leaves the old key live in the signer is the upstream half of the same failure. ```python import time from dataclasses import dataclass class RotationLagFault(RuntimeError): """Raised when a credential's signing key cannot be confirmed current against a freshly resolved DID document.""" pass @dataclass class DidDocument: key_ids: set[str] cached_at: float # epoch seconds when this doc was retrieved version: int @dataclass class VerifiableCredential: issuer_did: str signing_key_id: str issuance_time: float expires_at: float def validate_cross_org_vc( vc: VerifiableCredential, cached_doc: DidDocument, resolve_fresh, # callable(did) -> DidDocument now: float | None = None, rotation_grace_window: float = 300.0, ) -> bool: now = time.time() if now is None else now if now >= vc.expires_at: return False # Case 1: cache postdates issuance -> cache is authoritative. if cached_doc.cached_at >= vc.issuance_time: if vc.signing_key_id not in cached_doc.key_ids: return False return True # Case 2: cache predates issuance -> ambiguous, must resolve fresh. age = now - cached_doc.cached_at if age > rotation_grace_window: # Stale beyond grace: cannot trust cache at all. try: fresh = resolve_fresh(vc.issuer_did) except Exception as exc: raise RotationLagFault( f"resolver unavailable for {vc.issuer_did}; " f"cannot confirm key currency" ) from exc if vc.signing_key_id not in fresh.key_ids: raise RotationLagFault( f"signing key {vc.signing_key_id} absent from fresh DID doc " f"v{fresh.version} for {vc.issuer_did}; key retired before " f"credential issuance window" ) return True # Within grace window but cache older than issuance: force fresh check. try: fresh = resolve_fresh(vc.issuer_did) except Exception as exc: raise RotationLagFault( f"resolver unavailable for {vc.issuer_did} inside grace window; " f"fail closed" ) from exc if vc.signing_key_id not in fresh.key_ids: raise RotationLagFault( f"rotation lag: {vc.signing_key_id} retired in DID doc " f"v{fresh.version} but cached v{cached_doc.version} still " f"authoritative; reject" ) return True ```