Skip to content

dbw03135/react-native-keychainstorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Easy Keychain Acess for React Native ( like AsyncStorage )

Resources

License

Stars

Watchers

Forks

Packages