Get value from SecureStore on native application

Hi I have a RN app which I’m saving on SecureStorage the value test
SecureStore.setItemAsync('test', 'test');

I assume that if I create a new native app with the same bundle Id, I should be able to get this information after update the app. is this possible and how can I do this?

I’ve tried with KeychainWrapper
KeychainWrapper.standard.string(forKey: "test")

but the result is nil

Normally you use SecureStore.getItemAsync('itemkey') to get the item back out. Did you try using the SecureStoreOptions to set the keychainService, like this: SecureStore.getItemAsync('itemKey', {'keychainService'}) ?

I’m trying to get the info in the native ios app, which is a update of Reactive native version. same bundle id

You’ll probably want to inspect the SecureStore source really closely for differences between what they’re doing and what KeychainWrapper is doing: https://github.com/expo/expo/blob/5b2f50c5cbe19a3a15287dda8bf1195edfe93e6c/ios/versioned-react-native/ABI33_0_0/EXSecureStore/ABI33_0_0EXSecureStore/ABI33_0_0EXSecureStore.m

I’ve found the answer myself!

The complete process can be found on my StackOverflow answer (link). Here is the most important part, that caused the problem for me:

the trickiest part is setting the correct key (kSecAttrAccount) for the keychain item I wanted to get. What helped me was to use the Flutter plugin’s readAll method (link to the native source code of readAll on GitHub). It showed me that the keychain items were actually there, but that the keys were different than the ones ReactNative app was using. As I’ve found out by debugging (it’s nowhere in the docs!!!), the expo username and expo project’s name are added before the string used for the key! So, if in the ReactNative app you save a token with key accessToken, it will be saved to the Keychain as @expousername/project-name-accessToken! It’s nowhere in the docs, and I don’t know how it happens, because I’ve looked through the source code.

Also, don’t forget to set the keychainService (in native code it’s the kSecAttrService attribute) to Expo’s default keychainService, which is app. You can see that yourself here , on the expo native library’s source code on GitHub (link).