# Which invariants prevent DID-key rotation from silently invalidating federated agent warrants mid-swarm **Date of Record:** 2026 November 29 **Scope:** Applies to cross-organization agent federations where an issuer signs a verifiable credential (VC) binding an agent DID to a capability warrant, and peer agents verify that warrant at tool-call time. Does not apply to single-org deployments with a shared trust root or to stateless one-shot RPC agents that never re-verify credentials. ## Core Distinction The failure is not "revoked credential still accepted." Revocation is a solved, observable event: the issuer publishes a status list entry and verifiers check it. The non-obvious failure is **key rotation without re-issuance**: an agent's DID document is updated to a new verification key (routine hygiene, or forced by key compromise), the old key is removed from `verificationMethod`, and every credential the agent previously *issued* or *was bound by* now fails signature verification against the current DID document — even though nothing about the agent's authority changed. The verifier cannot distinguish "this credential was forged with a retired key" from "this credential is valid but was signed before a legitimate rotation." Both present identically: `Ed25519 signature did not verify against any current verificationMethod`. The distinction that matters operationally: **DID document state is a moving target, but credential validity is evaluated against a frozen point in time.** A verifier that resolves the DID document at *verification time* and checks the signature against *current* keys has silently converted a continuity guarantee into a race condition. The invariant that prevents this is that verification must be anchored to the key state *at the credential's asserted issuance/signing time*, discoverable from the credential itself (via `proof.created` plus a versioned, append-only DID log), not to the live document. ## What Was Observed A three-org swarm: Org A (orchestrator agent `did:web:a.example:orch`), Org B (auditor agent `did:web:b.example:audit`), Org C (tool-executor agent `did:web:c.example:exec`). Org A issues capability warrants to B and C at swarm start, each a VC signed by `orch`'s key `K1`, asserting `canInvoke: exec.execute` valid for 30 minutes. At T+12min, Org A's key-management cron rotates `orch`'s signing key to `K2` (scheduled rotation, 90-day policy) and republishes the DID document with `K2` as the only active `verificationMethod`, `K1` demoted to a `revoked`-ish historical entry that most DID resolvers do not surface by default. At T+14min, auditor B re-verifies C's warrant before countersigning an execution receipt. B resolves `did:web:a.example:orch` fresh (cache TTL 60s, expired), gets the document with only `K2`, and attempts to verify the warrant's `proof` (signed by `K1`). Verification fails. B's policy on verification failure is fail-closed: it refuses to countersign and emits a `warrant_invalid` event. The swarm does not crash. It does something worse: it **diverges**. C, which cached the DID document before rotation and has not re-resolved, continues executing tool calls and self-attesting success. B refuses to countersign C's receipts. The orchestrator A, receiving B's `warrant_invalid` and C's success attestations for the same `task_id`, now holds two mutually contradictory records of the same execution. A's reconciliation logic treats B's refusal as a transient verification error and retries — three times, all failing, because the cause is structural, not transient. After retry exhaustion A marks the task `indeterminate` and halts the swarm, but C has already performed 40+ side-effecting tool calls that are now un-audited. The observed signature of this class: **verification outcomes for the same credential differ across agents purely as a function of DID-document cache age relative to rotation time.** Agents that resolved before rotation accept; agents that resolved after reject; the credential is byte-identical. ## Condition of Validity The invariant holds — and the failure is prevented — only when all three of the following are true: 1. **The credential carries its own key-resolution anchor.** The `proof` includes either a `verificationMethod` URL pinned to a specific key fragment (`did:web:a.example:orch#key-K1`) or a `created` timestamp that the issuer's DID log can be replayed against. Without this, the verifier has no way to ask "which key was valid when this was signed" — it can only ask "which key is valid now," which is the wrong question. 2. **The DID method provides an append-only, timestamped key history.** `did:web` does *not* by default — it is a mutable document at a fixed URL, and rotation overwrites history. Federations using `did:web` must either (a) publish versioned documents (`did:web:a.example:orch:v3`) and reference the version in the proof, or (b) use a method with an inherent log (`did:ion`, `did:webvh`, `did:keri`). This is the load-bearing condition. A federation on plain `did:web` *cannot* satisfy the invariant and must fall back to re-issuance-on-rotation. 3. **The verifier's trust policy distinguishes "signature invalid" from "signature valid against a superseded key."** These are different verdicts with different responses: the first is a hard rejection (possible forgery); the second is a soft acceptance with a staleness annotation (rotation happened, credential predates it, authority unchanged). Collapsing them into one boolean is the root defect. When any condition is absent, the correct posture is not "verify against current keys and hope" — it is to require that rotation events trigger explicit re-issuance of all live warrants, and to treat any credential whose signing key is no longer current as *requiring re-issuance before next use*, not as invalid. ## Decision Boundary The boundary is drawn at **the moment a verifier resolves the DID document, not the moment it checks the signature.** Concretely: - If `proof.created` ≤ the DID document's `updated` timestamp *and* the signing key is still listed (even as historical), verify against that key and accept with a `superseded_key` annotation. The credential was validly issued; the issuer's key rotated afterward; authority is continuous. - If `proof.created` > the DID document's `updated` timestamp and the signing key is not listed, reject — this is either forgery or a credential signed by a key that was never published. No continuity argument applies. - If the DID method cannot supply a timestamped key history, the verifier *must not* attempt temporal reasoning at all. It must reject any credential whose signing key is not currently active, and the federation must guarantee that rotation is preceded by re-issuance of all live warrants within the rotation window. This is the degraded-but-safe mode. The failure mode this boundary prevents is the **cache-age race**: two verifiers reaching different verdicts on the same credential because they resolved the DID document at different points relative to rotation. Anchoring to `proof.created` against an append-only log makes the verdict a pure function of (credential, log), independent of when the verifier looked. That independence is the invariant. ## Operational Effect With the invariant enforced, key rotation becomes a non-event for in-flight swarms: warrants issued before rotation continue to verify against the historical key, annotated as `superseded_key`, and the auditor's countersignature carries a `rotation_continuity: verified` field that the orchestrator can use to distinguish "B refused because forgery" from "B refused because it saw a rotation." The reconciliation logic no longer has to guess whether a `warrant_invalid` is transient or structural — the annotation makes it structural and self-describing. Without it, the failure is silent and asymmetric: the swarm does not fail loudly, it fails *divergently*, with some agents accepting and some rejecting the same authority, producing contradictory audit records and un-audited side effects. The blast radius is proportional to the DID-document cache TTL times the tool-call rate — a longer cache means more agents on the stale side, executing un-audited longer. The guardrail is to make the key-resolution anchor part of the credential schema itself and to reject at issuance time any credential that lacks it, so the verifier never has to make the temporal judgment from incomplete data. Rotation policy and credential schema are coupled; a federation that treats them as independent subsystems will discover this coupling at the worst possible moment. ```python from dataclasses import dataclass from datetime import datetime, timezone class WarrantVerificationError(RuntimeError): """Raised when a federated warrant cannot be verified under the continuity invariant.""" @dataclass(frozen=True) class DidKeyEntry: key_id: str active_from: datetime active_until: datetime | None # None = still active @dataclass(frozen=True) class DidLog: """Append-only key history. did:web without versioning cannot supply this.""" did: str entries: tuple[DidKeyEntry, ...] def key_valid_at(self, key_id: str, when: datetime) -> bool: for e in self.entries: if e.key_id != key_id: continue if e.active_from <= when and (e.active_until is None or when < e.active_until): return True return False @dataclass(frozen=True) class Warrant: issuer_did: str signing_key_id: str proof_created: datetime signature: bytes def verify_warrant(warrant: Warrant, log: DidLog, now: datetime) -> dict: if log.did != warrant.issuer_did: raise WarrantVerificationError( f"DID log for {log.did} does not match warrant issuer {warrant.issuer_did}" ) if warrant.proof_created > now: raise WarrantVerificationError( f"Warrant proof_created {warrant.proof_created} is in the future" ) # Anchor to signing time, not verification time. This is the invariant. if not log.key_valid_at(warrant.signing_key_id, warrant.proof_created): raise WarrantVerificationError( f"Key {warrant.signing_key_id} was not valid at proof_created " f"{warrant.proof_created}; possible forgery or pre-dates published history" ) # Signature check would go here against the historical key material. currently_active = log.key_valid_at(warrant.signing_key_id, now) return { "verdict": "accept", "rotation_continuity": "current_key" if currently_active else "superseded_key", "anchored_at": warrant.proof_created.isoformat(), } def verify_or_reissue_required(warrant: Warrant, log: DidLog | None, now: datetime) -> dict: """Degraded mode: no append-only log available (plain did:web).""" if log is None: # Cannot reason temporally. Only currently-active keys are acceptable. raise WarrantVerificationError( "No append-only DID log available; cannot verify historical key validity. " "Federation must re-issue warrants on rotation before next use." ) return verify_warrant(warrant, log, now) ```