Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSS Updates #769

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mutiny-core/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub async fn create_vss_client() -> MutinyVssClient {

MutinyVssClient::new(
Arc::new(auth_client),
"https://vss-staging.fly.dev".to_string(),
"https://vss-staging.fly.dev/v2".to_string(),
encryption_key,
logger,
)
Expand Down
7 changes: 3 additions & 4 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