bitwarden_core/client/
persisted_state.rs1use bitwarden_crypto::{UnsignedSharedKey, safe::SymmetricKeyEnvelope};
4use bitwarden_state::{register_repository_item, register_setting_key};
5use serde::{Deserialize, Serialize};
6
7use super::{flags::Flags, login_method::UserLoginMethod};
8use crate::{
9 OrganizationId, UserId,
10 key_management::account_cryptographic_state::WrappedAccountCryptographicState,
11};
12
13#[derive(Clone, Serialize, Deserialize)]
18#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
19#[bitwarden_ffi::wasm_record]
20pub struct OrganizationSharedKey {
21 pub org_id: OrganizationId,
23 pub key: UnsignedSharedKey,
25}
26
27register_repository_item!(OrganizationId => OrganizationSharedKey, "OrganizationSharedKey");
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct BaseUrls {
32 pub identity_url: String,
34 pub api_url: String,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct AuthenticationTokens {
41 pub access_token: String,
43 pub refresh_token: Option<String>,
45 pub expires_on: i64,
47}
48
49register_setting_key!(
51 pub const USER_LOGIN_METHOD: UserLoginMethod = "user_login_method"
53);
54register_setting_key!(
55 pub const BASE_URLS: BaseUrls = "base_urls"
57);
58register_setting_key!(
59 pub const USER_ID: UserId = "user_id"
61);
62register_setting_key!(
63 pub const USER_EMAIL: String = "user_email"
65);
66register_setting_key!(
67 pub const FLAGS: Flags = "flags"
69);
70register_setting_key!(
71 pub const FLAGS_FETCHED_AT: chrono::DateTime<chrono::Utc> = "flags_fetched_at"
73);
74register_setting_key!(
75 pub const AUTHENTICATION_TOKENS: AuthenticationTokens = "authentication_tokens"
77);
78register_setting_key!(
79 pub const ACCOUNT_CRYPTO_STATE: WrappedAccountCryptographicState = "account_crypto_state"
81);
82register_setting_key!(
83 pub const SESSION_PROTECTED_USER_KEY: SymmetricKeyEnvelope = "session_protected_user_key"
85);