RunKit + npm: secrets.js

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