MCPcopy Create free account
hub / github.com/LUX-Core/lux / presaleSecret

Method presaleSecret

src/cpp-ethereum/libethcore/KeyManager.cpp:298–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298KeyPair KeyManager::presaleSecret(std::string const& _json, function<string(bool)> const& _password)
299{
300 js::mValue val;
301 json_spirit::read_string(_json, val);
302 auto obj = val.get_obj();
303 string p = _password(true);
304 if (obj["encseed"].type() == js::str_type)
305 {
306 auto encseed = fromHex(obj["encseed"].get_str());
307 while (true)
308 {
309 KeyPair k = KeyPair::fromEncryptedSeed(&encseed, p);
310 if (obj["ethaddr"].type() == js::str_type)
311 {
312 Address a(obj["ethaddr"].get_str());
313 Address b = k.address();
314 if (a != b)
315 {
316 if ((p = _password(false)).empty())
317 BOOST_THROW_EXCEPTION(PasswordUnknown());
318 continue;
319 }
320 }
321 return k;
322 }
323 }
324 else
325 BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("encseed type is not js::str_type"));
326}
327
328Addresses KeyManager::accounts() const
329{

Callers 3

executeMethod · 0.80
importPresaleFunction · 0.80
executeMethod · 0.80

Calls 7

PasswordUnknownClass · 0.85
get_strMethod · 0.80
read_stringFunction · 0.50
ExceptionClass · 0.50
typeMethod · 0.45
addressMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected