From c66f0f8f7297484e095e02d259c84469b6c42367 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 19 Nov 2026 19:00:05 +0000 Subject: continuum node-id: a node key's ID, without starting the node The founders name each node by its ID in the first version, before the federation starts; getting it meant starting a node once with --node-key-create and reading its log. `continuum node-id FILE` prints the node ID of the key FILE holds and exits, `--create` making the key there first where there is none (saying so on standard error). Logs are off for it, as for --print-config: the ID goes to standard output alone. --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 1ac1f35..28d18e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,6 +83,15 @@ pub async fn run() -> Result<()> { logging::init(); let config = config::load()?; + if let Some((file, create)) = &config.node_id { + let new = !file.exists(); + let key = identity::NodeKey::load(file, *create)?; + if new { + eprintln!("a new node key in {}: a new node", file.display()); + } + println!("{}", key.id()); + return Ok(()); + } if config.print_only { println!( "{}", -- cgit v1.3.1