Changeset View
Changeset View
Standalone View
Standalone View
native/cpp/CommonCpp/CryptoTools/Session.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | if (-1 == | ||||
::olm_unpickle_session( | ::olm_unpickle_session( | ||||
session->olmSession, | session->olmSession, | ||||
secretKey.data(), | secretKey.data(), | ||||
secretKey.size(), | secretKey.size(), | ||||
b64.data(), | b64.data(), | ||||
b64.size())) { | b64.size())) { | ||||
throw std::runtime_error("error pickleSession => ::olm_unpickle_session"); | throw std::runtime_error("error pickleSession => ::olm_unpickle_session"); | ||||
} | } | ||||
if (b64.size() != ::olm_pickle_session_length(session->olmSession)) { | |||||
throw std::runtime_error( | |||||
"error pickleSession => ::olm_pickle_session_length"); | |||||
} | |||||
return session; | return session; | ||||
} | } | ||||
OlmSession *Session::getOlmSession() { | OlmSession *Session::getOlmSession() { | ||||
if (this->olmSession == nullptr) { | if (this->olmSession == nullptr) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"trying to obtain a session pointer of uninitialized session"); | "trying to obtain a session pointer of uninitialized session"); | ||||
} | } | ||||
return this->olmSession; | return this->olmSession; | ||||
} | } | ||||
} // namespace crypto | } // namespace crypto | ||||
} // namespace comm | } // namespace comm |