Watch
0
0
Fork
You've already forked hyperhive
0

swarmctl bao init: save bao's raw output before parsing, and accept null key lists

This commit is contained in:
atlas 2026-11-24 15:35:57 +01:00
commit 870a0a6697

View file

@ -256,6 +256,8 @@ pub(crate) trait Ui {
pub(crate) struct Initialised {
/// Each key and the root token on a labelled line.
pub(crate) text: Zeroizing<String>,
/// The file holding `bao`'s raw init output.
pub(crate) saved_to: String,
pub(crate) root_token: Zeroizing<String>,
}
@ -615,9 +617,13 @@ fn init(ui: &mut impl Ui, actions: &mut impl Actions, session: &mut Session) ->
Tone::Warn,
"⚠️ The unseal or recovery keys and the root token follow.",
);
ui.say(Tone::Warn, "⚠️ They are shown once.");
ui.say(
Tone::Warn,
"⚠️ They are shown once. swarmctl stores none of them and cannot show them again.",
&format!(
"⚠️ bao's raw init output is also saved in {}, readable by its owner only. Delete it with `shred -u` once you have recorded the keys.",
initialised.saved_to
),
);
ui.say(
Tone::Warn,
@ -902,6 +908,7 @@ mod tests {
"Recovery key 1: RK1\nInitial root token: hvs.ROOT\n".to_owned(),
),
root_token: Zeroizing::new("hvs.ROOT".to_owned()),
saved_to: "/root/bao-init.json".to_owned(),
})
}