Easy Keychain Access for React Native ( like AsyncStorage )
$ yarn add react-native-keychainstorage
or
$ npm install --save react-native-keychainstorage
See how to link "react-native-keychain"
https://github.com/oblador/react-native-keychain
import KeychainStorage from 'react-native-keychainstorage';
storeData = async () => {
try {
await KeychainStorage.setItem('@storage_Key', 'stored value')
} catch (e) {
// saving error
}
}
getData = async () => {
try {
const value = await KeychainStorage.getItem('@storage_Key')
if(value !== null) {
// value previously stored
}
} catch(e) {
// error reading value
}
}
getData = async () => {
try {
await KeychainStorage.removeItem('@storage_Key')
} catch(e) {
// error remove value
}
}
MIT