fix: overwrite stale delegate signing key after re-invitation#169
Merged
fix: overwrite stale delegate signing key after re-invitation#169
Conversation
When a user is re-invited to a room, the delegate retains the old signing key. migrate_signing_key() detected the mismatch but returned false instead of overwriting, leaving the stale key in place. Since sign_message_with_fallback() tries the delegate first and the delegate "succeeds" (with the wrong key), messages fail signature verification on all peers. Fix: fall through to the store_signing_key path when a key mismatch is detected, overwriting the stale key with the current one. Closes #165 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After PR #164 (delegate signing API change), all users were re-invited. The re-invitation updates the user's
self_sk(signing key) in the UI, but the chat delegate retains the old signing key.migrate_signing_key()detects the mismatch at startup but returnsfalseinstead of overwriting the stale key. Sincesign_message_with_fallback()tries the delegate first and the delegate "succeeds" (signs with the wrong key), the fallback (correct key) is never reached. Every message signed this way fails signature verification on all peers — creating a one-way split brain where the sender sees their own messages (optimistic local state) but nobody else does.Approach
Change the key-mismatch branch in
migrate_signing_key()from early-return to fall-through, so it reaches the existingstore_signing_key+ verify path. This overwrites the stale delegate key with the current one. The fix is 3 lines inui/src/signing.rs.No delegate WASM changes — only UI-side logic, so no delegate migration needed.
Testing
cargo check -p river-ui --target wasm32-unknown-unknown --features no-syncpassesState verification failed: Invalid message signatureon Ian's node starting at 06:04 UTC March 13, correlated with the delegate warningDelegate has different key for room[AI-assisted - Claude]