bitwarden_auth/login/models/login_device_request.rs
1use bitwarden_core::DeviceType;
2use serde::{Deserialize, Serialize};
3
4/// Device information for login requests.
5/// This is common across all login mechanisms and describes the device
6/// making the authentication request.
7#[derive(Serialize, Deserialize, Debug)]
8#[serde(rename_all = "camelCase", deny_unknown_fields)]
9#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] // add mobile support
10#[cfg_attr(
11 feature = "wasm",
12 derive(tsify::Tsify),
13 tsify(into_wasm_abi, from_wasm_abi)
14)] // add wasm support
15pub struct LoginDeviceRequest {
16 /// The type of device making the login request
17 /// Note: today, we already have the DeviceType on the ApiConfigurations
18 /// but we do not have the other device fields so we will accept the device data at login time
19 /// for now. In the future, we might refactor the unauthN client to instantiate with full
20 /// device info which would deprecate this struct. However, using the device_type here
21 /// allows us to avoid any timing issues in scenarios where the device type could change
22 /// between client instantiation and login (unlikely but possible).
23 pub device_type: DeviceType,
24
25 /// Unique identifier for the device
26 pub device_identifier: String,
27
28 /// Human-readable name of the device
29 pub device_name: String,
30
31 /// Push notification token for the device (only for mobile devices)
32 pub device_push_token: Option<String>,
33}