Add get_private_key_from_password from steem commit 27ee20fdc0a11b721c760685b8a6956c592287cb
This commit is contained in:
parent
90553db95b
commit
4b17eb6657
2 changed files with 14 additions and 0 deletions
|
|
@ -580,6 +580,11 @@ class wallet_api
|
|||
*/
|
||||
brain_key_info suggest_brain_key()const;
|
||||
|
||||
/**
|
||||
* @param role - active | owner | memo
|
||||
*/
|
||||
pair<public_key_type,string> get_private_key_from_password( string account, string role, string password )const;
|
||||
|
||||
/** Converts a signed_transaction in JSON form to its binary representation.
|
||||
*
|
||||
* TODO: I don't see a broadcast_transaction() function, do we need one?
|
||||
|
|
@ -1656,6 +1661,7 @@ FC_API( graphene::wallet::wallet_api,
|
|||
(import_account_keys)
|
||||
(import_balance)
|
||||
(suggest_brain_key)
|
||||
(get_private_key_from_password)
|
||||
(register_account)
|
||||
(upgrade_account)
|
||||
(create_account_with_brain_key)
|
||||
|
|
|
|||
|
|
@ -3379,6 +3379,14 @@ brain_key_info wallet_api::suggest_brain_key()const
|
|||
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
|
||||
{
|
||||
return fc::to_hex(fc::raw::pack(tx));
|
||||
|
|
|
|||
Loading…
Reference in a new issue