aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authorLeon Klingele <git@leonklingele.de>2018-02-25 17:59:52 +0100
committerLeon Klingele <git@leonklingele.de>2018-03-10 16:28:23 +0100
commit649a1b7ae663888c1ff51ce7b0fa2ed22a719aa4 (patch)
treefbc38bc01570207651808b7bffd112fa37bbad88 /src/simplewallet
parentMerge pull request #3261 (diff)
downloadmonero-649a1b7ae663888c1ff51ce7b0fa2ed22a719aa4.tar.xz
wallet2 / simplewallet: Must opt-in to create '.address.txt' files for new wallets
Previously, a file containing the unencrypted Monero address was created by default in the wallet's directory. This file might pose as a privacy risk. The creation of this file is now opt-in and can be enabled by providing --create-address-file
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index c618869f2..c78cceacd 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -134,6 +134,7 @@ namespace
const command_line::arg_descriptor<bool> arg_allow_mismatched_daemon_version = {"allow-mismatched-daemon-version", sw::tr("Allow communicating with a daemon that uses a different RPC version"), false};
const command_line::arg_descriptor<uint64_t> arg_restore_height = {"restore-height", sw::tr("Restore from specific blockchain height"), 0};
const command_line::arg_descriptor<bool> arg_do_not_relay = {"do-not-relay", sw::tr("The newly created transaction will not be relayed to the monero network"), false};
+ const command_line::arg_descriptor<bool> arg_create_address_file = {"create-address-file", sw::tr("Create an address file for new wallets"), false};
const command_line::arg_descriptor< std::vector<std::string> > arg_command = {"command", ""};
@@ -2848,10 +2849,12 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
m_wallet->set_seed_language(mnemonic_language);
+ bool create_address_file = command_line::get_arg(vm, arg_create_address_file);
+
crypto::secret_key recovery_val;
try
{
- recovery_val = m_wallet->generate(m_wallet_file, std::move(rc.second).password(), recovery_key, recover, two_random);
+ recovery_val = m_wallet->generate(m_wallet_file, std::move(rc.second).password(), recovery_key, recover, two_random, create_address_file);
message_writer(console_color_white, true) << tr("Generated new wallet: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
std::cout << tr("View key: ") << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key) << ENDL;
@@ -2900,15 +2903,17 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
if (m_restore_height)
m_wallet->set_refresh_from_block_height(m_restore_height);
+ bool create_address_file = command_line::get_arg(vm, arg_create_address_file);
+
try
{
if (spendkey)
{
- m_wallet->generate(m_wallet_file, std::move(rc.second).password(), address, *spendkey, viewkey);
+ m_wallet->generate(m_wallet_file, std::move(rc.second).password(), address, *spendkey, viewkey, create_address_file);
}
else
{
- m_wallet->generate(m_wallet_file, std::move(rc.second).password(), address, viewkey);
+ m_wallet->generate(m_wallet_file, std::move(rc.second).password(), address, viewkey, create_address_file);
}
message_writer(console_color_white, true) << tr("Generated new wallet: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
@@ -2971,9 +2976,11 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
m_wallet->set_seed_language(mnemonic_language);
+ bool create_address_file = command_line::get_arg(vm, arg_create_address_file);
+
try
{
- m_wallet->generate(m_wallet_file, std::move(rc.second).password(), multisig_keys);
+ m_wallet->generate(m_wallet_file, std::move(rc.second).password(), multisig_keys, create_address_file);
bool ready;
uint32_t threshold, total;
if (!m_wallet->multisig(&ready, &threshold, &total) || !ready)
@@ -6979,6 +6986,7 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_allow_mismatched_daemon_version);
command_line::add_arg(desc_params, arg_restore_height);
command_line::add_arg(desc_params, arg_do_not_relay);
+ command_line::add_arg(desc_params, arg_create_address_file);
po::positional_options_description positional_options;
positional_options.add(arg_command.name, -1);