From 295775812a74aeef6a02c715e404972f4cc32184 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Thu, 21 Sep 2023 16:44:59 -0500 Subject: [PATCH] VSS Updates --- mutiny-core/src/vss.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mutiny-core/src/vss.rs b/mutiny-core/src/vss.rs index 1b914a81f..de86c5a59 100644 --- a/mutiny-core/src/vss.rs +++ b/mutiny-core/src/vss.rs @@ -37,7 +37,7 @@ impl VssKeyValueItem { // should we handle this unwrap better? let bytes = self.value.to_string().into_bytes(); - let value = base64::encode(encrypt_with_key(encryption_key, &bytes)); + let value = encrypt_with_key(encryption_key, &bytes); EncryptedVssKeyValueItem { key: self.key, @@ -50,7 +50,7 @@ impl VssKeyValueItem { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct EncryptedVssKeyValueItem { pub key: String, - pub value: String, + pub value: Vec, pub version: u32, } @@ -59,8 +59,7 @@ impl EncryptedVssKeyValueItem { self, encryption_key: &SecretKey, ) -> Result { - let bytes = base64::decode(&self.value)?; - let decrypted = decrypt_with_key(encryption_key, bytes)?; + let decrypted = decrypt_with_key(encryption_key, self.value)?; let decrypted_value = String::from_utf8(decrypted)?; let value = serde_json::from_str(&decrypted_value)?; @@ -109,7 +108,7 @@ impl MutinyVssClient { } pub async fn get_object(&self, key: &str) -> Result { - let url = Url::parse(&format!("{}/getObject", self.url)).map_err(|e| { + let url = Url::parse(&format!("{}/v2/getObject", self.url)).map_err(|e| { log_error!(self.logger, "Error parsing get objects url: {e}"); MutinyError::Other(anyhow!("Error parsing get objects url: {e}")) })?;