use mac_address::get_mac_address;
pub fn get_device_mac() -> Option<String> {
match get_mac_address() {
Ok(Some(mac)) => Some(mac.to_string().replace(":", "").to_lowercase()),
Ok(None) => None,
Err(error) => {
eprintln!("Note: could not read a device MAC address ({error}).");
None
}
}
}
pub fn make_refresher_token(ott: &str, mac: Option<&str>) -> String {
use sha2::{Digest, Sha256};
let input = format!("{}{}", ott, mac.unwrap_or_default());
let hash = Sha256::digest(input.as_bytes());
hex::encode(hash)
}