Rotate a leaked key

Rotate a leaked key

Rotating gives your identity a new keypair and retires the old one. What the old key signed stays signed. What changes is who still accepts its writes.

Rotate when a private key may have leaked: a lost laptop, a .loot/id in a backup you do not control, a repo directory synced somewhere. Identity and keys explains the keypair itself.

On a forge: retire it on the account

A forge accepts writes from your account’s live keys, so on a forge, rotation is an account act. Being signed in authorizes it, which a leaker holding only the key cannot do. loot id rotate does not touch the account, so in a repo with a forge remote it refuses and names the account page: a key it minted would be one the forge has never seen, and every push would be refused.

  1. Open the account page on the forge (forge.loot.build/account for loot’s own) and choose Start a rotation. The browser generates a key, shows its 24 words once, and asks for a passphrase to lock the copy the forge keeps. Rotate: add this key, retire the rest retires every current live key in the same step.
  2. To retire one key and keep the others, use Retire… on its row. The forge refuses to retire an account’s last live key, and there is no un-retire.
  3. In each repo on each machine, run loot login. It unlocks the new key with its passphrase, makes it the repo’s, and keeps the previous key at .loot/id.rotated-<time>. Run outside a repo, it replaces this machine’s key.
loot login
loot whoami --pubkey    # should print the new key

A repo with a custody passphrase refuses, because a new key would strand the keyring sealed to the old one: run loot id unlock --permanent, then loot login, then loot id lock.

A keyed account, one opened with loot account open, has no page to sign in to. Its live key rotates it from a shell in one act: loot account rotate mints the key, retires this one and re-keys the repo, and loot login in another repo on the machine then takes the new key. Use the hosted forge from a shell has the rest.

Relay only: loot id rotate

loot id rotate ../regrants
loot whoami --pubkey

This mints a keypair, archives the old one at .loot/id.rotated-<time> and .loot/id.pub.rotated-<time> (copy both back over .loot/id and .loot/id.pub to roll back), and writes a regrant-<id>.bundle for each unexpired grant made to you, into the directory you name or .loot/grants/, never inside the working tree. Move the new key to your other machines as in Work on a second machine, then loot apply each bundle there. A bundle is the access, so carry it like a key. A custody-locked repo refuses, with the same unlock, rotate, lock order as above.

Either way, each peer registers your new key, and you push:

loot peer add alice "ssh-ed25519 AAAA..."   # on each peer's machine
loot push

What stays and what stops

ThingAfter the rotation
Changes the old key signedStay signed by it. Nothing re-signs history. loot log shows them under the old key until you add the two .loot/mailmap lines loot id rotate prints, which only group the display, in this repo.
Content keys you already holdStill open: your keyring holds content keys, not your identity key.
Grants sealed to the old keyOpen only with the old key, and the archived key still opens them. Your next push deposits fresh standing self-grants to the new key.
Forge writes by a retired keyPushes, proposals and burns are refused. It can still withdraw a proposal it authored and revoke a grant it made, since no other key can. Retired keys stay listed, so links and history resolve.
RelaysNever consult retirement. The old key pushes to any relay that lists it, and the new one is refused, until the operator swaps the key in --allow.
PeersQuarantine your grants and burn requests until they register the new key.

If the key leaked

Retirement stops the old key’s writes, and on a forge its reads of your repos too. It does not take back what the key already pulled, it doesn’t reach a relay that still lists the key, and it doesn’t unseal anything: a leaked old key still opens everything sealed to it, including the standing self-grants a relay keeps for it. Treat what it could open as read: change any secret in it, and burn a leaked one with loot burn. Once you no longer need the rollback, move the archived key offline.