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 1033 of file wallet2.cpp.

1033  :
1034  w(w),
1035  locked(password != boost::none)
1036 {
1037  if (!locked || w.is_unattended() || w.ask_password() != tools::wallet2::AskPasswordToDecrypt || w.watch_only())
1038  {
1039  locked = false;
1040  return;
1041  }
1042  const epee::wipeable_string pass = password->password();
1043  w.generate_chacha_key_from_password(pass, key);
1044  w.decrypt_keys(key);
1045 }
bool is_unattended() const
Definition: wallet2.h:1266
bool watch_only() const
Definition: wallet2.h:819
void decrypt_keys(const crypto::chacha_key &key)
Definition: wallet2.cpp:4642
@ AskPasswordToDecrypt
Definition: wallet2.h:228
AskPasswordType ask_password() const
Definition: wallet2.h:1071
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 1047 of file wallet2.cpp.

1047  :
1048  w(w),
1049  locked(locked)
1050 {
1051  if (!locked)
1052  return;
1053  w.generate_chacha_key_from_password(password, key);
1054  w.decrypt_keys(key);
1055 }
Here is the call graph for this function:

◆ ~wallet_keys_unlocker()

tools::wallet_keys_unlocker::~wallet_keys_unlocker ( )

Definition at line 1057 of file wallet2.cpp.

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

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