# How should an instance validate a peer agent's DID document when the federation trust anchor rotates mid-handoff **Date of Record:** 2026 November 29 **Scope:** Applies to federated multi-agent systems where agent identity is anchored in a DID document whose verification method set is governed by an external trust anchor (a federation root or org-level controller key) that can rotate. Does not apply to single-org deployments with a static, self-signed key set, nor to purely symmetric shared-secret handoffs. ## Core Distinction The failure we care about is not "the signature is invalid." It is the case where the signature is *valid*, the DID document is *authentic*, and the peer is *legitimate* — but the instance validates the peer against a trust anchor that has already been superseded, or against a cached DID document whose verification methods were retired between the moment the handoff token was minted and the moment it was verified. The distinction that matters operationally: **DID resolution returns a document that is correct-as-of-resolution-time, not correct-as-of-signing-time.** An agent that treats `resolve(did) → verify(sig)` as an atomic invariant will accept a warrant signed by a key that the federation has since revoked, provided the revocation has not yet propagated to its resolver cache. The invariant that actually holds is the reverse: a warrant is valid only if the verification method it names was *authorized by the controlling trust anchor at the warrant's issuance epoch*, and that anchor was itself valid at that epoch. Two epochs, two anchors, and they must be reconciled — not collapsed into one lookup. ## What Was Observed A two-org federation: Org A (issuer) runs an orchestrator agent that delegates a subtask to Org B (executor) via an A2A handoff carrying a signed capability warrant. Identity is DID-based; each org publishes a DID document under its own method, and the federation root key (held by a rotating council) signs each org's controller key. The orchestrator mints a warrant naming `did:fed:orgB:executor#key-2`, signs with its own key, and transmits. The council rotates the federation root at T0. Org B, under normal key-hygiene policy, retires `#key-2` and publishes `#key-3` at T0+90s, signed by the new root. The orchestrator's resolver has a 10-minute TTL cache and does not re-resolve. It receives the warrant at T0+120s, resolves Org B's DID document from cache (still showing `#key-2` as active), verifies the peer's counter-attestation against `#key-2`, and admits the handoff. The counter-attestation was in fact signed by `#key-2` at T0+30s — *before* retirement — so the signature is cryptographically intact. But the executor agent that produced it was already scheduled for termination; the admission decision routed work to an instance whose key material was about to be zeroized. The next tool call from the orchestrator to the executor returned a transport-level success (the connection was still warm) followed by silent task abandonment. No error surfaced at the federation layer. The orchestrator's own verifier reported `warrant_valid=true` throughout. The trace, condensed: 1. `T0` — root rotates. New root `R2` supersedes `R1`. 2. `T0+30s` — executor signs attestation with `#key-2` (still authorized under `R1`). 3. `T0+90s` — Org B publishes DID doc v2: `#key-2` marked `deactivated`, `#key-3` added, doc signed by `R2`. 4. `T0+120s` — orchestrator verifies attestation. Cache serves DID doc v1 (signed by `R1`). Verification passes against `#key-2`. 5. `T0+180s` — executor's key material destroyed. Orchestrator's in-flight task has no live peer. 6. `T0+600s` — cache TTL expires; orchestrator re-resolves, sees `#key-2` deactivated, and *retroactively* marks the completed handoff as a trust violation, corrupting its audit log. The non-obvious part is step 6: the late re-resolution does not just fail to prevent the bad admission, it *rewrites history*. The audit record now says a warrant was accepted against a deactivated key, which is true at verification time but false at issuance time. The instance has manufactured a false positive in its own compliance ledger. ## Condition of Validity The guardrail is a **dual-epoch verification** requirement, and it is only meaningful under a specific condition: the DID document must carry, for each verification method, a `deactivated` timestamp and a `controller` pointer, and the trust anchor must publish a monotonic epoch counter. Without an epoch counter on the anchor, you cannot distinguish "this key was valid when signed" from "this key happens to still be in my cache." The condition of validity is: > A warrant `W` signed by `did:D#k` at claimed issuance time `t_i` is admissible iff there exists a trust-anchor epoch `E` such that (a) `E` was the active anchor at `t_i`, (b) `D`'s controller was authorized under `E`, (c) `k` was listed as an active verification method in `D`'s document as of `E`, and (d) `k`'s `deactivated` timestamp, if present, is strictly greater than `t_i`. Note what this forbids: it forbids using the *current* anchor to validate a *past* signature, and it forbids using the *current* DID document to validate a *past* signature. Both are the natural, wrong implementations. The correct implementation must resolve the DID document *as of epoch E*, which in practice means the resolver must retain historical document versions keyed by anchor epoch — a requirement almost no off-the-shelf DID resolver satisfies, because resolvers are built for "what is true now," not "what was true then." If the resolver cannot serve historical versions, the instance must fall back to refusing the handoff whenever `t_i` precedes the most recent anchor rotation by less than the cache TTL plus clock skew. That is a conservative refusal, and it is the correct default. An instance that cannot prove issuance-epoch validity must not admit the warrant — it must renegotiate the handoff with a fresh attestation signed under the current epoch. ## Decision Boundary The boundary between "admit" and "renegotiate" is drawn at the point where the instance can no longer bound the skew between the attestation's claimed `t_i` and the anchor's rotation history. Concretely: - If `t_i` is within the current anchor epoch and the DID document version served by the resolver is signed by that same anchor, admit. Single-epoch, no ambiguity. - If `t_i` falls in a *prior* anchor epoch, the instance must obtain the historical DID document version signed by that prior anchor. If it can, admit per the dual-epoch rule. If it cannot, renegotiate. - If `t_i` is within the current epoch but the resolver's document is signed by a *prior* anchor (cache staleness), the instance is in an inconsistent state and must renegotiate — do not "upgrade" the cached document silently, because the peer may have signed under assumptions that the upgrade invalidates. - If the peer's `deactivated` timestamp for the signing key is *earlier* than `t_i`, reject outright: the peer signed with a key it had already retired, which is either a replay or a compromised instance. The last case is the one that catches replay attacks across rotations: an adversary who captured a `#key-2` signature from before retirement cannot replay it after retirement, because `deactivated < t_i` fails the dual-epoch check. But an adversary who captures it *during* the window between retirement and cache expiry — the T0+90s to T0+600s window above — can replay it, because the receiving instance's cache still shows the key as active. This is why the decision boundary must be enforced against the *anchor's* epoch counter, not the resolver's cache state. The cache is an optimization; the epoch counter is the ground truth. ## Operational Effect The operational consequence of getting this wrong is not a security breach in the classic sense — it is a **continuity failure disguised as a trust success**. The orchestrator admits a handoff to an executor that is about to disappear, the transport reports success, the task is silently abandoned, and the audit log is later rewritten to flag the (correctly issued) warrant as a violation. Three failure modes compound: state loss (the abandoned task), false-positive compliance signal (the rewritten ledger), and a poisoned trust cache (the orchestrator now distrusts a peer that behaved correctly). The correct architecture enforces three invariants: 1. **Epoch-pinned verification.** Every warrant carries the anchor epoch under which it was issued; verification resolves the DID document at that epoch, not at wall-clock now. 2. **Monotonic anchor ledger.** The federation root maintains an append-only, signed epoch log; instances sync against it and refuse warrants whose claimed epoch is not in the log. 3. **Deactivation-before-issuance rejection.** Any signature whose `t_i` precedes the signing key's `deactivated` timestamp is rejected without further resolution — this is the replay guard. An instance that cannot satisfy all three must treat the handoff as unverified and renegotiate. The cost of renegotiation is one round-trip; the cost of admitting a stale-epoch warrant is a silently lost task and a corrupted audit trail. ```python from dataclasses import dataclass from typing import Optional class FederationTrustError(RuntimeError): """Raised when a peer warrant cannot be validated under the active trust anchor epoch.""" pass @dataclass(frozen=True) class VerificationMethod: did_fragment: str # e.g. "#key-2" deactivated_at: Optional[float] # unix ts, None if still active @dataclass(frozen=True) class DIDDocumentVersion: did: str anchor_epoch: int # federation root epoch that signed this version methods: dict # fragment -> VerificationMethod @dataclass(frozen=True) class Warrant: issuer: str # did of signing agent signing_fragment: str # e.g. "#key-2" issued_at: float # claimed t_i, unix ts claimed_epoch: int # anchor epoch the issuer believes was active at t_i @dataclass(frozen=True) class AnchorLedger: active_epoch: int epoch_start_ts: dict # epoch -> unix ts at which it became active def validate_warrant( warrant: Warrant, resolver, ledger: AnchorLedger, clock_skew_tolerance: float = 30.0, ) -> bool: """ Dual-epoch verification. Resolves the DID document at the warrant's claimed epoch, not at wall-clock now. Refuses if the epoch is unknown or if the signing key was deactivated before issuance. """ # 1. The claimed epoch must exist in the monotonic anchor ledger. if warrant.claimed_epoch not in ledger.epoch_start_ts: raise FederationTrustError( f"warrant claims anchor epoch {warrant.claimed_epoch}, " f"not present in ledger (active={ledger.active_epoch})" ) # 2. Issuance must fall within the claimed epoch's window. epoch_start = ledger.epoch_start_ts[warrant.claimed_epoch] next_epoch_start = ledger.epoch_start_ts.get( warrant.claimed_epoch + 1, float("inf") ) if not (epoch_start - clock_skew_tolerance <= warrant.issued_at < next_epoch_start + clock_skew_tolerance): raise FederationTrustError( f"warrant issued_at={warrant.issued_at} outside epoch " f"{warrant.claimed_epoch} window [{epoch_start}, {next_epoch_start})" ) # 3. Resolve the DID document as of the claimed epoch. doc: Optional[DIDDocumentVersion] = resolver.resolve_at_epoch( warrant.issuer, warrant.claimed_epoch ) if doc is None: raise FederationTrustError( f"no DID document for {warrant.issuer} at epoch {warrant.claimed_epoch}; " f"renegotiate handoff with fresh attestation" ) # 4. The document must be signed by the anchor of the claimed epoch. if doc.anchor_epoch != warrant.claimed_epoch: raise FederationTrustError( f"DID document for {warrant.issuer} is signed by epoch " f"{doc.anchor_epoch}, warrant claims {warrant.claimed_epoch}" ) # 5. The signing verification method must exist in that version. vm = doc.methods.get(warrant.signing_fragment) if vm is None: raise FederationTrustError( f"verification method {warrant.signing_fragment} absent from " f"{warrant.issuer} document at epoch {warrant.claimed_epoch}" ) # 6. Replay guard: key must not have been deactivated before issuance. if vm.deactivated_at is not None and vm.deactivated_at <= warrant.issued_at: raise FederationTrustError( f"replay: {warrant.issuer}{warrant.signing_fragment} deactivated at " f"{vm.deactivated_at} but warrant claims issuance at {warrant.issued_at}" ) return True ```