pub fn set_decryptor(
decryptor: impl Decryptor,
) -> Result<(), Box<dyn Decryptor>>Available on crate feature
decrypt only.Expand description
Installs the decryptor, once per process.
Process-wide rather than per config type, because a decryption key is a process-wide fact: the program either can read its own secrets or cannot. Two config types needing two different keys is a shape this deliberately does not model.
Call it before the first init(). An encrypted file loaded without one
fails with an error saying so, rather than being silently skipped — a
configuration that quietly lost its secrets is worse than one that refuses
to start.
§Errors
If one is already installed. The rejected decryptor is returned rather than dropped, so a caller can tell “already set” from “failed”.