Skip to content

Commit

Permalink
remove m_init_path
Browse files Browse the repository at this point in the history
  • Loading branch information
sinev-valentine committed Nov 22, 2018
1 parent e014ba9 commit 269f5ac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion keychain_lib/include/keychain_lib/keychain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class keychain : public keychain_base
virtual ~keychain();
virtual std::string operator()(const fc_light::variant& command) override;
private:
bfs::path m_init_path;
keychain(const secure_dlg_mod_base* , const char* default_key_dir = KEY_DEFAULT_PATH);
};

Expand Down
6 changes: 4 additions & 2 deletions keychain_lib/include/keychain_lib/keychain_commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

namespace keychain_app {

namespace bfs = boost::filesystem;

using byte_seq_t = std::vector<char>;

enum struct blockchain_te {unknown=0, bitshares, array, ethereum, bitcoin};
Expand Down Expand Up @@ -112,7 +114,7 @@ class keychain_base
boost::signals2::signal<byte_seq_t(std::string)> get_passwd_on_create;
boost::signals2::signal<void(const string_list&)> print_mnemonic;
int unlock_time;
std::string binary_dir;
bfs::path binary_dir;

std::unordered_map<std::string, std::pair<std::string, std::time_t>> key_map;
};
Expand Down Expand Up @@ -475,7 +477,7 @@ struct keychain_command<command_te::create>: keychain_command_base

if (params.encrypted)
{
auto passwd = *keychain->get_passwd_on_create(keychain->binary_dir);
auto passwd = *keychain->get_passwd_on_create(keychain->binary_dir.string());
if (passwd.empty())
throw std::runtime_error("Error: can't get password");
auto& encryptor = encryptor_singletone::instance();
Expand Down
6 changes: 2 additions & 4 deletions keychain_lib/src/keychain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ keychain& keychain::instance(const secure_dlg_mod_base* secure_dlg )

keychain::keychain(const secure_dlg_mod_base* secure_dlg, const char* default_key_dir)
: keychain_base()
, m_init_path(bfs::current_path())
{
binary_dir = bfs::absolute("").string();

binary_dir = bfs::current_path();
std::string dir(default_key_dir);
bfs::path key_dir(dir);

Expand All @@ -68,7 +66,7 @@ keychain::keychain(const secure_dlg_mod_base* secure_dlg, const char* default_ke

keychain::~keychain()
{
bfs::current_path(m_init_path);
bfs::current_path(binary_dir);
}

std::string keychain::operator()(const fc_light::variant& command) {
Expand Down
2 changes: 1 addition & 1 deletion keychain_lib/src/keychain_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ std::pair<std::string, std::string> keychain_app::read_private_key_file(
// If we can parse transaction we need to use get_passwd_trx function
// else use get_passwd_trx_raw()
// At this moment parsing of transaction is not implemented
byte_seq_t passwd = *(keychain->get_passwd_trx_raw(text.empty() ? keyfile.keyname: text, keychain->binary_dir));
byte_seq_t passwd = *(keychain->get_passwd_trx_raw(text.empty() ? keyfile.keyname: text, keychain->binary_dir.string()));
if (passwd.empty())
throw std::runtime_error("Error: can't get password");
return std::make_pair(encryptor.decrypt_keydata(passwd, encrypted_data), keyfile.keyname);
Expand Down

0 comments on commit 269f5ac

Please sign in to comment.