use bitwarden_crypto::{EncString, UnsignedSharedKey};
use bitwarden_state::{register_repository_item, register_setting_key};
use serde::{Deserialize, Serialize};
#[cfg(feature = "wasm")]
use tsify::Tsify;
use super::{flags::Flags, login_method::UserLoginMethod};
use crate::{
OrganizationId, UserId,
key_management::account_cryptographic_state::WrappedAccountCryptographicState,
};
#[derive(Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
pub struct OrganizationSharedKey {
pub org_id: OrganizationId,
pub key: UnsignedSharedKey,
}
register_repository_item!(OrganizationId => OrganizationSharedKey, "OrganizationSharedKey");
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BaseUrls {
pub identity_url: String,
pub api_url: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthenticationTokens {
pub access_token: String,
pub refresh_token: Option<String>,
pub expires_on: i64,
}
register_setting_key!(
pub const USER_LOGIN_METHOD: UserLoginMethod = "user_login_method"
);
register_setting_key!(
pub const BASE_URLS: BaseUrls = "base_urls"
);
register_setting_key!(
pub const USER_ID: UserId = "user_id"
);
register_setting_key!(
pub const FLAGS: Flags = "flags"
);
register_setting_key!(
pub const AUTHENTICATION_TOKENS: AuthenticationTokens = "authentication_tokens"
);
register_setting_key!(
pub const ACCOUNT_CRYPTO_STATE: WrappedAccountCryptographicState = "account_crypto_state"
);
register_setting_key!(
pub const SESSION_PROTECTED_USER_KEY: EncString = "session_protected_user_key"
);