docs/environments/secrets/age.md
Encrypt individual environment variable values directly in mise.toml using age encryption. The age tool is not required—mise has support built-in.
This is a simple method of storing encrypted environment variables directly in mise.toml. You can use it simply by running mise set --age-encrypt <key>=<value>. By default, mise will use your ssh key (~/.ssh/id_ed25519 or ~/.ssh/id_rsa) if it exists.
mise.tomlage-keygen -o ~/.config/mise/age.txt
# Note the public key output for encryption
mise set --age-encrypt --prompt DB_PASSWORD
# Enter value for DB_PASSWORD: [hidden input]
::: warning
It's recommended to use --prompt to avoid accidentally exposing the value to your shell history. You don't have to though, you can use mise set --age-encrypt DB_PASSWORD="password123".
:::
mise.toml as an age directive:[env]
DB_PASSWORD = { age = { value = "<base64>" } }
mise env # Variables are decrypted automatically
--age-encrypt — enable age encryption for the value--age-recipient <KEY> — x25519 recipient (can be set multiple times)--age-ssh-recipient <PATH|KEY> — SSH public key or path to .pub/private key (can be set multiple times)--age-key-file <PATH> — use recipients derived from an age identity file--prompt — prompt for the value to avoid accidentally exposing it to your shell historyIf no recipients are provided explicitly, mise will try defaults (see below).
Encrypted values are stored as base64 along with a format field:
format = "raw" — uncompressed ciphertext (typically for small values)format = "zstd" — zstd-compressed ciphertext (used when ciphertext > 1KB)mise looks for identities in this order:
MISE_AGE_KEY environment variable
AGE-SECRET-KEY-... lines, or an age identity file payloadsettings.age.identity_files (list of paths)settings.age.key_file (single path)~/.config/mise/age.txt if it existssettings.age.ssh_identity_files and common defaults (~/.ssh/id_ed25519, ~/.ssh/id_rsa)Decrypted values are always marked as redacted.
If no identities are found or decryption fails, mise returns the encrypted value as-is (non-strict behavior).
When --age-encrypt is used without explicit recipients, mise attempts to derive recipients from:
~/.config/mise/age.txt.pub file existsIf none are found, the command fails with an error asking you to provide recipients or configure settings.age.key_file.
mise set KEY will print the decrypted value