Skip to content

Unable to read data saved with v5.5.8 after upgrading to v5.6.2 (Android) #542

@malwatte

Description

@malwatte

I'm running into an issue when upgrading react-native-sensitive-info on Android and hoping for some guidance.

We are upgrading:

react-native: 0.74.70.77.3
react-native-sensitive-info: 5.5.85.6.2

Issue

On Android, the app using v5.6.2 is unable to read data that was saved by the older app using v5.5.8.
This works perfectly fine on iOS, but fails on Android.

How data was saved (old app – v5.5.8)

SInfo.setItem(
  'TEST_DATA_KEY',
  'test_data_123',
  {
    sharedPreferencesName: 'TEST_DATA_KEY',
    keychainService: 'USER_SETTINGS_KEYCHAIN',
  },
)
  .then(() => {
    console.log('Data Saved!');
  })
  .catch(err => {
    console.log(err);
  });

How data is read (new app – v5.6.2)
This is how I'm reading the data:

SInfo.getItem(
  'TEST_DATA_KEY',
  {
    keychainService: 'USER_SETTINGS_KEYCHAIN',
  },
)
  .then(res => {
    console.log(res);
  })
  .catch(err => {
    console.log(err);
  });

Error
Failed to retrieve "TEST_DATA_KEY": Secret 'TEST_DATA_KEY' not found in service 'USER_SETTINGS_KEYCHAIN'

Environment
Device: Pixel 8
Android version: Android 16
iOS: Works as expected

From the release notes, I noticed there were changes to how data is stored, and it says automatic migration should happen, but I can't get it to work.

Any help or guidance would be greatly appreciated.
Thanks in advance! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions