chore: Encrypt the exported json with the given key
This commit is contained in:
parent
bc2257cdaf
commit
914222976c
1 changed files with 2 additions and 4 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue