t_2fb507c6: F8 rotate prekey (Node::rotate_prekey + invite re-encode) #101
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_2fb507c6"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Card
Prekey rotation path — add
rotate_prekey()+ F8 QR re-encode (t_2fb507c6).What this does
The signed prekey was generated at invite creation and never rotated: a long-lived static is a long-lived forward-secrecy window.
F8now rotates it.Node::rotate_prekey()(src/node.rs) generates a new X25519 keypair, writes it to theselfrow, updates the liveKeys, drops every stored ratchet session, and returns the new pubkey so the caller can re-encode the invite. The identity key (and the fingerprint) does not move.F8(Main) opens a confirm screen — the same "type ROTATE" prompt as F4, reusingRotatePrompt— and on confirm re-opens the F2 share path with the new invite.Why every friend must re-paste
The prekey is our Noise IK static and the seed of the bootstrap ratchet epoch (
bootstrap_ratchet,src/node.rs). After a rotation a friend's dial uses the prekey they pinned from your invite, and their stored epoch is derived from the old one, so nothing decrypts in either direction until they F3-paste the new one. There is no in-band prekey update, so F8 hard-cuts locally:clear_ratchetfor every friend, exactly likeadd_friend_payloaddoes on a peer prekey change.The card's suggested copy said "Offline friends must F3-paste your new invite"; that implies online friends pick it up on their own, and they do not — no
locframe carries a prekey. The screen text says every friend must re-paste, anddocs/THREAT_MODEL.mdspells the mechanics out.Implementation notes
Store::replace_identity_keysalready rewrites theprekey_sk/prekey_pkcolumns, so the identity values passed back are the ones already stored. Card scope was node.rs / tui.rs / THREAT_MODEL.md and this keeps it that way.rotate_prekeyis synchronous and does not touch Tor (nothing is pushed to peers), unlikerotate, which has to publish a new onion service.Scope deviations (disclosed)
README.md's key table anddocs/PROTOCOL.md's "Roles and keys" gained one line each: the new binding, and the sentence that said the prekey is long-lived and only F4 exists was now stale.docs/TUI.md's help-overlay dump was already stale before this PR (it never listed F6) and was left alone.tests/rotate.rs(screen text + prompt reuse),tests/tui_chrome.rs(the help overlay must list F8), and a node-level test insidesrc/node.rs'smod tests—tests/*.rscannot build aNodebecause both public constructors bootstrap Tor and publish an onion service.Evidence
cargo test --locked— exit 0, 32 suites, 294 passed / 0 failed.cargo clippy --locked --all-targets -- -D warnings— clean.rotating_the_prekey_keeps_identity_and_drops_stale_ratchet_stateasserts the prekey changes, the live and stored keys follow, the identity is unchanged, the friend's stored ratchet state is gone, and the re-encoded invite decodes back to the same identity with the newspk.--checkhunk count onsrc/node.rsis 7 both before and after, so no new formatting churn in an already-dirty file.