Skip to content

Commit

Permalink
gui_mod::entropy update
Browse files Browse the repository at this point in the history
  • Loading branch information
sinev-valentine committed Mar 12, 2019
1 parent 4979246 commit d61a6fe
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions keychain_cmd_app/cmd_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ int cmd_parser::run(int argc, const char* const argv[])
auto it = keyfiles.begin();
if ( it==keyfiles.end() )
{
auto user_entropy = keychain_ref.entropy();
std::string keyname = "master_key";
auto res = keychain_ref.entropy();
/*std::string keyname = "master_key";
std::string pass = "blank";
keyfiles.create(std::bind(create_new_keyfile,
keyname, keyname, true, keyfile_format::cipher_etype::aes256,
Expand All @@ -129,7 +129,7 @@ int cmd_parser::run(int argc, const char* const argv[])
std::copy(pass.begin(), pass.end(), std::back_inserter(res));
return res;
})
);
);*/
}

keychain_invoke_f f = std::bind(&keychain_base::operator(), &keychain_ref, std::placeholders::_1);
Expand Down
5 changes: 2 additions & 3 deletions keychain_cmd_app/gui_mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ dev::Public gui_mod_dummy::select_key() const
return it->keyinfo.public_key;
}

dev::bytes gui_mod_dummy::entropy() const
bool gui_mod_dummy::entropy() const
{
dev::bytes value;
return value;
return true;
}
2 changes: 1 addition & 1 deletion keychain_cmd_app/gui_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class gui_mod_dummy: public gui_mod_base
gui_mod_dummy();
virtual ~gui_mod_dummy();
virtual dev::Public select_key() const override;
virtual dev::bytes entropy() const override;
virtual bool entropy() const override;
};

}
2 changes: 1 addition & 1 deletion keychain_lib/include/keychain_lib/keychain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class gui_mod_base
virtual ~gui_mod_base(){}

virtual dev::Public select_key() const = 0;
virtual dev::bytes entropy() const = 0;
virtual bool entropy() const = 0;
virtual void connect(keychain_base& keychain_) const;
};

Expand Down
2 changes: 1 addition & 1 deletion keychain_lib/include/keychain_lib/keychain_commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class keychain_base
virtual std::string operator()(const fc_light::variant& command) = 0;
boost::signals2::signal<std::string(const std::string&)> run_secmod_cmd;
boost::signals2::signal<dev::Public(void)> select_key;
boost::signals2::signal<dev::bytes(void)> entropy;
boost::signals2::signal<bool(void)> entropy;

dev::Secret get_private_key(const dev::Public& public_key, int unlock_time, create_secmod_cmd_f&& f, std::string& cmd);
void lock_all_priv_keys();
Expand Down
1 change: 1 addition & 0 deletions keychain_lib/include/keychain_lib/keyfile_singleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class keyfile_singleton
void flush_keyfile(const second_key_type& key) const;
// void flush_logrecords(const prim_key_type& key) const;
void flush_all() const;
std::string seed_phrase(dev::bytes&);
};

using get_password_create_f = std::function<byte_seq_t(const std::string&)>; //NOTE: may incapsulate call to sec module or just return password string
Expand Down
7 changes: 7 additions & 0 deletions keychain_lib/src/keyfile_singleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,13 @@ keyfile_format::keyfile_t keychain_app::create_new_keyfile(
return keyfile;
}

std::string keyfile_singleton::seed_phrase(dev::bytes& entropy)
{
std::string phrase = "witch collapse practice feed shame open despair creek road again ice least";

return seed_phrase;
}

bool keychain_app::remove_unlock(const keyfile_format::keyfile_t& keyfile, get_password_f&& get_passwd)
{
try {
Expand Down

0 comments on commit d61a6fe

Please sign in to comment.