Definition at line 41 of file wallet.cpp.
◆ soft_wallet_impl()
sysio::wallet::detail::soft_wallet_impl::soft_wallet_impl |
( |
soft_wallet & | s, |
|
|
const wallet_data & | initial_data ) |
|
inline |
◆ ~soft_wallet_impl()
virtual sysio::wallet::detail::soft_wallet_impl::~soft_wallet_impl |
( |
| ) |
|
|
inlinevirtual |
◆ copy_wallet_file()
bool sysio::wallet::detail::soft_wallet_impl::copy_wallet_file |
( |
string | destination_filename | ) |
|
|
inline |
Definition at line 78 of file wallet.cpp.
79 {
82 return false;
84 int suffix = 0;
86 {
87 ++suffix;
89 }
90 wlog(
"backing up wallet ${src} to ${dest}",
91 ("src", src_path)
92 ("dest", dest_path) );
93
95 try
96 {
97 enable_umask_protection();
101 disable_umask_protection();
102 }
103 catch(...)
104 {
105 disable_umask_protection();
106 throw;
107 }
108 return true;
109 }
wraps boost::filesystem::path to provide platform independent path manipulation.
fc::path parent_path() const
string get_wallet_filename() const
const string _wallet_filename_extension
bool exists(const path &p)
void create_directories(const path &p)
void copy(const path &from, const path &to)
path absolute(const path &p)
◆ create_key()
string sysio::wallet::detail::soft_wallet_impl::create_key |
( |
string | key_type | ) |
|
|
inline |
Definition at line 172 of file wallet.cpp.
173 {
176
182 else
183 SYS_THROW(chain::unsupported_key_type_exception,
"Key type \"${kt}\" not supported by software wallet", (
"kt",
key_type));
184
187 }
#define SYS_THROW(exc_type, FORMAT,...)
std::string to_string(const fc::yield_function_t &yield=fc::yield_function_t()) const
static private_key generate()
public_key get_public_key() const
std::string to_string(const fc::yield_function_t &yield=fc::yield_function_t()) const
bool import_key(string wif_key)
const string _default_key_type
◆ encrypt_keys()
void sysio::wallet::detail::soft_wallet_impl::encrypt_keys |
( |
| ) |
|
|
inline |
Definition at line 66 of file wallet.cpp.
67 {
69 {
70 plain_keys data;
75 }
76 }
map< public_key_type, private_key_type > _keys
void pack(Stream &s, const std::deque< T > &value)
unsigned aes_encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext)
vector< char > cipher_keys
◆ get_private_key()
Definition at line 133 of file wallet.cpp.
134 {
136 SYS_ASSERT( has_key, chain::key_nonexistent_exception,
"Key doesn't exist!" );
137 return *has_key;
138 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
std::optional< private_key_type > try_get_private_key(const public_key_type &id) const
◆ get_wallet_filename()
string sysio::wallet::detail::soft_wallet_impl::get_wallet_filename |
( |
| ) |
const |
|
inline |
◆ import_key()
bool sysio::wallet::detail::soft_wallet_impl::import_key |
( |
string | wif_key | ) |
|
|
inline |
Definition at line 145 of file wallet.cpp.
146 {
149
150 auto itr =
_keys.find(wif_pub_key);
151 if( itr ==
_keys.end() ) {
152 _keys[wif_pub_key] = priv;
153 return true;
154 }
155 SYS_THROW( chain::key_exist_exception,
"Key already in wallet" );
156 }
◆ is_locked()
bool sysio::wallet::detail::soft_wallet_impl::is_locked |
( |
| ) |
const |
|
inline |
◆ load_wallet_file()
bool sysio::wallet::detail::soft_wallet_impl::load_wallet_file |
( |
string | wallet_filename = "" | ) |
|
|
inline |
Definition at line 189 of file wallet.cpp.
190 {
191
192
193 if( wallet_filename == "" )
195
197 return false;
198
200
201 return true;
202 }
static variant from_file(const fc::path &p, const parse_type ptype=parse_type::legacy_parser, const uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
◆ remove_key()
bool sysio::wallet::detail::soft_wallet_impl::remove_key |
( |
string | key | ) |
|
|
inline |
Definition at line 161 of file wallet.cpp.
162 {
164 auto itr =
_keys.find(pub);
165 if( itr !=
_keys.end() ) {
167 return true;
168 }
169 SYS_THROW( chain::key_nonexistent_exception,
"Key not in wallet" );
170 }
◆ save_wallet_file()
void sysio::wallet::detail::soft_wallet_impl::save_wallet_file |
( |
string | wallet_filename = "" | ) |
|
|
inline |
Definition at line 204 of file wallet.cpp.
205 {
206
207
208
209
210
211
212
214
215 if( wallet_filename == "" )
217
218 wlog(
"saving wallet to file ${fn}", (
"fn", wallet_filename) );
219
221 try
222 {
223 enable_umask_protection();
224
225
226
227
228
229
230 ofstream outfile{ wallet_filename };
231 if (!outfile) {
232 elog(
"Unable to open file: ${fn}", (
"fn", wallet_filename));
233 SYS_THROW(wallet_exception,
"Unable to open file: ${fn}", (
"fn", wallet_filename));
234 }
235 outfile.write( data.c_str(), data.length() );
236 outfile.flush();
237 outfile.close();
238 disable_umask_protection();
239 }
240 catch(...)
241 {
242 disable_umask_protection();
243 throw;
244 }
245 }
static string to_pretty_string(const variant &v, const yield_function_t &yield, const output_formatting format=output_formatting::stringify_large_ints_and_doubles)
◆ try_get_private_key()
Definition at line 118 of file wallet.cpp.
119 {
120 auto it =
_keys.find(
id);
121 if( it !=
_keys.end() )
122 return it->second;
123 return std::optional<private_key_type>();
124 }
◆ try_sign_digest()
Definition at line 126 of file wallet.cpp.
126 {
128 if( it ==
_keys.end() )
129 return std::optional<signature_type>();
130 return it->second.sign(
digest);
131 }
fc::sha256 digest(const T &value)
◆ _checksum
fc::sha512 sysio::wallet::detail::soft_wallet_impl::_checksum |
◆ _default_key_type
const string sysio::wallet::detail::soft_wallet_impl::_default_key_type = "K1" |
◆ _keys
◆ _wallet
wallet_data sysio::wallet::detail::soft_wallet_impl::_wallet |
◆ _wallet_filename
string sysio::wallet::detail::soft_wallet_impl::_wallet_filename |
◆ _wallet_filename_extension
const string sysio::wallet::detail::soft_wallet_impl::_wallet_filename_extension = ".wallet" |
◆ self
soft_wallet& sysio::wallet::detail::soft_wallet_impl::self |
The documentation for this class was generated from the following file: