Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: secrets.js
node v4.9.1
endpoint
share
tweet
const test = require('tape') const bip39 = require('bip39') const secrets = require('secrets.js') test('recover with some pieces', function (t) { const mnemonic = bip39.generateMnemonic() const seed = bip39.mnemonicToSeed(mnemonic) const hexSeed = seed.toString('hex') const pieces = secrets.share(hexSeed, 10, 5) const combined = secrets.combine(pieces.slice(0, 4)) t.notEqual(combined, hexSeed) const betterCombined = secrets.combine(pieces.slice(0, 5)) t.equal(betterCombined, hexSeed) t.end() })
Created from: https://runkit.com/npm/secrets.js
Loading…
no comments
sign in
to comment