π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[rust][core] fix blob JSON error mapping
Neeraj Guptaf88876c6626a
diff --git a/rust/core/src/crypto/impl_pure/blob.rs b/rust/core/src/crypto/impl_pure/blob.rsindex c8d2aa0538..0facb83c7c 100644--- a/rust/core/src/crypto/impl_pure/blob.rs+++ b/rust/core/src/crypto/impl_pure/blob.rs@@ -162,8 +162,9 @@ pub fn encrypt_json<T: serde::Serialize>(value: &T, key: &[u8]) -> Result<Encryp/// Encrypt a JSON value and return a combined `header || ciphertext` payload.pub fn encrypt_json_combined<T: serde::Serialize>(value: &T, key: &[u8]) -> Result<Vec<u8>> {- let json = serde_json::to_vec(value)- .map_err(|e| CryptoError::Json(format!("JSON serialization failed: {}", e)))?;+ let json = serde_json::to_vec(value).map_err(|e| {+ CryptoError::InvalidKeyDerivationParams(format!("JSON serialization failed: {}", e))+ })?;encrypt_combined(&json, key)}@@ -187,8 +188,12 @@ pub fn decrypt_json_combined<T: serde::de::DeserializeOwned>(key: &[u8],) -> Result<T> {let plaintext = decrypt_combined(combined, key)?;- serde_json::from_slice(&plaintext)- .map_err(|e| CryptoError::Json(format!("JSON deserialization failed: {}", e)))+ serde_json::from_slice(&plaintext).map_err(|e| {+ CryptoError::InvalidKeyDerivationParams(format!(+ "JSON deserialization failed: {}",+ e+ ))+ })}#[cfg(test)]