Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::wallet_api_plugin Class Reference

#include <wallet_api_plugin.hpp>

Inheritance diagram for sysio::wallet_api_plugin:
Collaboration diagram for sysio::wallet_api_plugin:

Public Member Functions

 APPBASE_PLUGIN_REQUIRES ((wallet_plugin)(http_plugin)) wallet_api_plugin()=default
 
 wallet_api_plugin (const wallet_api_plugin &)=delete
 
 wallet_api_plugin (wallet_api_plugin &&)=delete
 
wallet_api_pluginoperator= (const wallet_api_plugin &)=delete
 
wallet_api_pluginoperator= (wallet_api_plugin &&)=delete
 
virtual ~wallet_api_plugin () override=default
 
virtual void set_program_options (options_description &cli, options_description &cfg) override
 
void plugin_initialize (const variables_map &vm)
 
void plugin_startup ()
 
void plugin_shutdown ()
 
- Public Member Functions inherited from appbase::plugin< wallet_api_plugin >
 plugin ()
 
virtual ~plugin ()
 
virtual state get_state () const override
 
virtual const std::string & name () const override
 
virtual void register_dependencies ()
 
virtual void initialize (const variables_map &options) override
 
virtual void handle_sighup () override
 
virtual void startup () override
 
virtual void shutdown () override
 
- Public Member Functions inherited from appbase::abstract_plugin
virtual ~abstract_plugin ()
 

Additional Inherited Members

- Public Types inherited from appbase::abstract_plugin
enum  state { registered , initialized , started , stopped }
 
- Protected Member Functions inherited from appbase::plugin< wallet_api_plugin >
 plugin (const string &name)
 

Detailed Description

Definition at line 12 of file wallet_api_plugin.hpp.

Constructor & Destructor Documentation

◆ wallet_api_plugin() [1/2]

sysio::wallet_api_plugin::wallet_api_plugin ( const wallet_api_plugin & )
delete

◆ wallet_api_plugin() [2/2]

sysio::wallet_api_plugin::wallet_api_plugin ( wallet_api_plugin && )
delete

◆ ~wallet_api_plugin()

virtual sysio::wallet_api_plugin::~wallet_api_plugin ( )
overridevirtualdefault

Member Function Documentation

◆ APPBASE_PLUGIN_REQUIRES()

sysio::wallet_api_plugin::APPBASE_PLUGIN_REQUIRES ( (wallet_plugin)(http_plugin) )
default

◆ operator=() [1/2]

wallet_api_plugin & sysio::wallet_api_plugin::operator= ( const wallet_api_plugin & )
delete

◆ operator=() [2/2]

wallet_api_plugin & sysio::wallet_api_plugin::operator= ( wallet_api_plugin && )
delete

◆ plugin_initialize()

void sysio::wallet_api_plugin::plugin_initialize ( const variables_map & vm)

Definition at line 121 of file wallet_api_plugin.cpp.

121 {
122 try {
123 const auto& _http_plugin = app().get_plugin<http_plugin>();
124 if( !_http_plugin.is_on_loopback()) {
125 if( !_http_plugin.is_secure()) {
126 elog( "\n"
127 "********!!!SECURITY ERROR!!!********\n"
128 "* *\n"
129 "* -- Wallet API -- *\n"
130 "* - EXPOSED to the LOCAL NETWORK - *\n"
131 "* - HTTP RPC is NOT encrypted - *\n"
132 "* - Password and/or Private Keys - *\n"
133 "* - are at HIGH risk of exposure - *\n"
134 "* *\n"
135 "************************************\n" );
136 } else {
137 wlog( "\n"
138 "**********SECURITY WARNING**********\n"
139 "* *\n"
140 "* -- Wallet API -- *\n"
141 "* - EXPOSED to the LOCAL NETWORK - *\n"
142 "* - Password and/or Private Keys - *\n"
143 "* - are at risk of exposure - *\n"
144 "* *\n"
145 "************************************\n" );
146 }
147 }
149}
abstract_plugin & get_plugin(const string &name) const
#define FC_LOG_AND_RETHROW()
#define wlog(FORMAT,...)
Definition logger.hpp:124
#define elog(FORMAT,...)
Definition logger.hpp:130
application & app()
Here is the call graph for this function:

◆ plugin_shutdown()

void sysio::wallet_api_plugin::plugin_shutdown ( )
inline

Definition at line 26 of file wallet_api_plugin.hpp.

26{}

◆ plugin_startup()

void sysio::wallet_api_plugin::plugin_startup ( )

Definition at line 83 of file wallet_api_plugin.cpp.

83 {
84 ilog("starting wallet_api_plugin");
85 // lifetime of plugin is lifetime of application
86 auto& wallet_mgr = app().get_plugin<wallet_plugin>().get_wallet_manager();
87
88 app().get_plugin<http_plugin>().add_api({
89 CALL_WITH_400(wallet, wallet_mgr, set_timeout,
90 INVOKE_V_R(wallet_mgr, set_timeout, int64_t), 200),
91 // chain::chain_id_type has an inaccessible default constructor
92 CALL_WITH_400(wallet, wallet_mgr, sign_transaction,
93 INVOKE_R_R_R_R(wallet_mgr, sign_transaction, chain::signed_transaction, chain::flat_set<public_key_type>, chain::chain_id_type), 201),
94 CALL_WITH_400(wallet, wallet_mgr, sign_digest,
95 INVOKE_R_R_R(wallet_mgr, sign_digest, chain::digest_type, public_key_type), 201),
96 CALL_WITH_400(wallet, wallet_mgr, create,
97 INVOKE_R_R(wallet_mgr, create, std::string), 201),
98 CALL_WITH_400(wallet, wallet_mgr, open,
99 INVOKE_V_R(wallet_mgr, open, std::string), 200),
100 CALL_WITH_400(wallet, wallet_mgr, lock_all,
101 INVOKE_V_V(wallet_mgr, lock_all), 200),
102 CALL_WITH_400(wallet, wallet_mgr, lock,
103 INVOKE_V_R(wallet_mgr, lock, std::string), 200),
104 CALL_WITH_400(wallet, wallet_mgr, unlock,
105 INVOKE_V_R_R(wallet_mgr, unlock, std::string, std::string), 200),
106 CALL_WITH_400(wallet, wallet_mgr, import_key,
107 INVOKE_V_R_R(wallet_mgr, import_key, std::string, std::string), 201),
108 CALL_WITH_400(wallet, wallet_mgr, remove_key,
109 INVOKE_V_R_R_R(wallet_mgr, remove_key, std::string, std::string, std::string), 201),
110 CALL_WITH_400(wallet, wallet_mgr, create_key,
111 INVOKE_R_R_R(wallet_mgr, create_key, std::string, std::string), 201),
112 CALL_WITH_400(wallet, wallet_mgr, list_wallets,
113 INVOKE_R_V(wallet_mgr, list_wallets), 200),
114 CALL_WITH_400(wallet, wallet_mgr, list_keys,
115 INVOKE_R_R_R(wallet_mgr, list_keys, std::string, std::string), 200),
116 CALL_WITH_400(wallet, wallet_mgr, get_public_keys,
117 INVOKE_R_V(wallet_mgr, get_public_keys), 200)
118 });
119}
#define CALL_WITH_400(api_name, api_handle, api_namespace, call_name, http_response_code, params_type)
#define INVOKE_R_V(api_handle, call_name)
#define ilog(FORMAT,...)
Definition logger.hpp:118
checksum_type digest_type
Definition types.hpp:237
#define INVOKE_V_R(api_handle, call_name, in_param)
#define INVOKE_V_V(api_handle, call_name)
#define INVOKE_R_R(api_handle, call_name, in_param)
void sign_transaction(signed_transaction &trx, fc::variant &required_keys, const chain_id_type &chain_id)
Definition main.cpp:319
signed __int64 int64_t
Definition stdint.h:135
#define INVOKE_V_R_R_R(api_handle, call_name, in_param0, in_param1, in_param2)
#define INVOKE_V_R_R(api_handle, call_name, in_param0, in_param1)
#define INVOKE_R_R_R_R(api_handle, call_name, in_param0, in_param1, in_param2)
#define INVOKE_R_R_R(api_handle, call_name, in_param0, in_param1)
Here is the call graph for this function:

◆ set_program_options()

virtual void sysio::wallet_api_plugin::set_program_options ( options_description & cli,
options_description & cfg )
inlineoverridevirtual

Implements appbase::abstract_plugin.

Definition at line 23 of file wallet_api_plugin.hpp.

23{}

The documentation for this class was generated from the following files: