pub struct MachineId(/* private fields */);Expand description
This machine’s name, minted once by the daemon and served to every module
that registers with it (on HELLO_ACK and server.describe).
It is 16 random bytes rendered as exactly 32 lowercase hex characters. It is
opaque: it carries no structure and is not derived from a key, a hostname or
any other host fact. The daemon stores it at <data home>/cortexkit/machine-id
and never rewrites that file; an operator changes it only with
ck machine adopt, which takes effect at the next daemon start.
§A name, never an authority
Nothing may admit a peer, grant trust or skip a check because two messages carry the same machine id. Authority stays on keys (a peer’s roster entry, the vault). The id deliberately outlives a key rotation, so treating it as an identity would let a revoked key’s history vouch for its replacement. Two machines restored from one backup also carry the same id, which is exactly why it can name a machine but never prove one.
Construction validates the shape, so a value of this type is always 32 lowercase hex characters. A module talking to a daemon that predates the id sees no value at all and must read that as “the daemon predates the machine id”, never as “there is no machine” and never as a cue to mint its own.
Implementations§
Source§impl MachineId
impl MachineId
Sourcepub const HEX_LEN: usize = 32
pub const HEX_LEN: usize = 32
Length of the rendered id in characters (16 bytes, two hex digits each).
Sourcepub fn parse(value: &str) -> Result<Self, MachineIdError>
pub fn parse(value: &str) -> Result<Self, MachineIdError>
Validate value as a machine id: exactly 32 characters, each 0-9 or
a-f. Uppercase hex is refused rather than folded, so one machine has
exactly one spelling and string comparison is identity of the name.
Sourcepub fn from_bytes(bytes: [u8; 16]) -> Self
pub fn from_bytes(bytes: [u8; 16]) -> Self
Render 16 bytes as a machine id. The caller supplies the randomness; the daemon uses the operating system’s CSPRNG.