[bug] Fix update_process

This commit is contained in:
Sosthene 2025-06-17 16:46:07 +02:00
parent 70665fa762
commit f474d50414

View File

@ -1279,9 +1279,8 @@ pub fn update_process(
for (field, plain_value) in new_attributes.iter() { for (field, plain_value) in new_attributes.iter() {
let hash = new_state.pcd_commitment.get(field).ok_or(anyhow::Error::msg("Missing commitment"))?; let hash = new_state.pcd_commitment.get(field).ok_or(anyhow::Error::msg("Missing commitment"))?;
let key = generate_key(&mut rng); let key = generate_key(&mut rng);
let cipher = encrypt_with_key(&key, plain_value.as_slice())?;
new_state.keys.insert(field.to_owned(), key); new_state.keys.insert(field.to_owned(), key);
let serialized = serde_json::to_string(plain_value)?;
let cipher = encrypt_with_key(&key, serialized.as_bytes())?;
encrypted_data.insert(hash.to_lower_hex_string(), cipher.to_lower_hex_string()); encrypted_data.insert(hash.to_lower_hex_string(), cipher.to_lower_hex_string());
} }