diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-02-17 18:10:28 +0100 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-02-17 18:10:28 +0100 |
| commit | 67c47c5491b022f74a0af8138b69ae614527bdba (patch) | |
| tree | 3c855e6061725376e63199c563c45f3090523056 /libbridge/src/main/cpp | |
| parent | c7c553a7f32f754c77897db2e53c1e8771d4f2cf (diff) | |
add signing functionality
Diffstat (limited to 'libbridge/src/main/cpp')
| -rw-r--r-- | libbridge/src/main/cpp/wallet2_api_c.cpp | 15 | ||||
| -rw-r--r-- | libbridge/src/main/cpp/wallet2_api_c.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libbridge/src/main/cpp/wallet2_api_c.cpp b/libbridge/src/main/cpp/wallet2_api_c.cpp index 5659bb4..c7d1570 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.cpp +++ b/libbridge/src/main/cpp/wallet2_api_c.cpp @@ -1317,6 +1317,21 @@ const char* MONERO_Wallet_getTxKey(void* wallet_ptr, const char* txid) { return buffer; } +const char* MONERO_Wallet_signMessage(void* wallet_ptr, const char* message, const char* address) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + std::string str = wallet->signMessage(std::string(message), std::string(address)); + const std::string::size_type size = str.size(); + char *buffer = new char[size + 1]; //we need extra char for NUL + memcpy(buffer, str.c_str(), size + 1); + return buffer; +} + +bool MONERO_Wallet_verifySignedMessage(void* wallet_ptr, const char* message, const char* address, const char* signature) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + bool v = wallet->verifySignedMessage(std::string(message), std::string(address), std::string(signature)); + return v; +} + bool MONERO_Wallet_rescanSpent(void* wallet_ptr) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return wallet->rescanSpent(); diff --git a/libbridge/src/main/cpp/wallet2_api_c.h b/libbridge/src/main/cpp/wallet2_api_c.h index 300d3ca..a600be7 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.h +++ b/libbridge/src/main/cpp/wallet2_api_c.h @@ -757,7 +757,9 @@ const char* MONERO_Wallet_getTxKey(void* wallet_ptr, const char* txid); // virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const = 0; // virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const = 0; // virtual std::string signMessage(const std::string &message, const std::string &address = "") = 0; +const char* MONERO_Wallet_signMessage(void* wallet_ptr, const char* message, const char* address); // virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0; +bool MONERO_Wallet_verifySignedMessage(void* wallet_ptr, const char* message, const char* address, const char* signature); // virtual std::string signMultisigParticipant(const std::string &message) const = 0; // virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const = 0; // virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) = 0; |
