AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.2.0-beta.10). Features may change before the next stable release.Switch to stable →

sync

ak secrets sync recover

Restore the vault on this device with the vault password or recovery key

Use ak secrets sync recover for the operation described below. The command help records its arguments, effects, and options.

Command contract

Restore the vault on this device with the vault password or recovery key

Synopsis

Restore the vault on a fresh device with the vault password or recovery key, remove lost devices, rotate the vault key and issue a new recovery key. Revoke your other ak-web sessions first. The vault comes from --recovery-kit or --vault-id; its origin must be this environment's vault origin. --use recovery-key opens the vault with the recovery key (from --recovery-key-file, the kit, or a prompt) and then needs a new password. Every other device is removed unless --remove-others=false or --keep names it. Run again after it stopped to resume. A bundle behind the vault key is refused: finish the stopped removal with ak secrets devices remove --resume on a device that still syncs, then recover again. Needs an email sign-in; an API-key sign-in asks for an emailed code in a terminal. Refused when an AI agent runs it.

Effects: Creates this device's keys, enrolls it with the recovery signing key, downloads and applies the vault to the local store, removes the other devices, rotates the vault key and the recovery key, and uploads a resealed recovery bundle. The new kit is shown once on the terminal (stderr), or written only to --recovery-kit-out with mode 0600, before it is used.

Exit status: 0 vault recovered 1 wrong password or recovery key, a recovery bundle behind the vault key, or the server refused 2 invalid invocation, a malformed kit or key, another vault origin, no kit destination, or no confirmation 3 the vault or its recovery bundle does not exist 4 sync is already enabled on this device, or the kit file exists 5 local storage failure 6 refused: an AI agent is running this command 7 the file-backend passphrase is unavailable 11 the vault server is unavailable or busy; run again to resume 12 recovered, but something needs attention 13 integrity alarm: the vault failed verification 14 not logged in, or the session cannot mint vault tokens

ak secrets sync recover [flags]

Examples

  ak secrets sync recover --recovery-kit ./vault-recovery-kit.txt --recovery-kit-out ./new-kit.txt
  ak secrets sync recover --recovery-kit ./kit.txt --use recovery-key --new-password-file ./pw.txt --recovery-kit-out ./new-kit.txt --yes

Options

      --backend string             Storage backend: keychain (default), file (age-encrypted vault), or memory (dev/test; values and its index are throwaway)
  -h, --help                       help for recover
      --json                       Emit machine-readable JSON (implies --no-interactive)
      --keep stringArray           A device ID to keep when removing the others (repeatable)
      --new-password-file string   Read a new vault password from this file, or - for stdin; required with --use recovery-key (default: prompt twice)
      --no-interactive             Disable interactive prompts (CI-safe)
      --password-file string       With --use password, read the vault password from this file, or - for stdin (default: hidden prompt)
  -q, --quiet                      Suppress non-error output on stderr
      --recovery-key-file string   With --use recovery-key, read the recovery key from this file, or - for stdin (default: the kit, else a prompt)
      --recovery-kit string        The recovery kit file, which names the vault and holds the recovery key
      --recovery-kit-out string    Write the new recovery kit only to this new file (mode 0600), not the terminal; required with --json or without a terminal
      --remove-others              Remove every other device of the vault (default true)
      --unlock-with-recovery       Open the file backend's vault with a recovery private key and set a new passphrase
      --use string                 Open the vault with: password or recovery-key (default "password")
      --vault-id string            The vault to recover, when no kit file is given
  -V, --verbose                    Extra diagnostic output on stderr (loses to --quiet)
  -y, --yes                        Assume yes for all prompts

SEE ALSO

  • ak secrets sync - Sync secrets across your machines with end-to-end encryption (preview)