Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/useWallet.js
Show First 20 Lines • Show All 835 Lines • ▼ Show 20 Lines | const createWallet = async importMnemonic => { | ||||
console.log(err); | console.log(err); | ||||
} | } | ||||
return wallet; | return wallet; | ||||
}; | }; | ||||
const validateMnemonic = (mnemonic, wordlist = bip39.wordlists.english) => { | const validateMnemonic = (mnemonic, wordlist = bip39.wordlists.english) => { | ||||
let mnemonicTestOutput; | let mnemonicTestOutput; | ||||
// temporary validation of wordlist exclusion | |||||
// to be removed in next diff in stack | |||||
console.log('english: ' + bip39.wordlists.english); | |||||
if ( | |||||
!bip39.wordlists.japanese && | |||||
!bip39.wordlists.spanish && | |||||
!bip39.wordlists.italian && | |||||
!bip39.wordlists.french && | |||||
!bip39.wordlists.korean && | |||||
!bip39.wordlists.czech && | |||||
!bip39.wordlists.portuguese && | |||||
!bip39.wordlists.chinese_traditional | |||||
) { | |||||
console.log( | |||||
'bip39 wordlist is excluding japanese, spanish, italian, french, korean, czech, portuguese and chinese', | |||||
); | |||||
} | |||||
try { | try { | ||||
mnemonicTestOutput = validateMnemonicWordList(mnemonic, wordlist); | mnemonicTestOutput = validateMnemonicWordList(mnemonic, wordlist); | ||||
if (mnemonicTestOutput === 'Valid mnemonic') { | if (mnemonicTestOutput === 'Valid mnemonic') { | ||||
return true; | return true; | ||||
} else { | } else { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 642 Lines • Show Last 20 Lines |