fix: do not valid mnemonic word if others exist in import

This commit is contained in:
poka 2022-06-07 19:06:46 +02:00
parent d7fcf0636f
commit 3f75fa5c20
1 changed files with 14 additions and 1 deletions

View File

@ -273,12 +273,25 @@ class GenerateWalletsProvider with ChangeNotifier {
}
bool isBipWord(String word) {
bool isValid = false;
notifyListeners();
// Needed for bad encoding of UTF-8
word = word.replaceAll('é', '');
word = word.replaceAll('è', '');
return bip39Words(appLang).contains(word.toLowerCase());
int nbrMatch = 0;
if (bip39Words(appLang).contains(word.toLowerCase())) {
for (var bipWord in bip39Words(appLang)) {
if (bipWord.startsWith(word)) {
log.d('ploppp : ' + nbrMatch.toString());
isValid = nbrMatch == 0 ? true : false;
nbrMatch = nbrMatch + 1;
}
}
}
return isValid;
}
bool isBipWordsList(List<String> words) {