react-native-secure-keychain
v1.0.1
Published
Secure keychain for your react native app. (Like AsyncStorage)
Downloads
3
Readme
React native secure keychain
Secure your keychain in react native app!
Installing
npm install react-native-secure-keychain --save
- or -
yarn add react-native-secure-keychain
Usage
import React from 'react';
import RNSecureKeychain from 'react-native-secure-keychain';
export default class Example extends React.Component
{
constructor()
{
//THE MOST IMPORTANT THING! YOU HAVE TO UNLOCK THE KEYCHAIN BEFORE FIRST USAGE!
RNSecureKeychain.unlock();
}
componentDidMount()
{
RNSecureKeychain.load('folder/file')
.then(( content ) =>
{
RNSecureKeychain.save('folder/file', {}).catch( err => null );
RNSecureKeychain.remove('folder/file');
}).catch( e => {});
}
}
API
unlock
You need to unlock keychain for security reasons. This should be insert before load your UI.
load
Load file from keychain. Returns JSON object or string.
save
Save file to path. You can save JSON object or string.
remove
Remove file at path.