Skip to main content

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#[bitwarden_ffi::wasm_record] // add wasm support
11pub struct LoginDeviceRequest {
12    /// The type of device making the login request
13    /// Note: today, we already have the DeviceType on the ApiConfigurations
14    /// but we do not have the other device fields so we will accept the device data at login time
15    /// for now. In the future, we might refactor the unauthN client to instantiate with full
16    /// device info which would deprecate this struct. However, using the device_type here
17    /// allows us to avoid any timing issues in scenarios where the device type could change
18    /// between client instantiation and login (unlikely but possible).
19    pub device_type: DeviceType,
20
21    /// Unique identifier for the device
22    pub device_identifier: String,
23
24    /// Human-readable name of the device
25    pub device_name: String,
26
27    /// Push notification token for the device (only for mobile devices)
28    pub device_push_token: Option<String>,
29}