Skip to content

fix: disable backup of mmkv keys in icloud - #5165

Merged
dnlsilva merged 4 commits into
developfrom
fix-set-mmkv-acessible-mode
Aug 17, 2023
Merged

dnlsilva merged 4 commits into
developfrom
fix-set-mmkv-acessible-mode

Conversation

@dnlsilva

@dnlsilva dnlsilva commented Aug 9, 2023 •

Copy link
Copy Markdown
Contributor

Proposed changes

Currently the mmkv library sets accessibility by default to when creating a value in the keychain, using the kSecAttrAccessibleAfterFirstUnlock property.
However, when restoring the backup, the library cannot update the backup data, since the keys are saved with an encryption that only stays on the device.
So when opening the app, she can't access the saved keys (thus having to login again) and also can't update the old keys (thus not saving the user session, having to login every time)

Updated the property so keys are only on the device and not backed up. kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly

And also in this PR we apply a patch so that the entire folder related to the mmkv backup is not sent to the backup as well, through the addSkipBackupAttributeToURLAtPath function that was injected via path package.

Issue(s)

How to test or reproduce

  • Restore an icloud backup on a new device and see if after login the session will remain active after closing the application.

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Jira: NATIVE-349

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