Skip to content
Snippets Groups Projects
Commit 5e9a7459 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Wax C++ core extended by ability to convert raw private key into WIF format

parent d3a2a945
No related branches found
No related tags found
No related merge requests found
......@@ -269,6 +269,16 @@ private_key_data foundation::cpp_generate_private_key(const std::string& account
);
}
std::string foundation::cpp_convert_raw_private_key_to_wif(const std::string& hexData)
{
FC_ASSERT(hexData.size() == 64 && "Expected hex string pointing 32 byte buffer");
fc::sha256 sharedSecret(hexData);
return fc::ecc::private_key::regenerate(sharedSecret).key_to_wif();
}
brain_key_data foundation::cpp_suggest_brain_key()
{
return cpp::safe_exception_wrapper(
......
......@@ -15,8 +15,11 @@ public:
result cpp_calculate_public_key(const std::string& wif);
result cpp_generate_private_key();
private_key_data cpp_generate_private_key(const std::string& account, const std::string& role, const std::string& password);
/** Allows to convert 32 bytes data buffer expressed as hex string (pointing private key secret) into private key encoded as WIF format.
*/
std::string cpp_convert_raw_private_key_to_wif(const std::string& hexData);
brain_key_data cpp_suggest_brain_key();
/** Returns map of hive::protocol constants in form:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment