-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkeystore.doc.js
31 lines (26 loc) · 1.03 KB
/
keystore.doc.js
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
import KeyStore from './Libs/react-native-golden-keystore'
const mnemonicIsValid = (str) => KeyStore.mnemonicIsValid(str)
.then(isValid => console.log(isValid))
const generateMnemonic = () => KeyStore.generateMnemonic()
.then(mnemonic => console.log(mnemonic))
const createHDKeyPair = (
mnemonic = 'vibrant dinner choose observe deny mammal snow rule twin yellow swear ketchup',
passphrase = '',
path = KeyStore.CoinType.ETH.path, // `m/44'/60'/0'/0/index`
index = 0
) => KeyStore.createHDKeyPair(mnemonic, passphrase, path, index)
.then(({ private_key, public_key }) => console.log({ private_key, public_key }))
const createHDKeyPairs = (
mnemonic = 'vibrant dinner choose observe deny mammal snow rule twin yellow swear ketchup',
passphrase = '',
path = KeyStore.CoinType.ETH.path, // `m/44'/60'/0'/0/index`
from = 0,
to = 49
) => KeyStore.createHDKeyPairs(mnemonic, passphrase, path, from, to)
.then(keys => console.log(keys))
export default {
mnemonicIsValid,
generateMnemonic,
createHDKeyPair,
createHDKeyPairs
}