Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 1021 Bytes

README.md

File metadata and controls

80 lines (54 loc) · 1021 Bytes

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