fix: refresh paykit key after wallet reset - #761
Open
ben-kaufman wants to merge 2 commits into
Open
ben-kaufman wants to merge 2 commits into
ben-kaufman wants to merge 2 commits into
Conversation
|
jvsena42
reviewed
Sep 18, 2026
jvsena42
left a comment
Member
There was a problem hiding this comment.
No findings.
Checked:
- No stale key after a reset. Every wallet replacement goes through
AppReset.wipe→Keychain.wipeEntireKeychain(), which deletespaykit_receiver_noise_secret_keyalong with the mnemonic.loadBytes()then returns nil, the cache clears, and the new seed's key is derived and upserted. - Locked-device read.
Keychain.loadthrows for any status other thanerrSecItemNotFound, so anerrSecInteractionNotAllowedread fails before the cache is cleared or anything is written. A mismatched stored key is rejected, never overwritten. - Concurrency.
loadOrDeriveandpersisthold the store'sNSLockacross the whole check-then-set. The injected closures don't re-enter the store, and lock order is always provider → store. A wipe racing a sign-in fails atpersistinstead of persisting a stale key. - Upgrade from v2.5.0 (pre-fix store). When stored matches derived, the first call re-validates and caches. No migration is needed.
- Tests. Both new tests fail on the pre-fix code, where the cached bytes were returned.
- Parity with synonymdev/bitkit-android@64ca85f2c. Android dropped the cache; iOS keys the cache on keychain equality. The outcome is the same.
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.
Description
This PR prevents private payment connections from reusing a previous wallet's Noise key after a wallet reset.
No SDK update, key format change, migration, UI change, or peer-state reset is included. This fixes the reproduced local key-cache bug; it does not establish that the staging server retained an old peer key or repair any already-stalled remote handshake.
Linked Issues/Tasks
Design
N/A — no UI changes.
Screenshot / Video
N/A — no UI changes.
QA Notes
Manual Tests
Automated Checks
BitkitTests/PaykitReceiverNoiseKeyStoreTests.swift: both new tests failed against the original code and passed with this fix; all seven key-store tests pass.PaykitSdkServiceTestpassed all 15 tests on current master, including the wallet-replacement regression. Published dependencies were used instead of incompatible local Maven artifacts.