pub fn fresh_token() -> StringExpand description
32 hex characters of OS entropy: nonces and link ids. Both uses need unpredictability rather than uniqueness alone — a guessable nonce would let a captured hello be answered in advance, and a guessable link id would let a stranger sync under somebody else’s link. When the OS has no entropy to give, a clock-derived value keeps the link working and the replay caches still refuse exact repeats.
use majordomus_cli::mesh::link::fresh_token;
let (a, b) = (fresh_token(), fresh_token());
assert_eq!(a.len(), 32);
assert!(a.bytes().all(|c| c.is_ascii_hexdigit()));
assert_ne!(a, b, "a token is fresh, not a counter");