react-native-keychainstorage
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

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

Package Sidebar

Install

npm i react-native-keychainstorage

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

4.92 kB

Total Files

6

Last publish

Collaborators

  • dbw03135