age.el
age.el copied to clipboard
How can I simulate what `agenix -e` does?
Right now when I create a file test-age-el.age and try to use it with agenix I get:
decrypting '/nix/store/x31pafpiw2a8c07c3amh52gihzag8yqx-testemacsage.age' to '/run/agenix.d/3/testemacsage'...
Error: No matching keys found
I suppose this has to do with my configuration and not having all public keys.
You just have to get the public keys that age.el does to match the configuration of public keys used in your secrets.nix file. So given:
let
user1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0idNvgGiucWgup/mP78zyC23uFjYq0evcWdjGQUaBH";
user2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILI6jSq53F/3hEmSs+oq9L4TwOo1PrDMAgcA1uo1CCV/";
users = [ user1 user2 ];
system1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJDyIr/FSz1cJdcoW69R+NrWzwGK/+3gJpqD1t8L2zE";
system2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKzxQgondgEYcLpcPdJLrTdNgZ2gznOHCAxMdaceTUT1";
systems = [ system1 system2 ];
in
{
"secret1.age".publicKeys = [ user1 system1 ];
"secret2.age".publicKeys = users ++ systems;
}
To modify secret2.age you must have all of users and systems in age-default-recipient if I understand correctly.
This works for me at least, but it's possible you don't need all of them.
Leaving open in case there are other thoughts, ideas, or if this could be useful documentation.