@tkey/react-native-storage
v12.0.0
Published
TKey React Native Storage Module
Downloads
257
Readme
tKey React Native Storage Module
The tKey React Native Storage Module helps you store and recall key shares in the react-native secure storage. This module is the part of the tKey SDK.
Installation
npm install --save @tkey/react-native-storage
Initialization
Bare React Native
import { ReactNativeStorageModule } from "@tkey/react-native-storage";
import EncryptedStorage from "react-native-encrypted-storage";
const reactNativeStorageModule = new ReactNativeStorageModule(EncryptedStorage);
Expo React Native
import { ReactNativeStorageModule } from "@tkey/react-native-storage";
import * as SecureStore from "expo-secure-store";
const reactNativeStorageModule = new ReactNativeStorageModule(SecureStore);
Usage
Get ShareStore from Storage
const share = await(tKeyInstance.modules.reactNativeStorage as ReactNativeStorageModule).getStoreFromReactNativeStorage();
Store Device Share
const generateShareResult = await tKeyInstance.generateNewShare();
const share = await tKeyInstance.outputShareStore(generateShareResult.newShareIndex);
await(tKeyInstance.modules.reactNativeStorage as ReactNativeStorageModule).storeDeviceShare(share);
See the full SDK Reference on the Web3Auth Documentation
Requirements
- This package requires a peer dependency of
@babel/runtime
- Node 18+