tui: F8 rotate prekey + Node::rotate_prekey (hard cut, drops ratchet state)
All checks were successful
ci / test (pull_request) Successful in 5m0s
ci / sdk (pull_request) Successful in 1m11s
android-ci / android (pull_request) Successful in 8m36s

The signed prekey was set at invite creation and never rotated: a long-lived
static is a long-lived forward-secrecy window. F8 now rotates it.

- Node::rotate_prekey(): new X25519 keypair, written through the existing
  replace_identity_keys prekey columns (no store change needed), live Keys
  updated, new pubkey returned for the invite re-encode. Identity untouched.
- It drops every stored ratchet session: the bootstrap epoch is derived from
  the prekey DH, so each friend has to F3-paste the new invite. Nothing is
  pushed to peers \u2014 there is no in-band prekey update.
- TUI: F8 on Main opens the confirm screen (type ROTATE, same prompt as F4),
  then re-opens the F2 share path with the new invite; help overlay + footer
  hint list it.
- Docs: THREAT_MODEL gains a section on the F8 hard cut and the prekey-bound
  epoch bullet; README key table and PROTOCOL 'Roles and keys' follow.

Tests: node-level rotation test (identity/pk/stored row/ratchet drop/invite),
tests/rotate.rs screen text + prompt, tui_chrome help needs F8.
This commit is contained in:
rust-dev 2026-09-17 20:48:10 -04:00
commit 6827b87a29
No known key found for this signature in database
7 changed files with 177 additions and 2 deletions

View file

@ -130,3 +130,27 @@ fn rotate_prompt_text_matches_spec() {
assert!(t.contains("Type ROTATE to confirm"));
assert!(t.contains("Esc to cancel"));
}
#[test]
fn f8_prekey_rotation_screen_text_matches_spec() {
let t = onionwire::tui::prekey_screen_text();
assert!(t.contains("Rotate prekey?"));
assert!(t.contains("Your identity and onion stay the same."));
assert!(
t.contains("F3-paste"),
"the re-paste requirement is the whole point of the screen"
);
assert!(t.contains("Type ROTATE to confirm"));
assert!(t.contains("Esc to cancel"));
}
#[test]
fn f8_reuses_the_type_rotate_confirm_prompt() {
let mut p = RotatePrompt::new();
assert_eq!(p.on_esc(), RotateDecision::Cancel);
for c in "ROTA".chars() {
assert_eq!(p.on_char(c), RotateDecision::Pending);
}
assert_eq!(p.on_char('T'), RotateDecision::Pending);
assert_eq!(p.on_char('E'), RotateDecision::Confirm);
}

View file

@ -46,6 +46,7 @@ fn help_overlay_lists_core_bindings() {
"F4",
"F5",
"F6",
"F8",
"send chat",
"/profile",
"/pay",