use securestore::*;
#[test]
pub fn binary_decode() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let mut sman = SecretsManager::new(KeySource::Csprng)?;
let secret_base64 = "Gl8WuHef7yWq7mRL/vLvrQ==";
let secret = radix64::STD.decode(&secret_base64)?;
if let Ok(_) = String::from_utf8(secret.clone()) {
panic!("Cannot test with a binary secret that's also valid UTF-8 string!");
}
sman.set("secret", secret.as_slice());
let secret_str = super::get_secret(&sman, "secret")?;
assert_eq!(secret_str, format!("base64:{}", secret_base64));
Ok(())
}