aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-17 13:03:26 +0000
committertv <tv@krebsco.de>2026-11-17 14:22:37 +0100
commit10995f1dadbb0ab739b96d970cb0a58e2701b4c6 (patch)
treef002d249ac06ef45bcbe83ee4f7d2d1dcef9f2d2
parentbf896c2a604557a764e889b45e37dbe416c660ba (diff)
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.
-rw-r--r--src/federation/party.rs14
1 files changed, 11 insertions, 3 deletions
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<String> = 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::<Result<Vec<String>>>()?;
sign(&node, &signer, &mut record, &path, event::keys(&keys)).await
}
("nodes", sub) => {