pub fn json_decrypt_prop(json: &mut serde_json::Value, prop: &str) -> Result<(), Error> {
    match json {
        serde_json::Value::Object(value) => match value.get(prop) {
            Some(serde_json::Value::String(gpg_secrets)) => {
                let decrypted = gpg::decrypt(gpg_secrets)?;
                let decrypted_json = serde_json::from_str(&decrypted)?;
                value.insert(prop.into(), decrypted_json);
                Ok(())
            }
            Some(serde_json::Value::Object(_)) => Err(Error::SecretsAlreadyDecrypted),
            Some(_) => Err(Error::SecretsMustBeString),
            None => Err(Error::SecretsPropertyMissing),
        },
        _ => Err(Error::RequiresJsonObject),
    }
}
/// Decrypt the GPG encrypted JSON property
Decrypt the GPG encrypted JSON property
Decrypt the GPG encrypted JSON property
pub fn json_decrypt_prop(json: &mut serde_json::Value, prop: &str) -> Result<(), Error> {
    match json {
        serde_json::Value::Object(value) => match value.get(prop) {
            Some(serde_json::Value::String(gpg_secrets)) => {
                let decrypted = gpg::decrypt(gpg_secrets)?;
                let decrypted_json = serde_json::from_str(&decrypted)?;
                value.insert(prop.into(), decrypted_json);
                Ok(())
            }
            Some(serde_json::Value::Object(_)) => Err(Error::SecretsAlreadyDecrypted),
            Some(_) => Err(Error::SecretsMustBeString),
            None => Err(Error::SecretsPropertyMissing),
        },
        _ => Err(Error::RequiresJsonObject),
    }
}
pub fn json_decrypt_prop ( json : & mut serde_json :: Value , prop : & str ) -> Result < ( ) , Error > { match json { serde_json :: Value :: Object ( value ) => match value . get ( prop ) { Some ( serde_json :: Value :: String ( gpg_secrets ) ) => { let decrypted = gpg :: decrypt ( gpg_secrets ) ? ; let decrypted_json = serde_json :: from_str ( & decrypted ) ? ; value . insert ( prop . into ( ) , decrypted_json ) ; Ok ( ( ) ) } Some ( serde_json :: Value :: Object ( _ ) ) => Err ( Error :: SecretsAlreadyDecrypted ) , Some ( _ ) => Err ( Error :: SecretsMustBeString ) , None => Err ( Error :: SecretsPropertyMissing ) , } , _ => Err ( Error :: RequiresJsonObject ) , } }
Decrypt the GPG encrypted JSON property
Decrypt the GPG encrypted JSON property
json
&mut serde_json::Value
prop
&str
json
&mut serde_json::Value
prop
&str