DEV Community

johnettwawers
johnettwawers

Posted on

DID key rotation: verify the controller history, not the latest key alone

DID key rotation: verify the controller history, not the latest key alone

Decentralized identifiers bind a stable identifier to a controller document. The document can change. Keys can be added, deactivated, or replaced, and the controller relationship can evolve. A verifier that fetches the latest document and checks one key may be verifying the present while misunderstanding what a signature meant at an earlier point.

The W3C DID Core specification describes rotation as a process for adding a new verification method and deactivating or destroying the old private material. It also distinguishes the identifier from the document that describes its current verification methods. The first verification question is therefore not "does this key exist?" It is "was this method controlled by the expected DID for the relevant purpose and time?"

That requires a controller-history policy. For an authentication proof, the verifier may need a recent method and a fresh challenge. For a historical attestation, the verifier may need the method and controller relation that existed when the proof was created. Deactivation can stop future use, but teams should not assume it mechanically invalidates every earlier signature unless their policy says so. The source material also notes that changes to a DID document do not retroactively alter previous versions in arbitrary ways.

A practical verifier should dereference the DID, inspect the controller and verification relationships, and check whether the method is active for the intended purpose. It should cache with explicit version and freshness semantics. A cached document that has not observed a rotation is a security risk for new authentication, while an uncached historical document can be unavailable during an incident. The availability plan is part of the trust model.

Do not let a proof select an arbitrary verification method that the controller never authorized for that purpose. Prevent method-ID fragment confusion, validate the DID syntax before resolution, and reject a document marked deactivated. If the method is controlled by a separate controller, confirm the chain rather than assuming that any resolvable DID document is authoritative for the subject.

Operational checks can use four fixtures: a current valid key, a rotated old key, a deactivated key, and a key controlled by the wrong entity. Add a time boundary where the proof was created before rotation and a second where it was created after. Record the intended result for each case. This catches the common error where tests only exercise a fresh key.

Finally, log the policy outcome without logging the full DID document or private-adjacent metadata. A reason such as method_not_in_assertion_relationship is actionable; a generic signature failure is not. DID rotation is a governance process as much as a cryptographic one, so the verifier needs a documented rule for the transition.

References

Top comments (0)