bitwarden_importers/importers/onepassword/access/identity.rs
1//! The 1Password client this module impersonates.
2//!
3//! Every value the server sees as our client identity is defined here and nowhere else, so
4//! refreshing a fingerprint that has gone stale is a single-file change. None of it is load-bearing
5//! for the protocol: it only has to look like a plausible 1Password desktop client.
6//!
7//! Taken from 1Password for Mac/Windows/Linux 8.12.10, released 7 April 2026:
8//! - <https://releases.1password.com/mac/stable/#1password-for-mac-8.12.10>
9//! - <https://releases.1password.com/windows/stable/#1password-for-windows-8.12.10>
10//! - <https://releases.1password.com/linux/stable/#1password-for-linux-8.12.10>
11//!
12//! Whether per-platform impersonation is needed at all, or whether one fixed identity would do, is
13//! an open question. See the development notes in this module's README.
14
15/// The desktop app's build number, sent as the client version and inside the op user agent.
16pub(super) const VERSION: &str = "81210036";
17
18/// The HTTP library the desktop app reports. That app is itself written in Rust, so this is *its*
19/// reqwest version, not ours. Do not sync it with the workspace's reqwest pin; it is part of the
20/// fingerprint, and the two are unrelated.
21pub(super) const HTTP_LIB: &str = "reqwest|0.12.24";
22
23/// The per-platform half of the identity. The version and HTTP library above are the same
24/// everywhere, so only these four fields vary.
25pub(super) struct Platform {
26 /// Names the client: `1Password for Mac`.
27 pub os: &'static str,
28 /// Single-letter platform code, the second field of the op user agent.
29 pub op_code: &'static str,
30 /// `os|version|arch`, the last field of the op user agent.
31 pub os_suffix: &'static str,
32 /// The `osName` in the device descriptor.
33 pub os_name: &'static str,
34}
35
36#[cfg(target_os = "macos")]
37pub(super) const PLATFORM: Platform = Platform {
38 os: "Mac",
39 op_code: "M",
40 os_suffix: "MacOSX|26.3.1|aarch64",
41 os_name: "macOS",
42};
43
44#[cfg(target_os = "linux")]
45pub(super) const PLATFORM: Platform = Platform {
46 os: "Linux",
47 op_code: "L",
48 os_suffix: "Linux|Ubuntu 24.04|x86_64",
49 os_name: "Linux",
50};
51
52// Every other target, wasm32 included, presents as the Windows build.
53#[cfg(not(any(target_os = "macos", target_os = "linux")))]
54pub(super) const PLATFORM: Platform = Platform {
55 os: "Windows",
56 op_code: "W",
57 os_suffix: "Windows|25H2 11.0.26200|x86_64",
58 os_name: "Windows",
59};