Skip to main content

bitwarden_organization_crypto_management/
organization_crypto_management_client.rs

1//! Client to manage the cryptographic state of the user's organizations.
2
3use std::sync::Arc;
4
5use bitwarden_core::{Client, FromClient, client::ApiConfigurations, key_management::KeySlotIds};
6use bitwarden_crypto::KeyStore;
7use bitwarden_organizations::ProfileOrganization;
8use bitwarden_state::repository::Repository;
9
10/// Client for managing the cryptographic state of the user's organizations.
11#[bitwarden_ffi::wasm_object]
12#[derive(FromClient)]
13pub struct OrganizationCryptoManagementClient {
14    pub(crate) key_store: KeyStore<KeySlotIds>,
15    pub(crate) api_configurations: Arc<ApiConfigurations>,
16    pub(crate) repository: Option<Arc<dyn Repository<ProfileOrganization>>>,
17}
18
19/// Extension trait to add the organization-crypto-management client to the main Bitwarden SDK
20/// client.
21pub trait OrganizationCryptoManagementClientExt {
22    /// Get the organization-crypto-management client.
23    fn organization_crypto_management(&self) -> OrganizationCryptoManagementClient;
24}
25
26impl OrganizationCryptoManagementClientExt for Client {
27    fn organization_crypto_management(&self) -> OrganizationCryptoManagementClient {
28        OrganizationCryptoManagementClient::from_client(self)
29    }
30}