Skip to content
Secrets StoreMarkdown

Key rotation

Add a new version of the realm's secrets key; each secret in the realm's vault moves onto it at its next write, and nothing stops opening.

Available, with limitsAPI

Rotating a key replaces it for everything written from then on, while everything written before still opens. A realm administrator rotates the realm’s secrets key, which seals the realm’s own vault, whenever their key policy asks for it. A user’s own key is replaced for them after a nominee opens their vault through emergency access.

What’s missing today: a secret moves onto the new version only when it is next written. There is no call yet that moves every secret at once, and no way yet to list which secrets are still under an older version.

  • Who: a realm administrator holding RealmOwner in this realm or in a realm above it. See Delegated administration.
  • Where: the API. There are no screens yet.
  • First: the store is on, and the realm has its secrets key.

Rotating the realm’s secrets key adds a new version of it. From then on every write to the realm’s vault seals under the newest version, and each secret written after the rotation is sealed again whole, every version it holds, so one write moves a secret onto the new key. A secret not written since stays under the older version, which still opens it.

A user’s key is rotated by the store itself: after a nominee opens the user’s vault through emergency access, the user’s next access makes a new version of their key and seals every grant’s copy again. There is no call to rotate a user’s or a group’s key by hand.

As a realm administrator (Call the API shows how to get $CVYUH_SESSION):

Terminal window
curl -X PUT https://foobar.cvyuh.com/api/v0/am/keys/v1/secrets/encryption \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{}'

The realm answers 200 with the new version. To move one secret onto it now, a realm administrator writes it again.

Nothing. Reads and writes go on as before; a secret written before the rotation opens under its older version.

AnswerWhenWhat to do
403The caller isn’t a realm administrator of this realm or a realm aboveAsk someone holding RealmOwner
401No session, or it has endedSign in again
LimitValue
Rotation schedulenone; you rotate when your policy asks
Versions keptevery version, until the key is destroyed whole
Withdrawing one versionnot possible; see Crypto-shredding
SymptomCauseFix
You need every secret off the older versionSecrets move only at their next writeWrite each secret in the realm’s vault again; list them with GET …/realm/metadata?list=true
You can’t tell which secrets have movedNo answer shows a secret’s key version yetWrite every secret again after a rotation, so all are known to be on the newest version

A rotation of the realm’s secrets key isn’t on the realm’s audit trail yet. Keep your own record of when you rotate. A secret written again after a rotation is a change record on the secret, as any write is. See Secrets audit trail.

  • Nothing stops opening. A value sealed under an older version still opens by that version.
  • Paths don’t move. Where a secret is found doesn’t depend on the key version, so a rotation never loses a path.
  • No single version is withdrawn. The realm’s secrets key is kept whole or destroyed whole.
  • Users’ and groups’ vaults aren’t touched. They are under their own keys.

One call that seals every secret in the realm’s vault again under the newest version: see What’s next for keys and protection.