chore: Encrypt the exported json with the given key

This commit is contained in:
Awiteb 2024-05-07 20:21:22 +03:00
parent bc2257cdaf
commit 914222976c
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F

View file

@ -130,11 +130,9 @@ impl Vaults {
/// - if the encryption failed
///
/// Note: The returned string is `Vec<Vault>`
pub fn json_export(&self) -> LprsResult<String> {
pub fn json_export(&self, encryption_key: &[u8; 32]) -> LprsResult<String> {
let encrypt = |val: &str| {
LprsResult::Ok(
crate::BASE64.encode(cipher::encrypt(&self.master_password, val.as_ref())),
)
LprsResult::Ok(crate::BASE64.encode(cipher::encrypt(encryption_key, val.as_ref())))
};
serde_json::to_string(