mirror of
https://github.com/oed/seedsplit.git
synced 2026-01-10 13:17:59 -05:00
Small style changes
This commit is contained in:
@@ -5,7 +5,8 @@ const SECRET_LENGTH = 64
|
||||
|
||||
const lengthToPrefix = { 64: '', 56: 'd', 48: 'c', 40: 'b', 32: 'a' }
|
||||
const prefixToLength = { '': 64, 'd': 56, 'c': 48, 'b': 40, 'a': 32 }
|
||||
const getExtraEntopy = length => bip39.mnemonicToEntropy(bip39.generateMnemonic(128)).substring(0, SECRET_LENGTH - length)
|
||||
const getExtraEntopy = length => bip39.mnemonicToEntropy(
|
||||
bip39.generateMnemonic(SECRET_LENGTH * 2)).substring(0, SECRET_LENGTH - length)
|
||||
|
||||
|
||||
async function split(seed, numShards, threshold) {
|
||||
@@ -30,7 +31,7 @@ async function combine(shardMnemonics) {
|
||||
let prefix = ""
|
||||
let shards = shardMnemonics.map(sm => {
|
||||
if (!bip39.validateMnemonic(sm.split(' ').slice(1).join(' '))) {
|
||||
throw new Error('Invalid mnemonic')
|
||||
throw new Error('Invalid mnemonic ' + sm.split(' ')[0])
|
||||
}
|
||||
let buf = new Buffer.from('00' + bip39.mnemonicToEntropy(sm.split(' ').slice(1).join(' ')), 'hex')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user