1.0.3 • Published 3 years ago

@artish1/react-native-keychain-store v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-keychain-store

Getting started

$ npm install react-native-keychain-store --save

or yarn add react-native-keychain-store

Mostly automatic installation

$ react-native link react-native-keychain-store

Usage

import KeychainStore from "react-native-keychain-store";

// Set key/value pair
const key = "myKey";
const value = "hello world";
const accessGroup = "XXXXXXX.accessGroupName"; // Optional

KeychainStore.setItem(key, value);
KeychainStore.setItem(key, value, accessGroup);

// retrieving an item
let keychainValue = await KeychainStore.getItem(key);
keychainValue = await KeychainStore.getItem(key, accessGroup);
console.log(keychainValue); // "helo world"

// Delete item
KeychainStore.deleteItem(key);
KeychainStore.deleteItem(key, accessGroup);

// Clear all items
KeychainStore.clear();
KeychainStore.clear(accessGroup);

All functions return a javascript Promise.

Keychain Sharing

Keychains can be shared across apps so long as they have the same TeamID and access group name. You can read more about keychain sharing here