Add get_private_key_from_password from steem commit

This commit is contained in:
PBSA Github Manager 2017-05-26 22:04:49 -03:00 committed by GitHub
parent 85c8ce9ac2
commit a7ca09dfc3

View file

@ -3379,6 +3379,14 @@ brain_key_info wallet_api::suggest_brain_key()const
return result; return result;
} }
pair<public_key_type,string> wallet_api::get_private_key_from_password( string account, string role, string password )const {
auto seed = account + role + password;
FC_ASSERT( seed.size() );
auto secret = fc::sha256::hash( seed.c_str(), seed.size() );
auto priv = fc::ecc::private_key::regenerate( secret );
return std::make_pair( public_key_type( priv.get_public_key() ), key_to_wif( priv ) );
}
string wallet_api::serialize_transaction( signed_transaction tx )const string wallet_api::serialize_transaction( signed_transaction tx )const
{ {
return fc::to_hex(fc::raw::pack(tx)); return fc::to_hex(fc::raw::pack(tx));