Skip to content

fix: update signer when switching between LOCAL accounts#270

Merged
barrydeen merged 1 commit intomainfrom
fix/signer-not-updated-on-account-switch
Mar 18, 2026
Merged

fix: update signer when switching between LOCAL accounts#270
barrydeen merged 1 commit intomainfrom
fix/signer-not-updated-on-account-switch

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

Summary

  • When switching between two LOCAL (nsec) accounts, signingMode stays LOCAL so StateFlow conflation prevents recomposition — the old signer is reused, causing posts signed by the wrong key
  • Added npub as a remember key in Navigation.kt so the signer is always recreated on account switch
  • Added clearSigner() to FeedViewModel and call it during account switch and logout to prevent stale signing during the transition window

Test plan

  • Switch between two LOCAL accounts → verify posts are signed by the active account's pubkey
  • Check feed shows the correct follow list after switching
  • Switch back → verify signing identity follows
  • Test LOCAL → REMOTE and REMOTE → LOCAL switches still work
  • Test logout with remaining accounts → verify correct signer is active

When switching between two LOCAL (nsec) accounts, the signer was not
updated because signingMode (LOCAL → LOCAL) didn't change, so the
remember key was identical and the cached signer was reused. Add npub
as a recomposition key so the signer is always recreated on account
switch, and defensively clear the signer during switch/logout to
prevent stale signing.
@barrydeen barrydeen merged commit 24fbc7f into main Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant