0.1.3 • Published 3 years ago
sss-bip39-js v0.1.3
bip39-sss-js-sdk
Split BIP39 mnemonics using Shamir's Secret Sharing Scheme Integrated 'bip39' lib
Guild
To generate mnemonic with 'bip39' lib.
import { generateTwelveWordsMnemonic } from 'bip39-sss-js-sdk'; const generated_mnemonic = generateTwelveWordsMnemonic();
To generate M/N mnemonic shares
To generate M shares and require N to recover the mnemonic, (N >= M/2 + 1).
Accepts a BIP39 mnemonic and returns a Shares map, in which the keys are the share id's, and the values are the BIP39 mnemonics.
import { splitMnemonic } from "bip39-sss-js-sdk"
splitMnemonic(example_mnemonic, 3, 2); // to split 3 shares and requeire 2 share to recover the mnemonic splitMnemonic(example_mnemonic, 5, 3); splitMnemonic(example_mnemonic, m, n);
To recover mnemonic
import { recoverMnemonic } from "bip39-sss-js-sdk" recoverMnemonic(split_1_3_5_for_generated_5_3) // use the 1st, 3rd, 5th to recover the orginal/real mnemonic
To get address or private key with 'web3'
import { getEntropyByMnemonic } from 'bip39-sss-js-sdk'; web3.eth.accounts.create(getEntropyByMnemonic(generated_mnemonic)) // to get account with web3
Reference
0.1.3
3 years ago