bitwarden_uniffi/vault/
password_history.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::sync::Arc;

use bitwarden::vault::{ClientVaultExt, PasswordHistory, PasswordHistoryView};

use crate::{Client, Result};

#[derive(uniffi::Object)]
pub struct ClientPasswordHistory(pub Arc<Client>);

#[uniffi::export]
impl ClientPasswordHistory {
    /// Encrypt password history
    pub fn encrypt(&self, password_history: PasswordHistoryView) -> Result<PasswordHistory> {
        Ok(self
            .0
             .0
            .vault()
            .password_history()
            .encrypt(password_history)?)
    }

    /// Decrypt password history
    pub fn decrypt_list(&self, list: Vec<PasswordHistory>) -> Result<Vec<PasswordHistoryView>> {
        Ok(self.0 .0.vault().password_history().decrypt_list(list)?)
    }
}