monero-cpp
monero-cpp copied to clipboard
Expose wallet2::{en,de}crypt in monero_wallet_full
This will only work after https://github.com/monero-project/monero/pull/8515 is merged and integrated here, so after review the API might change. I tested this using:
auto w = monero_wallet_full::create_wallet_random( "", "", monero_network_type::TESTNET );
for (const auto& text : std::array<std::string,4>{"Restricted","Restricted0","Restricted01","Restricted012"}) {
for (auto authenticated : std::array<bool,2>{false,true}) {
uint64_t pad;
auto ciphertext_z85 = w->encrypt_message( text, pad, authenticated );
auto cleartext = w->decrypt_message( ciphertext_z85, pad, authenticated );
std::cout << "'" << text << "', " << authenticated << ", " << ciphertext_z85 << ", " << pad << ", '" << cleartext << "'\n";
assert( text == cleartext );
}
}
Please let me know how I can help integrate this better.
Thanks, it looks good at first sight.
Please rebase if you still want to add this.