feat: Support export and import with different password #30
1 changed files with 2 additions and 4 deletions
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue