Changeset View
Changeset View
Standalone View
Standalone View
native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | if (-1 == | ||||
::olm_unpickle_account( | ::olm_unpickle_account( | ||||
this->account, | this->account, | ||||
secretKey.data(), | secretKey.data(), | ||||
secretKey.size(), | secretKey.size(), | ||||
persist.account.data(), | persist.account.data(), | ||||
persist.account.size())) { | persist.account.size())) { | ||||
throw std::runtime_error{"error restoreFromB64 => ::olm_unpickle_account"}; | throw std::runtime_error{"error restoreFromB64 => ::olm_unpickle_account"}; | ||||
} | } | ||||
if (persist.account.size() != ::olm_pickle_account_length(this->account)) { | |||||
throw std::runtime_error{ | |||||
"error restoreFromB64 => ::olm_pickle_account_length"}; | |||||
} | |||||
std::unordered_map<std::string, OlmBuffer>::iterator it; | std::unordered_map<std::string, OlmBuffer>::iterator it; | ||||
for (it = persist.sessions.begin(); it != persist.sessions.end(); ++it) { | for (it = persist.sessions.begin(); it != persist.sessions.end(); ++it) { | ||||
std::unique_ptr<Session> session = session->restoreFromB64( | std::unique_ptr<Session> session = session->restoreFromB64( | ||||
this->account, this->keys.identityKeys.data(), secretKey, it->second); | this->account, this->keys.identityKeys.data(), secretKey, it->second); | ||||
this->sessions.insert(make_pair(it->first, move(session))); | this->sessions.insert(make_pair(it->first, move(session))); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |