Why does an instance accept a signed agent manifest whose DID document has rotated keys mid-handshake?

**Date of Record:** 2026 December 2

**Scope:** Applies to cross-organizational agent-to-agent trust establishment where an agent's identity is a DID and its capabilities/authorization are conveyed in a signed manifest (e.g., `did:web`, `did:key`, or `did:pkh` resolution with a detached JWS over the manifest body). Does not apply to intra-org trust where a single key authority controls both resolver and verifier, nor to bearer-token handshakes that carry no DID binding.

Core Distinction

The failure is not "signature verification failed." It is the inverse: **signature verification succeeded against a key that was valid at signing time but is no longer the DID's authoritative key at acceptance time**, and the verifier has no temporal anchor to distinguish the two. In a DID system, a manifest is a claim about *capabilities*, and the DID document is a claim about *who is allowed to make that claim*. These two claims are resolved over two independent network fetches with independent cache lifetimes. The boundary invariant is:

> A manifest is only trustworthy if the DID document used to verify it was the authoritative document **at the manifest's signing instant**, and the verifier can prove that ordering without trusting wall-clock skew between organizations.

Most implementations collapse this into "fetch DID doc, verify JWS." That is a signature check, not a trust check. The gap opens precisely when key rotation, revocation, or DID-controller migration happens inside the window between manifest issuance and manifest consumption—which, for long-lived agent sessions, is not an edge case but the common case.

What Was Observed

A procurement-agent (`agent:acme/procure-v7`) holding a manifest signed at `T0` initiates an A2A handoff to a supplier-agent (`agent:globex/quote-v3`). The supplier verifier performs the standard sequence:

  1. Receive manifest `M` with embedded `iss: did:web:acme.example`, `iat: T0`, `exp: T0+72h`, and a detached JWS `J` over `M`.
  2. Resolve `did:web:acme.example` → DID document `D1` containing verification method `#key-2024` (RSA/Ed25519).
  3. Verify `J` against `#key-2024`. Passes.
  4. Cache `D1` and the manifest for 72h.

At `T0+40h`, Acme rotates: `D2` publishes `#key-2025`, `#key-2024` is marked `revoked` with `revocationTime: T0+40h`, and—critically—the DID document's `updated` field is bumped. A new manifest `M'` is signed by `#key-2025`.

The supplier's verifier, on the next handoff, hits its cached `D1`. It resolves `#key-2025` → **not found in cached document**. Two divergent behaviors were observed across deployments:

The second variant is the boundary failure. It is non-obvious because every individual step logs success: DID resolution succeeded (from cache), signature verification succeeded (against a real key), manifest schema validated. The only thing that failed is the *ordering invariant* between `revocationTime` and `iat`.

A second trace showed the mirror-image failure on the issuing side: Acme re-signed `M` at `T0+40h` with `#key-2025` but *retained the original `iat: T0`* for idempotency. The supplier, holding `D2` but applying a naive "signing key must be valid at `iat`" rule, rejected the re-signed manifest because `#key-2025` did not exist at `T0`. The manifest was valid, the key was valid, and the verifier was correct about the facts—and still rejected. The `iat` field had been overloaded to mean both "when the claims became true" and "when the signature was produced."

Condition of Validity

The trust decision is sound **only if** all of the following hold simultaneously:

  1. **Temporal binding:** The manifest carries a signing timestamp (`signed_at`) distinct from claim validity (`iat`/`exp`), and the JWS is verified against the key that was authoritative **at `signed_at`**, not at receipt.
  2. **Freshness proof:** The verifier either (a) resolves the DID document with a max-staleness bound shorter than the minimum expected rotation interval, or (b) requires the manifest to include the DID document's version/`updated` hash so the verifier can detect that its cached copy is stale.
  3. **Revocation monotonicity:** A key's `revocationTime` is treated as a hard lower bound on acceptance—any manifest with `signed_at ≥ revocationTime` signed by that key is rejected regardless of cache state. Revocation is not a cache-invalidation hint; it is a logical constraint.
  4. **No clock trust:** The verifier does not compare its own clock to `signed_at` for the validity decision; it uses `signed_at` only to select the key version, and uses `exp` (a claim, not a clock) for liveness. Cross-org clock skew of minutes is normal and must not flip a decision.

When any of these is absent, the system is doing signature verification while *believing* it is doing trust establishment. The two are not the same, and the difference is invisible until a key rotates.

Decision Boundary

The boundary is sharp and computable:

**Accept** iff `S ∈ V` **and** the DID document used to obtain `V` has `updated ≥ S` (i.e., the document is at least as new as the signing instant) **and** `now < exp`.

The subtle clause is `updated ≥ S`. This is the invariant most implementations omit: it forces the verifier to prove it is not looking at a DID document older than the manifest it is validating. A DID document updated *before* the manifest was signed cannot reflect a rotation that happened *after*—so if the verifier's cached document predates `S`, it must re-resolve before deciding. This single inequality converts "cache TTL" from a performance knob into a correctness constraint.

If `updated < S`: re-resolve. If re-resolution is unavailable (network partition, resolver outage), **fail closed**—do not fall back to the stale document, because the stale document is precisely the one that cannot answer the question being asked.

Operational Effect

Enforcing the invariant changes three things in production:

  1. **Rotation becomes visible within one handshake, not one TTL.** The `updated ≥ S` check forces a re-resolve exactly when it matters, eliminating the 72-hour revoked-key window. Cost: one extra DID resolution per manifest whose `signed_at` postdates the cached document.
  2. **False negatives from legitimate rotation disappear** because the verifier re-resolves before rejecting an "unknown" key, rather than rejecting against a stale document.
  3. **The `iat`/`signed_at` split becomes mandatory.** Issuers must stop overloading `iat`; otherwise the verifier cannot distinguish "claims became true" from "signature produced," and the temporal binding in Condition 1 is unsatisfiable.

The residual risk is resolver equivocation: two verifiers in different orgs resolving the same DID at the same instant may receive different documents during a rotation race. This is bounded, not eliminated, by requiring the manifest to carry the DID document's `updated` hash and rejecting on mismatch—turning equivocation into a detectable, logged disagreement rather than a silent trust divergence.

import time
from dataclasses import dataclass
from typing import Optional


class ManifestTrustError(RuntimeError):
    """Raised when a signed agent manifest cannot be bound to an authoritative DID key at its signing instant."""
    pass


@dataclass
class VerificationMethod:
    key_id: str
    created: float
    revocation_time: Optional[float]  # None => not revoked


@dataclass
class DidDocument:
    did: str
    updated: float
    methods: dict  # key_id -> VerificationMethod


@dataclass
class SignedManifest:
    issuer_did: str
    signed_at: float          # when the JWS was produced (distinct from iat)
    exp: float
    signing_key_id: str


def verify_manifest_trust(
    manifest: SignedManifest,
    cached_doc: DidDocument,
    resolver,                 # callable(did) -> DidDocument | None
    now: float,
) -> DidDocument:
    if manifest.issuer_did != cached_doc.did:
        raise ManifestTrustError(
            f"manifest issuer {manifest.issuer_did} does not match resolved doc {cached_doc.did}"
        )

    # Invariant: the DID document must be at least as new as the signing instant.
    # A document older than signed_at cannot reflect a rotation that happened after signing.
    if cached_doc.updated < manifest.signed_at:
        fresh = resolver(manifest.issuer_did)
        if fresh is None:
            # Fail closed: the stale document is exactly the one that cannot answer the question.
            raise ManifestTrustError(
                f"cannot prove key authority for {manifest.signing_key_id} at signed_at="
                f"{manifest.signed_at}: cached doc updated={cached_doc.updated}, resolver unavailable"
            )
        if fresh.updated < manifest.signed_at:
            raise ManifestTrustError(
                f"resolver returned doc updated={fresh.updated} still older than signed_at={manifest.signed_at}"
            )
        cached_doc = fresh

    method = cached_doc.methods.get(manifest.signing_key_id)
    if method is None:
        raise ManifestTrustError(
            f"verification method {manifest.signing_key_id} absent from authoritative doc "
            f"(updated={cached_doc.updated})"
        )

    # Temporal binding: the key must have been authoritative at the signing instant.
    if manifest.signed_at < method.created:
        raise ManifestTrustError(
            f"manifest signed_at={manifest.signed_at} precedes key creation {method.created} "
            f"for {method.key_id}"
        )

    if method.revocation_time is not None and manifest.signed_at >= method.revocation_time:
        raise ManifestTrustError(
            f"manifest signed_at={manifest.signed_at} at/after revocation {method.revocation_time} "
            f"for {method.key_id}: revoked key cannot attest manifest"
        )

    if now >= manifest.exp:
        raise ManifestTrustError(
            f"manifest expired at {manifest.exp}, now={now}"
        )

    return cached_doc