---
title: "The vault and recovery keys"
description: "Recovery key holders, unsealing a cluster after every node has stopped, changing the holders with a rekey, rotating the cluster's key, and what a node needs to keep keys out of swap and dumps."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.forge.workreef.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The vault and recovery keys

Every key the forge holds is sealed under one key, the cluster's, which lives only in the nodes' memory. [Keys and the vault](https://docs.forge.workreef.dev/concepts/keys/) explains why. This page is the operator's side: who holds recovery keys, what to do when every node has stopped, and how the holders and the key change over time.

## Recovery key holders

When every node has stopped at once, the cluster's key comes back from **recovery shares**: the first start splits it into one share for each holder, k of n needed to unseal, and seals each share to one holder's recovery key. Choose the holders and k before the first start; [Start a forge](https://docs.forge.workreef.dev/server/start/) gives them with `--recovery-key` and `--recovery-threshold`.

Each holder makes their key on their own machine. The private key stays there; the `.pub` file goes to the operator:

```console server
$ af-server --dev
...
```

```console check
$ source ~/af-dev/dev/env
$ af vault key
a9b1530b7b27e289584e426ce741137c2d28f8c86bfef32378090136461a9ed4 /home/you/.config/atoll-forge/recovery.key.pub
```

A recovery key is an X-Wing key, the hybrid of ML-KEM-768 and X25519, so a share sealed to it stays sealed while either of the two holds, even against a quantum computer.

A development forge has no holders: it keeps its key in a file beside its data, says so, and needs no unsealing.

```console check
$ af vault status
unsealed: its key is kept in a development file
```

## Unsealing

A node that starts while another member is running takes the cluster's key from that member, sealed to the node's own key, and serves. Each handover is recorded in the platform's log, naming the node that handed the key over and the one that took it. A node that starts when no member is running stays **sealed**: it answers only the vault's requests. Then k holders each, on their own machine:

```sh
af vault status    # sealed, and how many shares it has
af vault unseal    # open your share here and give it to the node
```

`af vault unseal` opens the holder's share with their recovery key on their machine, so the private key never reaches the forge. The node unseals once it has k shares; the rest of the cluster then takes the key from it as each node starts. `af vault unseal --reset` throws away the shares given so far and gives yours, to start again after a mistake.

## Changing the holders

A **rekey** changes who holds recovery keys and how many are needed, as HashiCorp Vault's `operator rekey` does. A platform administrator starts it, naming each new holder's `.pub` file and the new k; it prints a nonce. Then k of the *current* holders each give their share to it, which is how they agree:

```sh
af vault rekey start --holder ada.pub --holder bob.pub --holder dan.pub --threshold 2
af vault rekey give --nonce <NONCE>      # each current holder, on their machine
af vault rekey status
af vault rekey cancel --nonce <NONCE>
```

A development forge has no recovery rule, so it has nothing to rekey:

```console check
$ af vault rekey status
Error: InvalidState: this cluster keeps its key in a development file: it has no recovery rule to rekey
[1]
```

## Rotating the cluster's key

The cluster's key is the root of a keyring, as Vault's root key is of its barrier's. Each term of the keyring is a key of its own, and every other key is sealed under the latest term. A rotation adds a term: everything sealed from then on is sealed under it, and every earlier term still opens what it sealed. Nothing is sealed again under the new term. A platform administrator requests it, and another approves, unless there is only one:

```console check
$ af vault rotate --reason "yearly rotation"
done: it took effect at once, on your word as an administrator
$ af vault key-status
term 1: installed 2026-11-25T04:10:45.49Z, 5 keys sealed
term 2: installed 2026-11-25T04:10:45.85Z, 0 keys sealed, seals now
```

`af vault key-status` lists each term, when it was installed, and how many keys it has sealed: here, the five the forge sealed for itself as it started, under term 1. Each node counts its seals in memory and adds them to their terms every five minutes. The node that answers includes the seals it has not added yet, a replaced term's too, so only another node's newest seals can take up to five minutes to show. A term that has sealed 3,865,470,566 keys, Vault's limit, gives way to a new term on its own.

## Memory a node needs

A node keeps the cluster's key, every term of the keyring, and every organization key it opens in memory pages of their own, locked so they never reach swap, left out of core dumps, between guard pages, and wiped before they are released, as libsodium's `sodium_malloc` does. `af-server` also makes itself undumpable at start, so no other process of its user can read its memory.

Locking needs room under the process's limit of locked memory. A key whose pages cannot be locked is never made, and the node does not start. Give the service a locked-memory limit (in systemd, `LimitMEMLOCK=`), or the `CAP_IPC_LOCK` capability.

## Next

- [Keys and the vault](https://docs.forge.workreef.dev/concepts/keys/): the key hierarchy, and your organization's own keys.
- [`af vault`](https://docs.forge.workreef.dev/reference/af/vault/) in the reference.

Source: https://docs.forge.workreef.dev/server/vault/index.mdx
