@vquelque/shamir_bip39
v1.0.1
Published
Typescript implementation of Shamir Secret Sharing for BIP-39 mnemonics
Downloads
4
Readme
Shamir Secret Sharing in Typescript
This is a typescript implementation of Shamir Secret Sharing for BIP-39 mnemonics commonly used to save cryptocurrency wallets private keys.
How to use
- Install the library in your project using
yarn install bipshamir
ornpm install bipshamir
- Create a new BIPShamir object
b = new BIPShamir(M,N)
with your configuration:N
: Total number of shares to createM
: Number of shares (threshold) needed to recover the secret
- Create the shares :
b.createShares(mnemonic)
wheremnemonic
is your BIP-39 seed phrase - You can recover the original BIP-39 seed by calling the static method
BIPShamir.recoverSecret(shares)
withshares
an array containing at leastM
shares
Principle
This library implements Shamir's Secret Sharing in Galois Field GF256. We choose to use GF256 in order to leverage bitwise operations and imporve performances. All arithmetic is done in GF256.
This library generates new mnemonics from your original BIP-39 mnemonic. Each mnemonic generated corresponds to a Shamir share. These mnemonics can be shared with different parties so that you can recover your original menmonic as long as you can access enough shares (more than the predefined threshold).
Shamir Secret Sharing is information theoratically secure. This means an adversary with unlimited computing power cannot infer anything from the original secret by observing any combination of K
shares as long as K < M
.