纠正isSecword,使其对所有语言的secword都能用。
This commit is contained in:
parent
b923fec9cc
commit
c9dbded768
BIN
README.xlsx
BIN
README.xlsx
Binary file not shown.
8
index.js
8
index.js
@ -60,11 +60,9 @@ module.exports = {
|
|||||||
|
|
||||||
//// for bip39. 注意,bip39对当前defaultWordlist之外其他语言的合法 mnemonic 也返回 false,这一点不如 bitcore-mnemonic. 所以不能直接 bip39.validateMnemonic(secword)
|
//// for bip39. 注意,bip39对当前defaultWordlist之外其他语言的合法 mnemonic 也返回 false,这一点不如 bitcore-mnemonic. 所以不能直接 bip39.validateMnemonic(secword)
|
||||||
if (typeof secword==='string' && 12===secword.split(/ +/).length) {
|
if (typeof secword==='string' && 12===secword.split(/ +/).length) {
|
||||||
try {
|
for (let lang of Object.keys(bip39.wordlists)) {
|
||||||
bip39.mnemonicToEntropy(secword)
|
if (bip39.validateMnemonic(secword))
|
||||||
return true
|
return true
|
||||||
}catch(exception){
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user