-
Notifications
You must be signed in to change notification settings - Fork 1
/
tkey.ts
46 lines (39 loc) · 1.39 KB
/
tkey.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import ThresholdKey from '@tkey/core';
import SFAServiceProvider from '@tkey/service-provider-sfa';
import TorusStorageLayer from '@tkey/storage-layer-torus';
import {ShareSerializationModule} from '@tkey/share-serialization';
import {ReactNativeStorageModule} from '@tkey/react-native-storage';
import EncryptedStorage from 'react-native-encrypted-storage';
const clientId =
'BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ'; // get from https://dashboard.web3auth.io
export const chainConfig = {
chainId: '0x1',
rpcTarget: 'https://rpc.ankr.com/eth',
displayName: 'mainnet',
blockExplorer: 'https://etherscan.io/',
ticker: 'ETH',
tickerName: 'Ethereum',
};
const web3AuthOptions: any = {
clientId, // Get your Client ID from Web3Auth Dashboard
chainConfig,
web3AuthNetwork: 'sapphire_mainnet',
};
// Configuration of Service Provider
const serviceProvider = new SFAServiceProvider({web3AuthOptions});
// Instantiation of Storage Layer
const storageLayer = new TorusStorageLayer({
hostUrl: 'https://metadata.tor.us',
});
// Configuration of Modules
const reactNativeStorage = new ReactNativeStorageModule(EncryptedStorage);
const shareSerialization = new ShareSerializationModule();
// Instantiation of tKey
export const tKey = new ThresholdKey({
serviceProvider,
storageLayer,
modules: {
shareSerialization,
reactNativeStorage,
},
});