Skip to main content

bitwarden_user_crypto_management/
user_crypto_management_client.rs

1//! Client to manage the cryptographic machinery of a user account, including key-rotation
2
3use bitwarden_core::Client;
4
5/// Client for managing the cryptographic machinery of a user account, including key-rotation.
6#[derive(Clone)]
7#[cfg_attr(feature = "uniffi", derive(uniffi::Object))]
8#[bitwarden_ffi::wasm_object]
9pub struct UserCryptoManagementClient {
10    #[allow(unused)]
11    pub(crate) client: Client,
12}
13
14impl UserCryptoManagementClient {
15    #[allow(unused)]
16    pub(crate) fn new(client: Client) -> Self {
17        Self { client }
18    }
19}
20
21/// Extension trait to add the user-crypto-management client to the main Bitwarden SDK client.
22pub trait UserCryptoManagementClientExt {
23    /// Get the user-crypto-management client.
24    fn user_crypto_management(&self) -> UserCryptoManagementClient;
25}
26
27impl UserCryptoManagementClientExt for Client {
28    fn user_crypto_management(&self) -> UserCryptoManagementClient {
29        UserCryptoManagementClient::new(self.clone())
30    }
31}