Electroneum
tools::wallet_keys_unlocker Class Reference

#include <wallet2.h>

Public Member Functions

 wallet_keys_unlocker (wallet2 &w, const boost::optional< tools::password_container > &password)
 
 wallet_keys_unlocker (wallet2 &w, bool locked, const epee::wipeable_string &password)
 
 ~wallet_keys_unlocker ()
 

Detailed Description

Definition at line 111 of file wallet2.h.

Constructor & Destructor Documentation

◆ wallet_keys_unlocker() [1/2]

tools::wallet_keys_unlocker::wallet_keys_unlocker ( wallet2 w,
const boost::optional< tools::password_container > &  password 
)

Definition at line 1034 of file wallet2.cpp.

1034  :
1035  w(w),
1036  locked(password != boost::none)
1037 {
1038  if (!locked || w.is_unattended() || w.ask_password() != tools::wallet2::AskPasswordToDecrypt || w.watch_only())
1039  {
1040  locked = false;
1041  return;
1042  }
1043  const epee::wipeable_string pass = password->password();
1044  w.generate_chacha_key_from_password(pass, key);
1045  w.decrypt_keys(key);
1046 }
bool watch_only() const
Definition: wallet2.h:825
AskPasswordType ask_password() const
Definition: wallet2.h:1079
bool is_unattended() const
Definition: wallet2.h:1274
void decrypt_keys(const crypto::chacha_key &key)
Definition: wallet2.cpp:4752
const char * key
Definition: hmac_keccak.cpp:39
Here is the call graph for this function:

◆ wallet_keys_unlocker() [2/2]

tools::wallet_keys_unlocker::wallet_keys_unlocker ( wallet2 w,
bool  locked,
const epee::wipeable_string password 
)

Definition at line 1048 of file wallet2.cpp.

1048  :
1049  w(w),
1050  locked(locked)
1051 {
1052  if (!locked)
1053  return;
1054  w.generate_chacha_key_from_password(password, key);
1055  w.decrypt_keys(key);
1056 }
void decrypt_keys(const crypto::chacha_key &key)
Definition: wallet2.cpp:4752
const char * key
Definition: hmac_keccak.cpp:39
Here is the call graph for this function:

◆ ~wallet_keys_unlocker()

tools::wallet_keys_unlocker::~wallet_keys_unlocker ( )

Definition at line 1058 of file wallet2.cpp.

1059 {
1060  if (!locked)
1061  return;
1062  try { w.encrypt_keys(key); }
1063  catch (...)
1064  {
1065  MERROR("Failed to re-encrypt wallet keys");
1066  // do not propagate through dtor, we'd crash
1067  }
1068 }
#define MERROR(x)
Definition: misc_log_ex.h:73
const char * key
Definition: hmac_keccak.cpp:39
void encrypt_keys(const crypto::chacha_key &key)
Definition: wallet2.cpp:4746
Here is the call graph for this function:

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