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 →

bundle

ak secrets bundle keygen

Create a dedicated age key pair for one CI trust boundary, write the secret half to a new 0600 file, and print the public recipient.

Use ak secrets bundle keygen to create the key a protected CI job uses to decrypt its bundle. Create one key per trust boundary, for example production separate from staging. The command never prompts.

Usage

ak secrets bundle keygen --key-out PATH [flags]
ak secrets bundle keygen --key-out ./ci-production.key
ak secrets bundle keygen --key-out ./ci-staging.key --json

Options

FlagDefaultDescription
--key-out PATHRequiredFile to write the CI decryption key to. The path must not exist.

Shared flags are described in CLI conventions.

What it does

The command generates an age X25519 key pair. It writes the secret half to --key-out with mode 0600, creating missing parent directories, and never prints it. It prints the public recipient (age1...), which is what ak secrets bundle create --encrypt-for takes.

The command refuses a --key-out path that already exists, because a replaced key strands the bundles sealed to it. It also refuses a symlink or a directory.

Load the key file into the protected CI environment's secret store, then delete the file. A job reads it from AK_CI_DECRYPT_KEY by default. Never reuse the personal vault's passphrase, a recovery key, or a device key here.

Output

The text output names the key file and the recipient. JSON uses kind=secrets.bundle.keygen with these fields under data:

out, recipient

No output ever contains the secret key.

Exit behavior

ExitMeaning
0The key file was written.
2No --key-out, or the path exists, is a symlink, or is a directory.
5The key could not be generated or written.