MCPcopy Create free account
hub / github.com/cryptonomex/graphene / unlock

Method unlock

programs/light_client/Wallet.cpp:180–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178 return _decrypted_master_key == fc::sha512();
179}
180bool Wallet::unlock(QString password)
181{
182 try {
183 if( !isLocked() ) return true;
184 auto pw_str = password.toStdString();
185 auto password_hash = fc::sha512::hash(pw_str.c_str(), pw_str.size());
186 auto plain_txt = fc::aes_decrypt(password_hash, _data.encrypted_master_key);
187 _decrypted_master_key = fc::raw::unpack<fc::sha512>(plain_txt);
188 if( _data.master_key_digest != fc::sha512::hash(_decrypted_master_key) )
189 _decrypted_master_key = fc::sha512();
190
191 Q_EMIT isLockedChanged(isLocked());
192 return !isLocked();
193 } catch (const fc::exception& e) {
194 elog(e.to_detail_string());
195 return false;
196 }
197}
198
199bool Wallet::lock()
200{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected