react-native-encrypted-storage icon indicating copy to clipboard operation
react-native-encrypted-storage copied to clipboard

Add support for storage options

Open calintamas opened this issue 3 years ago • 7 comments

Hi @emeraldsanto, thank you for this great library! This PR adds support for storage options, namely:

Both are optional and have sensible defaults (which we can change if you think it's required).

In terms of the API, I added an options object as the previous to last parameter to all methods (before the optional cb).

import EncryptedStorage, {
  KeychainAccessibility,
} from 'react-native-encrypted-storage'

await EncryptedStorage.setItem(key, value, {
    storageName: 'myStorage',
    keychainAccessibility: KeychainAccessibility.kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
})

Following semver, this would be a breaking change in the function signature, so I suppose it requires a major version bump (if you agree with the API / approach).

Please let me know what you think.

calintamas avatar Dec 20 '21 13:12 calintamas

@emeraldsanto could you have a look at this?

We are storing JWT refresh tokens in react-native-encrypted-storage and are seeing quite a lot of error -25308 on iOS (and other people in https://github.com/emeraldsanto/react-native-encrypted-storage/issues/29 do as well).

It would make a lot of sense for us to set keychainAccessibility to kSecAttrAccessibleWhenUnlocked, which this PR allows.

#91 also points a potential issue with this.

renchap avatar Nov 13 '22 11:11 renchap

This would be helpful to have for our business use case as well 👍

ryeker-herndon-lark avatar Nov 16 '22 22:11 ryeker-herndon-lark

@emeraldsanto any plans to merge this PR? This'll solve several issues all of us are facing.

balsikandar avatar Dec 14 '22 19:12 balsikandar

Will this pull request be merged?

misha-pavlov avatar Apr 25 '23 20:04 misha-pavlov

Also looking for this to be merged as it would resolve thousands of Sentry errors. Any update?

chriswickham avatar May 25 '23 14:05 chriswickham

Any updates? @emeraldsanto

varda-altusnova avatar Jul 06 '23 10:07 varda-altusnova

I have same problem. Should I wait for merge or make patch?

qja0707 avatar Jul 21 '23 02:07 qja0707