# Which invariants prevent DID-anchored AAIF credentials from silently re-authorizing a rotated agent key **Date of Record:** 2026 November 28 **Scope:** Applies to AAIF deployments where an agent's authorization is expressed as a verifiable credential (VC) whose `credentialSubject.id` is a DID, and where the DID document's verification method can rotate independently of the VC's issuance. Does not cover symmetric-key session tokens or credentials bound to a non-rotatable subject identifier. ## Core Distinction The boundary that matters is not "is the signature valid" but "is the *binding* between credential and controller still valid at evaluation time." A DID-anchored VC is signed by an issuer over a subject DID string. Verification of the VC signature proves the issuer approved *a DID*, not *a key*. The DID document resolves that DID to a `verificationMethod` at a point in time. When the subject agent rotates its key — routine hygiene, suspected compromise, or a re-provisioned sandbox — the DID string is unchanged, the VC bytes are unchanged, and the issuer's signature still verifies. Nothing in the naive verification path observes that the key the credential was *meant* to authorize has been retired. This is the silent re-authorization boundary: a credential issued for controller key `K1` continues to pass verification against controller key `K2` after rotation, because the verifier checks *issuer-signature-over-DID* and *DID-resolves-to-some-key* as two independent facts, never the joint fact *issuer-signature-over-the-key-that-was-current-at-issuance*. ## What Was Observed A credential `C` was issued at `t0` with `credentialSubject.id = did:agent:7f3a…` and, per AAIF profile, a `credentialSubject.publicKeyMultibase` echoing the controller key `K1` current at issuance. At `t1` the agent's DID document was updated: `K1` deactivated, `K2` added, `updated` timestamp bumped. The DID document retained `K1` in `verificationMethod` but moved it to a `revoked`/`deactivated` state per the controller's rotation policy. At `t2` a relying party (a tool-gateway authorizer) evaluated `C`: 1. Resolved `did:agent:7f3a…` → DID document at `t2`. Found `K2` as the active authentication key. 2. Verified `C.signature` against the *issuer's* key. Passed. 3. Verified `credentialSubject.id` matched the resolved DID. Passed. 4. **Did not** compare `C.credentialSubject.publicKeyMultibase` (`K1`) against the DID document's active key (`K2`), nor check whether `K1` was deactivated. 5. Granted the tool call. The failure is a *binding drift*: the credential was a statement about `K1`, the runtime authorized `K2`, and step 3's string equality on the DID masked the divergence. In the incident, `K1` had been rotated precisely because it was suspected compromised; the stale credential re-authorized the new key under the old approval, so the compromise-driven rotation did not actually revoke the agent's authority. A second, subtler trace: two agents sharing a DID (a delegation pattern where a parent DID issues a `capabilityInvocation` sub-key) both resolved to the same DID document. The credential's `publicKeyMultibase` disambiguated which sub-key was authorized, but the verifier ignored it and resolved "the DID's key," which returned the parent's `authentication` key. The child agent's credential authorized the parent's key — an authority escalation across the delegation boundary. ## Condition of Validity The invariant that must hold is a *three-way equality at issuance time, re-checked at evaluation time*: ``` C.issuer_signature verifies over (C.credentialSubject.id, C.credentialSubject.publicKeyMultibase, C.issuance_time) AND resolve(C.credentialSubject.id, at = C.issuance_time).active_key == C.credentialSubject.publicKeyMultibase AND resolve(C.credentialSubject.id, at = now).key_status(C.credentialSubject.publicKeyMultibase) == ACTIVE ``` The middle conjunct is the one naive verifiers drop: it pins the credential to the key that was current *when the issuer signed*, not the key current *when the verifier checks*. The third conjunct is the rotation-safety gate: if the pinned key has since been deactivated, the credential is *stale*, not *valid-for-the-new-key*. Both must be evaluated against a DID document that supports historical resolution (a versioned or `updated`-timestamped log); a resolver that only returns "current state" cannot satisfy the middle conjunct and must be treated as unable to validate AAIF credentials at all. This condition is valid only when the DID method provides (a) monotonic versioning of verification methods and (b) deactivation semantics distinguishable from deletion. Methods that overwrite the document in place without history, or that treat "removed from document" as equivalent to "never existed," cannot support the invariant and must fail closed. ## Decision Boundary The decision boundary is between *re-binding* and *rejecting*. When the pinned key `K1` is no longer active: - If the DID document records `K1` as `deactivated` and the credential carries no `keyRotationProof` (an issuer-signed statement that the credential's subject key may be superseded by a named successor), the verifier MUST reject. Rotation without a rotation proof is a revocation event for every credential pinned to the retired key. - If the credential carries a valid `keyRotationProof` chaining `K1 → K2` and signed by the issuer, the verifier MAY re-bind to `K2` — but only if the proof's `notAfter` is within the credential's validity window and the issuer is the same entity that signed `C`. An issuer cannot unilaterally re-bind a credential it did not issue. - If the resolver cannot produce historical state for `C.issuance_time`, the verifier MUST reject with an explicit "unresolvable-at-issuance" error rather than fall back to current-state resolution. Silent fallback is the exact mechanism of the observed failure. The boundary is sharp because the two failure modes are asymmetric in cost: a false reject blocks a legitimate agent (annoying, recoverable); a false accept re-authorizes a compromised key (unrecoverable, and undetectable after the fact because every log line shows "signature valid"). ## Operational Effect The observable consequence is that key rotation in AAIF is *not* a revocation primitive unless the verifier enforces the issuance-time binding. Operators who rotate a suspected-compromised key and observe "credential still verifies" have not revoked anything — they have merely changed which key the stale credential now authorizes. The correct operational posture is to treat every credential as pinned to its issuance-time key and to require an explicit rotation proof (or re-issuance) to move the pin. Audit logs must record the *resolved key at issuance* alongside the *resolved key at evaluation*; the diff between them is the only reliable signal that a re-authorization occurred. A secondary effect: delegation chains that share a DID must carry the sub-key in `publicKeyMultibase` and verifiers must resolve *that key's* status, not the DID's default `authentication` key. Collapsing the two is how a child credential silently authorizes a parent key. ```python from dataclasses import dataclass from typing import Optional class BindingDriftError(RuntimeError): """Raised when a credential's issuance-time key binding no longer matches the DID document state at evaluation time, with no valid rotation proof.""" pass @dataclass class Credential: subject_did: str public_key_multibase: str # key pinned at issuance issuance_time: int issuer_signature_valid: bool key_rotation_proof: Optional[str] # issuer-signed K1 -> K2 chain, or None @dataclass class DidDocument: did: str active_key: str deactivated_keys: set[str] updated_at: int history_available: bool # can we resolve at arbitrary past time? def authorize(cred: Credential, doc: DidDocument, now: int) -> bool: if not cred.issuer_signature_valid: raise BindingDriftError("issuer signature invalid; cannot proceed") if cred.subject_did != doc.did: raise BindingDriftError( f"credential subject {cred.subject_did!r} != resolved DID {doc.did!r}" ) # Invariant: credential must be pinned to a key that was active at issuance. if not doc.history_available: raise BindingDriftError( f"cannot resolve {doc.did!r} at issuance_time={cred.issuance_time}; " "refusing current-state fallback" ) if cred.public_key_multibase not in (doc.active_key | doc.deactivated_keys): raise BindingDriftError( f"pinned key {cred.public_key_multibase!r} never existed in DID document" ) pinned = cred.public_key_multibase if pinned == doc.active_key: return True # no rotation since issuance; binding intact # Pinned key has been retired. Re-binding requires an issuer-signed proof. if pinned in doc.deactivated_keys: if cred.key_rotation_proof is None: raise BindingDriftError( f"key {pinned!r} deactivated at t={doc.updated_at}; credential has no " f"rotation proof, so it is revoked, not re-bound to {doc.active_key!r}" ) # Proof present: re-bind only if it chains to the currently active key. if doc.active_key not in cred.key_rotation_proof: raise BindingDriftError( f"rotation proof does not chain {pinned!r} -> {doc.active_key!r}" ) return True raise BindingDriftError(f"unhandled key state for {pinned!r}") ```