feat: Support export and import with different password #30

Merged
awiteb merged 5 commits from awiteb/fix-25 into master 2024-05-08 05:06:28 +02:00 AGit
Showing only changes of commit 914222976c - Show all commits

View file

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