1
0
Fork 0
forked from lthn/blockchain

Seed password implementation: in work

This commit is contained in:
cryptozoidberg 2020-11-20 00:37:48 +01:00
parent b47e385279
commit 03cb013695
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 24 additions and 4 deletions

View file

@ -1978,7 +1978,8 @@ QString MainWindow::is_valid_restore_wallet_text(const QString& param)
{
TRY_ENTRY();
LOG_API_TIMING();
return m_backend.is_valid_brain_restore_data(param.toStdString(), ).c_str();
PREPARE_ARG_FROM_JSON(view::is_valid_restore_wallet_text_param, rwtp);
return m_backend.is_valid_brain_restore_data(rwtp.seed_phrase, rwtp.seed_password).c_str();
CATCH_ENTRY2(API_RETURN_CODE_INTERNAL_ERROR);
}

View file

@ -333,8 +333,15 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
return false;
}
tools::password_container seed_password_container;
if (!seed_password_container.read_password("Please enter Secure Seed password(leave it blank for a non secured seed):\n"))
{
fail_msg_writer() << "failed to read seed phrase";
return false;
}
bool looks_like_tracking_seed = restore_seed_container.password().find(':') != std::string::npos;
bool r = restore_wallet(m_restore_wallet, restore_seed_container.password(), pwd_container.password(), looks_like_tracking_seed);
bool r = restore_wallet(m_restore_wallet, restore_seed_container.password(), pwd_container.password(), looks_like_tracking_seed, seed_password_container.password());
CHECK_AND_ASSERT_MES(r, false, "wallet restoring failed");
}
else

View file

@ -526,7 +526,7 @@ namespace plain_wallet
}
async_callback = [job_id, rwr]()
{
std::string res = restore(rwr.restore_key, rwr.path, rwr.pass, rwr.seed_pass);
std::string res = restore(rwr.seed_phrase, rwr.path, rwr.pass, rwr.seed_pass);
put_result(job_id, res);
};
}

View file

@ -272,7 +272,6 @@ public:
END_KV_SERIALIZE_MAP()
};
get_smart_wallet_info
struct request_get_smart_wallet_info
{
@ -443,6 +442,19 @@ public:
END_KV_SERIALIZE_MAP()
};
struct is_valid_restore_wallet_text_param
{
uint64_t seed_phrase;
std::string seed_password;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(seed_phrase)
KV_SERIALIZE(seed_password)
END_KV_SERIALIZE_MAP()
};
struct restore_wallet_request
{
std::string pass;