Files
firezone/rust/bin-shared/src/device_info.rs
Thomas Eizinger f2b1fbe718 refactor(rust): move device_id to bin-shared (#9040)
Both `device_id` and `device_info` are used by the headless-client and
the GUI client / IPC service. They should therefore be defined in the
`bin-shared` crate.
2025-05-06 04:52:37 +00:00

23 lines
581 B
Rust

pub fn serial() -> Option<String> {
const DEFAULT_SERIAL: &str = "123456789";
let data = smbioslib::table_load_from_device().ok()?;
let serial = data.find_map(|sys_info: smbioslib::SMBiosSystemInformation| {
sys_info.serial_number().to_utf8_lossy()
})?;
if serial == DEFAULT_SERIAL {
return None;
}
Some(serial)
}
pub fn uuid() -> Option<String> {
let data = smbioslib::table_load_from_device().ok()?;
let uuid = data.find_map(|sys_info: smbioslib::SMBiosSystemInformation| sys_info.uuid());
uuid?.to_string().into()
}