Function streambed::decrypt_buf

source ·
pub async fn decrypt_buf<'a, T, D, DE>(
    ss: &impl SecretStore,
    secret_path: &str,
    buf: &'a mut [u8],
    deserialize: D,
) -> Option<T>
where T: Deserialize<'a>, D: FnOnce(&'a [u8]) -> Result<T, DE>,
Expand description

Given a secret store, a path to a secret, and a byte buffer to be decrypted, decrypt it in place. Returns a decoded structure if decryption was successful. The secret is expected to reside in a data field named “value” and is encoded as a hex string of 32 characters (16 bytes) The buffer is expected to contain both the salt and the bytes to be decrypted.