Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): react-native-keychain upgrade + migrate to @interaxyz fork #6470

Merged
merged 7 commits into from
Feb 4, 2025

Conversation

bakoushin
Copy link
Contributor

@bakoushin bakoushin commented Jan 31, 2025

Description

Migrate react-native-keychain to the @interaxyz fork in order to get rid of the patch.

The patch changes are implemented in the fork:
oblador/react-native-keychain@master...mobilestack-xyz:react-native-keychain:intera-fork

Since the current version (8.2.0) is outdated, it was also upgraded to the latest one (9.2.2), which required some refactoring.

Test plan

  • CI
  • Manually tested on iOS device
  • Manually tested on an Android emulator

Manual test plan:

  • Start existing wallet after upgrade
  • Display recovery phrase
  • Sign transaction
  • Restore wallet using a recovery phrase
  • Display recovery phrase

The library migrates the secrets storage in Android from SharedPreferences to DataStore in version 9.2.0. While the migration is expected to be seamless, perhaps we should do as much manual testing on devices as we can to ensure there is no major issue.

Related issues

Backwards compatibility

Y

Network scalability

NA

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.02%. Comparing base (60ecc4e) to head (c844766).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main    #6470    +/-   ##
========================================
  Coverage   89.02%   89.02%            
========================================
  Files         729      729            
  Lines       31899    31899            
  Branches     5829     6151   +322     
========================================
  Hits        28397    28397            
+ Misses       3454     3303   -151     
- Partials       48      199   +151     
Files with missing lines Coverage Δ
src/app/actions.ts 94.36% <ø> (ø)
src/app/reducers.ts 26.82% <ø> (ø)
src/app/saga.ts 70.61% <100.00%> (ø)
src/onboarding/registration/EnableBiometry.tsx 100.00% <100.00%> (ø)
src/onboarding/steps.ts 95.08% <ø> (ø)
src/pincode/PincodeSet.tsx 94.59% <ø> (ø)
src/pincode/authentication.ts 88.01% <100.00%> (ø)
src/storage/keychain.tsx 88.63% <100.00%> (ø)
test/mockedKeychain.ts 100.00% <100.00%> (ø)

... and 63 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60ecc4e...c844766. Read the comment docs.

@@ -27,7 +27,6 @@ export async function storeItem({ key, value, options = {} }: SecureStorage) {
const result = await Keychain.setGenericPassword('CELO', value, {
service: key,
accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
rules: Keychain.SECURITY_RULES.NONE,
Copy link
Contributor Author

@bakoushin bakoushin Feb 3, 2025

Choose a reason for hiding this comment

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

this one is moved from the setter to the getter.

seems reasonable as this rule is steering the upgrade process which happens only at requesting the secret

@@ -85,7 +85,7 @@ export async function removeStoredItem(key: string) {

export async function listStoredItems() {
try {
return Keychain.getAllGenericPasswordServices()
return Keychain.getAllGenericPasswordServices({ skipUIAuth: true })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -191,7 +191,6 @@ function storePinWithBiometry(pin: string) {
options: {
accessControl: Keychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET,
accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
authenticationType: Keychain.AUTHENTICATION_TYPE.BIOMETRICS,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this property is gone in 9.2.2

probably not a big deal since we have accessControl property above which seems more elaborated

see also:

@bakoushin bakoushin marked this pull request as ready for review February 3, 2025 12:12
Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

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

Awesome! 🚀

I guess we'll probably need to do some additional testing before the next release (at bugapalooza?) to ensure the upgrade works as expected with existing accounts.

@kathaypacific you might want take a look at this one too since you initially added biometrics.

Copy link
Collaborator

@kathaypacific kathaypacific left a comment

Choose a reason for hiding this comment

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

🚀 also looks good to me!

do we need bugapalooza? if it's only for the biometrics, perhaps we can all find a few minutes to test it on the nightly tomorrow separately instead?

@bakoushin
Copy link
Contributor Author

@kathaypacific the main thing to ensure is that users will not lose access to their PINs after the upgrade, because the library migrated to a different storage type on Android. I guess this can be mostly done by testing upgrades on different devices/Android versions.

probably additional manual testing of a nightly build on different Android versions on the emulator could help mitigate this risk. I can do that.

if we can also ask folks to check the nightly builds on their phones, that would be also helpful. not sure about bugapalooza, since we are worrying mostly about the update which happens automatically, not as a result of some unexpected user interaction.

perhaps we could ask folks first to install the current nightly version, and then check it the next day after we merge the library update.

@bakoushin bakoushin added this pull request to the merge queue Feb 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 4, 2025
@bakoushin bakoushin added this pull request to the merge queue Feb 4, 2025
Merged via the queue into main with commit f5f4a2c Feb 4, 2025
16 checks passed
@bakoushin bakoushin deleted the alex/react-native-keychain-upgrade branch February 4, 2025 12:34
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.

3 participants