[bug] don't stringify value before encryption
This commit is contained in:
parent
e72e0d9fe8
commit
815b640a27
@ -1186,8 +1186,7 @@ pub fn create_new_process(
|
||||
for (field, plain_value) in private_data.iter() {
|
||||
let hash = pcd_commitment.get(field).ok_or(anyhow::Error::msg("Missing commitment"))?;
|
||||
let key = generate_key(&mut rng);
|
||||
let serialized = serde_json::to_string(plain_value)?;
|
||||
let cipher = encrypt_with_key(&key, serialized.as_bytes())?;
|
||||
let cipher = encrypt_with_key(&key, plain_value.as_slice())?;
|
||||
new_state.keys.insert(field.to_owned(), key);
|
||||
encrypted_data.insert(hash.to_lower_hex_string(), cipher.to_lower_hex_string());
|
||||
}
|
||||
@ -1674,7 +1673,7 @@ pub fn is_child_role(parent_roles: String, child_roles: String) -> ApiResult<()>
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn decrypt_data(key: &[u8], data: &[u8]) -> ApiResult<String> {
|
||||
pub fn decrypt_data(key: &[u8], data: &[u8]) -> ApiResult<Vec<u8>> {
|
||||
let mut key_buf = [0u8; 32];
|
||||
|
||||
if key.len() != 32 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user