bitwarden_vault/
password_history_client.rs1use bitwarden_core::Client;
2
3use crate::{DecryptError, EncryptError, PasswordHistory, PasswordHistoryView};
4
5#[allow(missing_docs)]
6pub struct PasswordHistoryClient {
7 pub(crate) client: Client,
8}
9
10impl PasswordHistoryClient {
11 #[allow(missing_docs)]
12 pub fn encrypt(
13 &self,
14 history_view: PasswordHistoryView,
15 ) -> Result<PasswordHistory, EncryptError> {
16 let key_store = self.client.internal.get_key_store();
17 let history = key_store.encrypt(history_view)?;
18 Ok(history)
19 }
20
21 #[allow(missing_docs)]
22 pub fn decrypt_list(
23 &self,
24 history: Vec<PasswordHistory>,
25 ) -> Result<Vec<PasswordHistoryView>, DecryptError> {
26 let key_store = self.client.internal.get_key_store();
27 let history_view = key_store.decrypt_list(&history)?;
28 Ok(history_view)
29 }
30}