Commit Graph

1 Commits (dba9037230f69a202e5cef8c42135801b06af94f)

Author SHA1 Message Date
Dustin dba9037230 templating: Add decrypt filter
The `decrypt` filter can be used in Tera templates to decrypt a string
using `age`.  This will allow the template context to contain encrypted
vaules that are only decrypted if they are actually used to render a
template.

I considered using the [age] crate to implement this filter, rather
than using the `age` command, but I decided against it for two reasons:

1. The way I intend for the `keys.txt` file to be populated is by
   fetching the keys from *keyserv.pyrocufflink.blue*, which returns
   an encrypted file that has to be decrypted with the `age` command
   before it can be used.  Since that means `age` will always be
   available, it makes less sense to increase the size of the `tmpl`
   binary with what is effectively duplicate code.
2. The Rust API for *age* is rather un-ergonomic, particularly with
   respect to loading identites from a file.  It's much easier to

[age]: https://crates.io/crates/age
2024-01-11 17:16:58 -06:00