Skip to content

Commit

Permalink
VSS Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Sep 21, 2023
1 parent 9a50818 commit 2957758
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mutiny-core/src/vss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<u8>,
pub version: u32,
}

Expand All @@ -59,8 +59,7 @@ impl EncryptedVssKeyValueItem {
self,
encryption_key: &SecretKey,
) -> Result<VssKeyValueItem, MutinyError> {
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)?;

Expand Down Expand Up @@ -109,7 +108,7 @@ impl MutinyVssClient {
}

pub async fn get_object(&self, key: &str) -> Result<VssKeyValueItem, MutinyError> {
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}"))
})?;
Expand Down

0 comments on commit 2957758

Please sign in to comment.