![]() |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
High-level manager of password-encrypted keys for Ethereum. Usage: More...
#include <KeyManager.h>
Public Types | |
| enum | NewKeyType { NewKeyType::DirectICAP = 0, NewKeyType::NoVanity, NewKeyType::FirstTwo, NewKeyType::FirstTwoNextTwo, NewKeyType::FirstThree, NewKeyType::FirstFour } |
Public Member Functions | |
| KeyManager (boost::filesystem::path const &_keysFile=defaultPath(), boost::filesystem::path const &_secretsPath=SecretStore::defaultPath()) | |
| ~KeyManager () | |
| void | setKeysFile (boost::filesystem::path const &_keysFile) |
| boost::filesystem::path const & | keysFile () const |
| bool | exists () const |
| void | create (std::string const &_pass) |
| bool | load (std::string const &_pass) |
| void | save (std::string const &_pass) const |
| void | notePassword (std::string const &_pass) |
| void | noteHint (std::string const &_pass, std::string const &_hint) |
| bool | haveHint (std::string const &_pass) const |
| Addresses | accounts () const |
| AddressHash | accountsHash () const |
| bool | hasAccount (Address const &_address) const |
| std::string const & | accountName (Address const &_address) const |
| std::string const & | passwordHint (Address const &_address) const |
| h128 | uuid (Address const &_a) const |
| Address | address (h128 const &_uuid) const |
| h128 | import (Secret const &_s, std::string const &_accountName, std::string const &_pass, std::string const &_passwordHint) |
| h128 | import (Secret const &_s, std::string const &_accountName) |
| SecretStore & | store () |
| void | importExisting (h128 const &_uuid, std::string const &_accountName, std::string const &_pass, std::string const &_passwordHint) |
| void | importExisting (h128 const &_uuid, std::string const &_accountName, Address const &_addr, h256 const &_passHash=h256(), std::string const &_passwordHint=std::string()) |
| Secret | secret (Address const &_address, std::function< std::string()> const &_pass=DontKnowThrow, bool _usePasswordCache=true) const |
| Secret | secret (h128 const &_uuid, std::function< std::string()> const &_pass=DontKnowThrow, bool _usePasswordCache=true) const |
| bool | recode (Address const &_address, std::string const &_newPass, std::string const &_hint, std::function< std::string()> const &_pass=DontKnowThrow, KDF _kdf=KDF::Scrypt) |
| void | kill (h128 const &_id) |
| void | kill (Address const &_a) |
Static Public Member Functions | |
| static boost::filesystem::path | defaultPath () |
| static KeyPair | presaleSecret (std::string const &_json, std::function< std::string(bool)> const &_password) |
| Extracts the secret key from the presale wallet. More... | |
| static KeyPair | newKeyPair (NewKeyType _type) |
High-level manager of password-encrypted keys for Ethereum. Usage:
Call exists() to check whether there is already a database. If so, get the master password from the user and call load() with it. If not, get a new master password from the user (get them to type it twice and keep some hint around!) and call create() with it.
Uses a "key file" (and a corresponding .salt file) that contains encrypted information about the keys and a directory called "secrets path" that contains a file for each key.
Definition at line 74 of file KeyManager.h.
|
strong |
| Enumerator | |
|---|---|
| DirectICAP | |
| NoVanity | |
| FirstTwo | |
| FirstTwoNextTwo | |
| FirstThree | |
| FirstFour | |
Definition at line 77 of file KeyManager.h.
| KeyManager::KeyManager | ( | boost::filesystem::path const & | _keysFile = defaultPath(), |
| boost::filesystem::path const & | _secretsPath = SecretStore::defaultPath() |
||
| ) |
Definition at line 37 of file KeyManager.cpp.
| KeyManager::~KeyManager | ( | ) |
Definition at line 48 of file KeyManager.cpp.
| string const & KeyManager::accountName | ( | Address const & | _address | ) | const |
Definition at line 293 of file KeyManager.cpp.
| Addresses KeyManager::accounts | ( | ) | const |
Definition at line 270 of file KeyManager.cpp.
|
inline |
Definition at line 97 of file KeyManager.h.
Definition at line 185 of file KeyManager.cpp.
| void KeyManager::create | ( | std::string const & | _pass | ) |
Definition at line 56 of file KeyManager.cpp.
|
inlinestatic |
Definition at line 128 of file KeyManager.h.
| bool KeyManager::exists | ( | ) | const |
Definition at line 51 of file KeyManager.cpp.
| bool KeyManager::hasAccount | ( | Address const & | _address | ) | const |
Definition at line 281 of file KeyManager.cpp.
|
inline |
Definition at line 92 of file KeyManager.h.
Definition at line 110 of file KeyManager.h.
| h128 dev::eth::KeyManager::import | ( | Secret const & | _s, |
| std::string const & | _accountName, | ||
| std::string const & | _pass, | ||
| std::string const & | _passwordHint | ||
| ) |
| void dev::eth::KeyManager::importExisting | ( | h128 const & | _uuid, |
| std::string const & | _accountName, | ||
| Address const & | _addr, | ||
| h256 const & | _passHash = h256(), |
||
| std::string const & | _passwordHint = std::string() |
||
| ) |
| void dev::eth::KeyManager::importExisting | ( | h128 const & | _uuid, |
| std::string const & | _accountName, | ||
| std::string const & | _pass, | ||
| std::string const & | _passwordHint | ||
| ) |
|
inline |
Definition at line 83 of file KeyManager.h.
| void KeyManager::kill | ( | Address const & | _a | ) |
Definition at line 230 of file KeyManager.cpp.
|
inline |
Definition at line 125 of file KeyManager.h.
| bool KeyManager::load | ( | std::string const & | _pass | ) |
Definition at line 74 of file KeyManager.cpp.
|
static |
Definition at line 373 of file KeyManager.cpp.
|
inline |
Definition at line 91 of file KeyManager.h.
|
inline |
Definition at line 90 of file KeyManager.h.
| string const & KeyManager::passwordHint | ( | Address const & | _address | ) | const |
Definition at line 305 of file KeyManager.cpp.
|
static |
Extracts the secret key from the presale wallet.
Definition at line 240 of file KeyManager.cpp.
| bool KeyManager::recode | ( | Address const & | _address, |
| std::string const & | _newPass, | ||
| std::string const & | _hint, | ||
| std::function< std::string()> const & | _pass = DontKnowThrow, |
||
| KDF | _kdf = KDF::Scrypt |
||
| ) |
Definition at line 62 of file KeyManager.cpp.
|
inline |
Definition at line 88 of file KeyManager.h.
| Secret dev::eth::KeyManager::secret | ( | Address const & | _address, |
| std::function< std::string()> const & | _pass = DontKnowThrow, |
||
| bool | _usePasswordCache = true |
||
| ) | const |
| Secret dev::eth::KeyManager::secret | ( | h128 const & | _uuid, |
| std::function< std::string()> const & | _pass = DontKnowThrow, |
||
| bool | _usePasswordCache = true |
||
| ) | const |
|
inline |
Definition at line 82 of file KeyManager.h.
|
inline |
Definition at line 112 of file KeyManager.h.
Definition at line 177 of file KeyManager.cpp.