aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/password_container.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2017-02-05 17:48:03 -0500
committerLee Clagett <code@leeclagett.com>2017-02-06 01:15:41 -0500
commitce7fcbb4aea884bb4bf433cf419ffa267f859c87 (patch)
treee8fb644b62006d78f801d739fbebad50f2c2409d /src/wallet/password_container.h
parentMerge pull request #1669 (diff)
downloadmonero-ce7fcbb4aea884bb4bf433cf419ffa267f859c87.tar.xz
Add server auth to monerod, and client auth to wallet-cli and wallet-rpc
Diffstat (limited to '')
-rw-r--r--src/common/password.h (renamed from src/wallet/password_container.h)31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/wallet/password_container.h b/src/common/password.h
index 9c6faf9c8..12f715df4 100644
--- a/src/wallet/password_container.h
+++ b/src/common/password.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2016, The Monero Project
+// Copyright (c) 2014-2017, The Monero Project
//
// All rights reserved.
//
@@ -64,4 +64,33 @@ namespace tools
//! TODO Custom allocator that locks to RAM?
std::string m_password;
};
+
+ struct login
+ {
+ login() = default;
+
+ /*!
+ Extracts username and password from the format `username:password`. A
+ blank username or password is allowed. If the `:` character is not
+ present, `password_container::prompt` will be called by forwarding the
+ `verify` and `message` arguments.
+
+ \param userpass Is "consumed", and the memory contents are wiped.
+ \param verify is passed to `password_container::prompt` if necessary.
+ \param message is passed to `password_container::prompt` if necessary.
+
+ \return The username and password, or boost::none if
+ `password_container::prompt` fails.
+ */
+ static boost::optional<login> parse(std::string&& userpass, bool verify, const char* message = "Password");
+
+ login(const login&) = delete;
+ login(login&&) = default;
+ ~login() = default;
+ login& operator=(const login&) = delete;
+ login& operator=(login&&) = default;
+
+ std::string username;
+ password_container password;
+ };
}