纠正isSecword,使其对所有语言的secword都能用。

This commit is contained in:
陆柯 2020-03-12 20:52:25 +08:00
parent b923fec9cc
commit c9dbded768
2 changed files with 3 additions and 5 deletions

Binary file not shown.

View File

@ -60,11 +60,9 @@ module.exports = {
//// for bip39. 注意bip39对当前defaultWordlist之外其他语言的合法 mnemonic 也返回 false这一点不如 bitcore-mnemonic. 所以不能直接 bip39.validateMnemonic(secword)
if (typeof secword==='string' && 12===secword.split(/ +/).length) {
try {
bip39.mnemonicToEntropy(secword)
return true
}catch(exception){
return false
for (let lang of Object.keys(bip39.wordlists)) {
if (bip39.validateMnemonic(secword))
return true
}
}
return false