Skip to content

tkey/tkey-react-native-storage-module

Repository files navigation

tKey React Native Storage Module

npm version minzip

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+