Expand description
Node identity: who this machine’s Majordomus is, independently of any repository, process, address or port. The identity is an Ed25519 keypair created once per user and machine and kept under the user’s state directory; the node id is a digest of the public key, so claiming an id means holding the key, and a hostname, an IP address or a PID is never identity — those are runtime attributes that change.
The signing key never leaves this module: everything above it sees NodeIdentity,
which signs and exposes public material only. The instance id distinguishes runs of
the same node — a machine that restarts keeps its node id and changes its instance.
use majordomus_cli::mesh::identity::{verify, NodeIdentity};
let node = NodeIdentity::ephemeral().unwrap();
let signature = node.sign(b"a majordomus exists here");
assert!(verify(&node.public.public_key, b"a majordomus exists here", &signature));
assert!(!verify(&node.public.public_key, b"something else", &signature));Structs§
- Instance
Id - One run of a node: 16 hex characters of OS entropy, new at every process start. A restart keeps the node id and changes this, which is how a reader tells “the same node came back” from “the same process is still there”.
- NodeId
- The stable identity of a node: 32 hex characters of the SHA-256 of its Ed25519 public key. Derived, never chosen: two nodes with one id hold one key.
- Node
Identity - The identity a running mesh signs with: the public half plus the signing key.
- Public
Identity - What everyone may know about this node: the id, the public key, a display name and this run’s instance. Everything an advertisement carries; nothing that signs.
Functions§
- default_
identity_ path - Where the identity lives:
$XDG_STATE_HOME/majordomus/node.json, else$HOME/.local/state/majordomus/node.json.Nonewhen neither variable is set — a process with no home has no node identity, and the mesh stays off. - node_
id_ of_ key - The node id a public key (hex) yields, when the key parses.
- relabel
- Give the identity at
patha display label, keeping its key: the node id, and every signature it ever made, are unchanged. The label is presentation — what a person reads asmacbook-proin a list of devices — and is refused unless it is a short name of letters, digits,.,_and-, because it is printed wherever this node is named. - verify
- Verify
signature(hex) overmessageagainstpublic_key(hex). False on any malformed material: a verifier never panics on hostile input.