Skip to content

Fix wallet creation and import on Android - #996

Merged
gemcoder21 merged 2 commits into
mainfrom
fix/android-keystore-password-per-wallet
Aug 28, 2026
Merged

Fix wallet creation and import on Android#996
gemcoder21 merged 2 commits into
mainfrom
fix/android-keystore-password-per-wallet

Conversation

@DRadmir

@DRadmir DRadmir commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Creating or importing a wallet on Android stopped working for anyone who already had a wallet — the app failed with a "Password not found" error. The rule that decides when a new keystore password may be created was written for iOS, where all wallets share one password, and it does not fit Android, where every wallet has its own.

Each app now decides that for itself: Android creates a password for the new wallet as before, and iOS still refuses to replace the password that protects existing wallets.

Core applied the iOS shared-password rule to both apps. On Android the
password is stored per wallet, so once any keystore wallet existed the
new wallet's password could never be created and creation and import
failed. Core now states only that the wallet is new; iOS keeps its own
guard against replacing the password that protects stored wallets.
@DRadmir DRadmir self-assigned this Aug 28, 2026
@DRadmir
DRadmir requested review from 0xh3rman and gemcoder21 August 28, 2026 07:31
…password-per-wallet

# Conflicts:
#	core/gemstone/src/services/wallet/rules.rs

@gemcoder21 gemcoder21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right fix, and in the right place.

The regression came from df70459, which moved iOS's shared-password rule (can_create_password: no keystore wallet exists yet) into Core. Android gives every wallet its own password, so the second wallet arrived with create_if_missing = false and getPassword rethrew "Password not found".

Letting each adapter decide is the correct layering: the differing fact is the password model, which lives in the GemKeystorePassword implementation, not in the wallet list. Checking the keystore itself via has_stored_wallets is also stronger than the old wallet-list rule, and the password.isNotEmpty short-circuit keeps normal multi-wallet import on iOS working.

Two follow-ups, neither blocking: create_if_missing is now a literal true at its only call site and should leave the trait; and the new iOS test would be worth extending with a second import while the password is present, so a future reordering of that guard cannot pass silently.

@gemcoder21
gemcoder21 merged commit cb6ba96 into main Aug 28, 2026
7 checks passed
@gemcoder21
gemcoder21 deleted the fix/android-keystore-password-per-wallet branch August 28, 2026 15:53
@gemcoder21

Copy link
Copy Markdown
Contributor

Correction to my review: ignore the first follow-up. I said create_if_missing was a literal true at its only call site, but there are two — import_wallet passes true and setup_chains passes false, so the flag still carries a real distinction (importing may create a password; adding chains to an existing wallet must never). It stays. The second follow-up, extending the iOS test with an import while the password is present, still holds and I am adding it on main.

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.

2 participants