Skip to main content

bitwarden_vault/cipher/cipher_client/admin/
mod.rs

1use std::sync::Arc;
2
3use bitwarden_core::{
4    Client, FromClient,
5    client::{ApiConfigurations, FromClientPart},
6    key_management::KeySlotIds,
7};
8use bitwarden_crypto::KeyStore;
9
10mod create;
11mod delete;
12mod edit;
13mod get;
14mod restore;
15
16pub use get::{GetAssignedOrgCiphersAdminError, GetOrganizationCiphersAdminError};
17
18/// Client for performing admin operations on ciphers. Unlike the regular CiphersClient,
19/// this client uses the admin server API endpoints, and does not modify local state.
20#[bitwarden_ffi::wasm_object]
21pub struct CipherAdminClient {
22    pub(crate) key_store: KeyStore<KeySlotIds>,
23    pub(crate) api_configurations: Arc<ApiConfigurations>,
24    #[deprecated(
25        note = "Use the component fields (key_store, api_configurations) for new operations"
26    )]
27    pub(crate) client: Client,
28}
29
30impl FromClient for CipherAdminClient {
31    fn from_client(client: &Client) -> Self {
32        #[allow(deprecated)]
33        Self {
34            key_store: client.get_part(),
35            api_configurations: client.get_part(),
36            client: client.clone(),
37        }
38    }
39}
40
41#[allow(deprecated)]
42impl CipherAdminClient {
43    async fn is_strict_decrypt(&self) -> bool {
44        self.client.flags().get().await.strict_cipher_decryption
45    }
46}