pub struct InternalClient {
pub(crate) user_id: OnceLock<UserId>,
pub(crate) token_handler: Arc<dyn TokenHandler>,
pub(super) api_configurations: Arc<ApiConfigurations>,
pub(crate) external_http_client: Client,
pub(super) key_store: KeyStore<KeySlotIds>,
pub(crate) security_state: RwLock<Option<SecurityState>>,
pub(crate) state_registry: StateRegistry,
pub(crate) state_bridge: StateBridge,
pub(crate) managed_profile: Arc<RwLock<Option<ManagementProfile>>>,
}Fields§
§user_id: OnceLock<UserId>§token_handler: Arc<dyn TokenHandler>§api_configurations: Arc<ApiConfigurations>§external_http_client: ClientReqwest client useable for external integrations like email forwarders, HIBP.
key_store: KeyStore<KeySlotIds>§security_state: RwLock<Option<SecurityState>>§state_registry: StateRegistry§state_bridge: StateBridge§managed_profile: Arc<RwLock<Option<ManagementProfile>>>Administrator-forced settings acquired from the operating system’s device-management channel. The host application owns this cell and pushes profiles into it. The SDK only reads. Shared with the host, so updates are observed without rebuilding the client.
Implementations§
Source§impl InternalClient
impl InternalClient
pub(crate) async fn get_login_method(&self) -> Option<UserLoginMethod>
pub(crate) async fn set_login_method(&self, login_method: LoginMethod)
pub(crate) async fn set_tokens( &self, token: String, refresh_token: Option<String>, expires_in: u64, )
pub async fn get_kdf(&self) -> Result<Kdf, NotAuthenticatedError>
pub fn get_key_connector_client(&self, key_connector_url: String) -> ApiClient
Sourcepub fn get_api_configurations(&self) -> Arc<ApiConfigurations> ⓘ
pub fn get_api_configurations(&self) -> Arc<ApiConfigurations> ⓘ
Get the ApiConfigurations containing API clients and configurations for making requests to
the Bitwarden services.
Sourcepub fn managed_profile_handle(&self) -> Arc<RwLock<Option<ManagementProfile>>> ⓘ
pub fn managed_profile_handle(&self) -> Arc<RwLock<Option<ManagementProfile>>> ⓘ
Get the shared managed-settings profile cell.
Prefer ManagedSettingsClientExt::managed_settings from bitwarden-managed-settings over
reading this handle directly.
pub fn get_http_client(&self) -> &Client
pub fn get_key_store(&self) -> &KeyStore<KeySlotIds>
Sourcepub fn get_security_version(&self) -> u64
pub fn get_security_version(&self) -> u64
Returns the security version of the user.
1 is returned for V1 users that do not have a signed security state.
2 or greater is returned for V2 users that have a signed security state.
pub async fn init_user_id( &self, user_id: UserId, ) -> Result<(), UserIdAlreadySetError>
pub fn get_user_id(&self) -> Option<UserId>
pub(crate) fn initialize_user_crypto_key_connector_key( &self, master_key: MasterKey, user_key: EncString, account_crypto_state: WrappedAccountCryptographicState, upgrade_token: &Option<V2UpgradeToken>, ) -> Result<(), EncryptionSettingsError>
pub fn initialize_user_crypto_decrypted_key( &self, user_key: SymmetricCryptoKey, account_crypto_state: WrappedAccountCryptographicState, upgrade_token: &Option<V2UpgradeToken>, ) -> Result<(), EncryptionSettingsError>
pub(crate) fn initialize_user_crypto_pin( &self, pin_key: PinKey, pin_protected_user_key: EncString, account_crypto_state: WrappedAccountCryptographicState, upgrade_token: &Option<V2UpgradeToken>, ) -> Result<(), EncryptionSettingsError>
pub(crate) fn initialize_user_crypto_pin_envelope( &self, pin: String, pin_protected_user_key_envelope: PasswordProtectedKeyEnvelope, account_crypto_state: WrappedAccountCryptographicState, upgrade_token: &Option<V2UpgradeToken>, ) -> Result<(), EncryptionSettingsError>
pub(crate) fn initialize_crypto_single_org_key( &self, organization_id: OrganizationId, key: SymmetricCryptoKey, )
pub fn initialize_org_crypto( &self, org_keys: Vec<(OrganizationId, UnsignedSharedKey)>, ) -> Result<(), EncryptionSettingsError>
pub(crate) fn initialize_user_crypto_master_password_unlock( &self, password: String, master_password_unlock: MasterPasswordUnlockData, account_crypto_state: WrappedAccountCryptographicState, upgrade_token: &Option<V2UpgradeToken>, ) -> Result<(), EncryptionSettingsError>
Sourcepub async fn set_user_master_password_unlock(
&self,
master_password_unlock: MasterPasswordUnlockData,
) -> Result<(), NotAuthenticatedError>
pub async fn set_user_master_password_unlock( &self, master_password_unlock: MasterPasswordUnlockData, ) -> Result<(), NotAuthenticatedError>
Sets the local KDF state for the master password unlock login method. Salt and user key update is not supported yet.
Auto Trait Implementations§
impl !Freeze for InternalClient
impl !RefUnwindSafe for InternalClient
impl !UnwindSafe for InternalClient
impl Send for InternalClient
impl Sync for InternalClient
impl Unpin for InternalClient
impl UnsafeUnpin for InternalClient
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more