polyseed fix
tobtoht: Since only the composed languages are broken, it could also be that canonical composition is producing weird output. Try dumping whatever seed string is being fed to polyseed_decode to hex and we should be able to tell. Or try removing UTF8PROC_LUMP from utf8_nfc
This commit is contained in:
@@ -1135,10 +1135,12 @@ const char* MONERO_Wallet_getPolyseed(void* wallet_ptr, const char* passphrase)
|
||||
return buffer;
|
||||
}
|
||||
// static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English");
|
||||
const char* MONERO_Wallet_createPolyseed() {
|
||||
const char* MONERO_Wallet_createPolyseed(const char* language) {
|
||||
std::string seed_words = "";
|
||||
std::string err;
|
||||
Monero::Wallet::createPolyseed(seed_words, err);
|
||||
Monero::Wallet::createPolyseed(seed_words, err, std::string(language));
|
||||
std::cout << "MONERO_Wallet_createPolyseed(language: " << language << "):" << std::endl;
|
||||
std::cout << " err: " << err << std::endl;
|
||||
std::string str = seed_words;
|
||||
const std::string::size_type size = str.size();
|
||||
char *buffer = new char[size + 1]; //we need extra char for NUL
|
||||
|
||||
@@ -645,7 +645,7 @@ extern ADDAPI void MONERO_Wallet_init3(void* wallet_ptr, const char* argv0, cons
|
||||
// virtual bool getPolyseed(std::string &seed, std::string &passphrase) const = 0;
|
||||
extern ADDAPI const char* MONERO_Wallet_getPolyseed(void* wallet_ptr, const char* passphrase);
|
||||
// static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English");
|
||||
extern ADDAPI const char* MONERO_Wallet_createPolyseed();
|
||||
extern ADDAPI const char* MONERO_Wallet_createPolyseed(const char* language);
|
||||
extern ADDAPI void MONERO_Wallet_startRefresh(void* wallet_ptr);
|
||||
// virtual void pauseRefresh() = 0;
|
||||
extern ADDAPI void MONERO_Wallet_pauseRefresh(void* wallet_ptr);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
From bf347a3c80f0e0647176752867a54ae9ecedb580 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 12 Mar 2024 09:42:37 +0100
|
||||
Subject: [PATCH 1/8] polyseed
|
||||
|
||||
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
---
|
||||
.github/workflows/build.yml | 4 +-
|
||||
.gitmodules | 6 +
|
||||
@@ -533,7 +534,7 @@ index 000000000..b26f37574
|
||||
+ static size_t utf8_nfc(const char* str, polyseed_str norm) {
|
||||
+ // Note: UTF8PROC_LUMP is used here to replace the ideographic space with a regular space for Japanese phrases
|
||||
+ // to allow wallets to split on ' '.
|
||||
+ return utf8_norm(str, norm, (utf8proc_option_t)(UTF8PROC_NULLTERM | UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_STRIPNA | UTF8PROC_LUMP));
|
||||
+ return utf8_norm(str, norm, (utf8proc_option_t)(UTF8PROC_NULLTERM | UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_STRIPNA));
|
||||
+ }
|
||||
+
|
||||
+ static size_t utf8_nfkd(const char* str, polyseed_str norm) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
From 33d611538efef134106f427c7ee5535d28d588f6 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 26 Mar 2024 08:19:23 +0100
|
||||
Subject: [PATCH 2/9] polyseed support
|
||||
|
||||
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
---
|
||||
.github/workflows/build.yml | 4 +-
|
||||
.gitmodules | 6 +
|
||||
@@ -533,7 +534,7 @@ index 000000000..b26f37574
|
||||
+ static size_t utf8_nfc(const char* str, polyseed_str norm) {
|
||||
+ // Note: UTF8PROC_LUMP is used here to replace the ideographic space with a regular space for Japanese phrases
|
||||
+ // to allow wallets to split on ' '.
|
||||
+ return utf8_norm(str, norm, (utf8proc_option_t)(UTF8PROC_NULLTERM | UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_STRIPNA | UTF8PROC_LUMP));
|
||||
+ return utf8_norm(str, norm, (utf8proc_option_t)(UTF8PROC_NULLTERM | UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_STRIPNA));
|
||||
+ }
|
||||
+
|
||||
+ static size_t utf8_nfkd(const char* str, polyseed_str norm) {
|
||||
|
||||
Reference in New Issue
Block a user