1use serde::Serialize;
2
3#[derive(Debug, Clone)]
5pub struct DeviceIdentity {
6 pub fingerprint: String,
8 pub info: String,
10}
11
12#[derive(Debug, Clone, Serialize)]
13struct DeviceInfo {
14 os: &'static str,
15 machine_uid: String,
16}
17
18pub fn collect() -> DeviceIdentity {
24 let uid = machine_uid::get().unwrap_or_else(|_| "unknown-device".to_string());
25
26 let info = DeviceInfo {
27 os: std::env::consts::OS,
28 machine_uid: uid.clone(),
29 };
30 let info_json = serde_json::to_string(&info).unwrap_or_else(|_| "{}".to_string());
31
32 DeviceIdentity {
33 fingerprint: uid,
34 info: info_json,
35 }
36}