bitwarden_core/client/
persisted_state.rs1use bitwarden_crypto::{EncString, UnsignedSharedKey};
4use bitwarden_state::{register_repository_item, register_setting_key};
5use serde::{Deserialize, Serialize};
6#[cfg(feature = "wasm")]
7use tsify::Tsify;
8
9use super::{flags::Flags, login_method::UserLoginMethod};
10use crate::{
11 OrganizationId, UserId,
12 key_management::account_cryptographic_state::WrappedAccountCryptographicState,
13};
14
15#[derive(Clone, Serialize, Deserialize)]
20#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
21#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
22pub struct OrganizationSharedKey {
23 pub org_id: OrganizationId,
25 pub key: UnsignedSharedKey,
27}
28
29register_repository_item!(OrganizationId => OrganizationSharedKey, "OrganizationSharedKey");
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct BaseUrls {
34 pub identity_url: String,
36 pub api_url: String,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct AuthenticationTokens {
43 pub access_token: String,
45 pub refresh_token: Option<String>,
47 pub expires_on: i64,
49}
50
51register_setting_key!(
53 pub const USER_LOGIN_METHOD: UserLoginMethod = "user_login_method"
55);
56register_setting_key!(
57 pub const BASE_URLS: BaseUrls = "base_urls"
59);
60register_setting_key!(
61 pub const USER_ID: UserId = "user_id"
63);
64register_setting_key!(
65 pub const FLAGS: Flags = "flags"
67);
68register_setting_key!(
69 pub const AUTHENTICATION_TOKENS: AuthenticationTokens = "authentication_tokens"
71);
72register_setting_key!(
73 pub const ACCOUNT_CRYPTO_STATE: WrappedAccountCryptographicState = "account_crypto_state"
75);
76register_setting_key!(
77 pub const SESSION_PROTECTED_USER_KEY: EncString = "session_protected_user_key"
79);