aboutsummaryrefslogtreecommitdiff
path: root/src/mnemonics
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-03-05 12:57:21 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-03-06 10:26:15 +0000
commit064eeb286129d88bab60a81c08c319fbc91c5770 (patch)
treeae3902d678b1c7ab93b29b9524029d017e1aeccd /src/mnemonics
parentMerge pull request #7381 (diff)
downloadmonero-064eeb286129d88bab60a81c08c319fbc91c5770.tar.xz
wallet_rpc_server: set seed language in generate_from_keys
Also sanity check language name
Diffstat (limited to 'src/mnemonics')
-rw-r--r--src/mnemonics/electrum-words.cpp8
-rw-r--r--src/mnemonics/electrum-words.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mnemonics/electrum-words.cpp b/src/mnemonics/electrum-words.cpp
index b6bc22a3d..8c79a53ca 100644
--- a/src/mnemonics/electrum-words.cpp
+++ b/src/mnemonics/electrum-words.cpp
@@ -491,6 +491,14 @@ namespace crypto
return "<language not found>";
}
+ bool is_valid_language(const std::string &language)
+ {
+ const std::vector<const Language::Base*> language_instances = get_language_list();
+ for (std::vector<const Language::Base*>::const_iterator it = language_instances.begin(); it != language_instances.end(); it++)
+ if ((*it)->get_english_language_name() == language || (*it)->get_language_name() == language)
+ return true;
+ return false;
+ }
}
}
diff --git a/src/mnemonics/electrum-words.h b/src/mnemonics/electrum-words.h
index 8d4c5be66..eb0c99e0b 100644
--- a/src/mnemonics/electrum-words.h
+++ b/src/mnemonics/electrum-words.h
@@ -124,6 +124,8 @@ namespace crypto
* \return the name of the language in English
*/
std::string get_english_name_for(const std::string &name);
+
+ bool is_valid_language(const std::string &language);
}
}