From 10995f1dadbb0ab739b96d970cb0a58e2701b4c6 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Nov 2026 13:03:26 +0000 Subject: continuum-party keys: a key set from authorized_keys lines, comments left out The federation spells a key without a comment, so a key set holding a line's comment is none. `continuum-party keys` takes each key as an `authorized_keys` line, one argument each, and writes it as the federation spells it. --- src/federation/party.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/federation') diff --git a/src/federation/party.rs b/src/federation/party.rs index cb9eb54..e3923a6 100644 --- a/src/federation/party.rs +++ b/src/federation/party.rs @@ -8,8 +8,8 @@ //! FILE`, from the file the store's swarm starts from, for a party that never voted in //! it: the record casts on every version, the first too; //! * `write PATH VALUE`: writes `VALUE` (JSON) at `PATH`; -//! * `keys KEY...`, `nodes NODE...`: writes the party's key set (`authorized_keys` lines) -//! or node list (node IDs); +//! * `keys KEY...`, `nodes NODE...`: writes the party's key set (`authorized_keys` lines, +//! each one argument, their comments left out) or node list (node IDs); //! * `propose FILE`: proposes the version `FILE` holds (JSON); //! * `vote PROPOSAL yes|no`: votes on the proposal of hash `PROPOSAL` on the current //! version, by the record; with `--through`, through the node that votes for the @@ -273,7 +273,15 @@ pub(crate) async fn main() -> Result<()> { .await } ("keys", sub) => { - let keys: Vec = strings(sub, "keys"); + // As the federation spells a key: without the line's comment. + let keys = strings(sub, "keys") + .iter() + .map(|line| { + PublicKey::parse(line) + .map(|key| key.line()) + .map_err(|why| anyhow!("{line:?}: {why}")) + }) + .collect::>>()?; sign(&node, &signer, &mut record, &path, event::keys(&keys)).await } ("nodes", sub) => { -- cgit v1.3.1