Skip to main content

Module age

Module age 

Source
Available on crate feature age only.
Expand description

age-encrypted config files.

age is a small, modern file-encryption format: one binary or armored blob per file, recipients in the header, no key management to speak of. It is what secrets.json.age in a repository is encrypted with, and this is the Decryptor that reads it.

age-keygen -o key.txt
age -r "$(grep 'public key' key.txt | cut -d: -f2 | tr -d ' ')" \
    -o secrets.json.age secrets.json
rm secrets.json
// The key comes from the environment, so it is not in the source or the
// repository. `SOPS_AGE_KEY_FILE` is honoured too, because a machine that
// already has one set should not need a second.
dynamic_config::set_decryptor(dynamic_config::age::Age::from_environment()?).ok();

Both binary and armored (-a, the -----BEGIN AGE ENCRYPTED FILE----- form) files are read, without being told which — a repository that switched to armor for a readable diff should not need a code change.

Structs§

Age
Decrypts age-encrypted config files.
Recipients
Who may read a file this program encrypts.