react-native-keychainstorage
v2.0.0
Published
Easy Keychain Acess for React Native ( like AsyncStorage )
Downloads
7
Maintainers
Readme
React Native Keychain Storage
Easy Keychain Access for React Native ( like AsyncStorage )
Getting Started
Install
$ yarn add react-native-keychainstorage
or
$ npm install --save react-native-keychainstorage
Link
See how to link "react-native-keychain"
https://github.com/oblador/react-native-keychain
Usage
Import
import KeychainStorage from 'react-native-keychainstorage';
Store data
storeData = async () => {
try {
await KeychainStorage.setItem('@storage_Key', 'stored value')
} catch (e) {
// saving error
}
}
Read data
getData = async () => {
try {
const value = await KeychainStorage.getItem('@storage_Key')
if(value !== null) {
// value previously stored
}
} catch(e) {
// error reading value
}
}
Remove data
getData = async () => {
try {
await KeychainStorage.removeItem('@storage_Key')
} catch(e) {
// error remove value
}
}
License
MIT