Skip to content
Wallet and Entity Collection draft updates
Documentation menu

9.5. Publish, propagate, and switch federation keys

Feature guides / 9. Updates, rollover, and revocation

Publish a replacement while the current key still signs. Allow participants to obtain it before activation, then retain the previous public key for an overlap chosen from statement lifetimes and cache behavior. The host schedules each administrative step.

import type { RotatingKeyring, Signer } from "@oidfed/crypto";
import type { Leaf } from "@oidfed/leaf";

export function rollover(keyring: RotatingKeyring, leaf: Leaf) {
  return {
    async publish(replacement: Signer) {
      await keyring.publish("federation", replacement);
      return leaf.refreshEntityConfiguration();
    },
    async activate(kid: string) {
      await keyring.activate("federation", kid);
      return leaf.refreshEntityConfiguration();
    },
    async retire(previousKid: string) {
      await keyring.retire("federation", previousKid);
      return leaf.refreshEntityConfiguration();
    },
  };
}

These are separate operations. After publishing, inspect the externally served Entity Configuration and arrange any superior key-attestation updates. Activate only after the chosen propagation interval. Schedule retire(previousKid) through your application's durable scheduler after overlap. There is no automatic seven-day retirement; seven days can be an application policy.

Authority publications read current keyring state. Leaf publications stay cached until expiry or explicit refresh, so refresh them at each stage. A previously captured entry remains bound to its old signer and public-key snapshot.

MemoryRotatingKeyring records publication, activation, retirement and revocation in Unix seconds, including fractions. Its lifecycle clock must be finite and nondecreasing. Invalid transitions leave state unchanged. A key identifier cannot be reused after withdrawal. Repeated retirement or revocation preserves its first recorded result, including the first revocation reason.

Historical endpoint records become available after retirement or revocation when a history source is configured. They retain the earlier withdrawal cutoff if a compromise is discovered later. Key creation and validity-start timestamps require separately known facts.

If the active key is compromised, keyring.revoke("federation", kid, reason) stops future selection. A published replacement can restore signing through explicit activation. Backend revocation, remote caches, and emergency distribution remain the operator's responsibility.

See Federation §11.2 and the crypto migration guide.

Next: 9.6. Compare anchor keys with an independent source

View source on GitHub