Merge branch 'rock-paper-scissors' of https://bitbucket.org/peerplaysblockchain/peerplays-graphene into rock-paper-scissors
This commit is contained in:
commit
50f07d47f5
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)
|
||||
|
|
|
|||
|
|
@ -3382,6 +3382,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 = password + account + role;
|
||||
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