30 #include <boost/filesystem.hpp> 66 void setPath(boost::filesystem::path
const& _path);
71 bytesSec secret(
h128 const& _uuid, std::function<std::string()>
const& _pass,
bool _useCache =
true)
const;
74 static bytesSec secret(std::string
const& _content, std::string
const& _pass);
88 bool recode(
h128 const& _uuid, std::string
const& _newPass, std::function<std::string()>
const& _pass,
KDF _kdf =
KDF::Scrypt);
90 bool recode(
Address const& _address, std::string
const& _newPass, std::function<std::string()>
const& _pass,
KDF _kdf =
KDF::Scrypt);
95 std::vector<h128>
keys()
const {
return keysOf(m_keys); }
107 h128 readKey(boost::filesystem::path
const& _file,
bool _takeFileOwnership);
112 h128 readKeyContent(std::string
const& _content, boost::filesystem::path
const& _file = boost::filesystem::path());
115 void save(boost::filesystem::path
const& _keysPath);
128 void load(boost::filesystem::path
const& _keysPath);
129 void load() { load(m_path); }
133 static bytesSec decrypt(std::string
const& _v, std::string
const& _pass);
135 std::pair<h128 const, EncryptedKey>
const* key(
Address const& _address)
const;
136 std::pair<h128 const, EncryptedKey>* key(
Address const& _address);
138 mutable std::unordered_map<h128, bytesSec> m_cached;
140 std::unordered_map<h128, EncryptedKey> m_keys;
142 boost::filesystem::path m_path;
boost::filesystem::path getDataDir(std::string _prefix="ethereum")
std::vector< T > keysOf(std::map< T, U > const &_m)
Address address(h128 const &_uuid) const
h128 importKey(std::string const &_file)
Imports the (encrypted) key stored in the file _file and copies it to the managed directory...
void save()
Store all keys in the managed directory.
secure_vector< byte > bytesSec
bytesSec secret(h128 const &_uuid, std::function< std::string()> const &_pass, bool _useCache=true) const
std::vector< h128 > keys() const
Returns the uuids of all stored keys.
h128 readKeyContent(std::string const &_content, boost::filesystem::path const &_file=boost::filesystem::path())
h128 readKey(boost::filesystem::path const &_file, bool _takeFileOwnership)
vector_ref< byte const > bytesConstRef
void setPath(boost::filesystem::path const &_path)
Set a path for finding secrets.
h128 importSecret(bytesSec const &_s, std::string const &_pass)
h128 importKeyContent(std::string const &_content)
bool recode(h128 const &_uuid, std::string const &_newPass, std::function< std::string()> const &_pass, KDF _kdf=KDF::Scrypt)
Decrypts and re-encrypts the key identified by _uuid.
void kill(h128 const &_uuid)
Removes the key specified by _uuid from both memory and disk.
bool contains(h128 const &_k) const
static boost::filesystem::path defaultPath()
boost::filesystem::path filename
bool noteAddress(h128 const &_uuid, Address const &_address)