summary refs log tree commit diff
path: root/src/Olm.cpp
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2021-02-01 18:42:38 -0500
committerJoseph Donofry <joedonofry@gmail.com>2021-02-01 18:42:38 -0500
commit53c653a228f529bab3753ca99dee18a5bf5342a2 (patch)
treead0ba40d27ca5a515f1f33c29c910e5cf7b20dd7 /src/Olm.cpp
parentRemove redundant import and fix visible warning (diff)
parentFix emojis with fe0f in the middle (diff)
downloadnheko-53c653a228f529bab3753ca99dee18a5bf5342a2.tar.xz
Merge remote-tracking branch 'nheko-im/master' into privacy_screen
Diffstat (limited to 'src/Olm.cpp')
-rw-r--r--src/Olm.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Olm.cpp b/src/Olm.cpp

index fe789560..4ccf8ab9 100644 --- a/src/Olm.cpp +++ b/src/Olm.cpp
@@ -890,12 +890,15 @@ decryptEvent(const MegolmSessionIndex &index, std::string msg_str; try { auto session = cache::client()->getInboundMegolmSession(index); + auto res = olm::client()->decrypt_group_message(session.get(), event.content.ciphertext); msg_str = std::string((char *)res.data.data(), res.data.size()); } catch (const lmdb::error &e) { return {DecryptionErrorCode::DbError, e.what(), std::nullopt}; } catch (const mtx::crypto::olm_exception &e) { + if (e.error_code() == mtx::crypto::OlmErrorCode::UNKNOWN_MESSAGE_INDEX) + return {DecryptionErrorCode::MissingSessionIndex, e.what(), std::nullopt}; return {DecryptionErrorCode::DecryptionFailed, e.what(), std::nullopt}; } @@ -961,6 +964,13 @@ send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::s auto d = deviceKeys->device_keys.at(device); + if (!d.keys.count("curve25519:" + device) || + !d.keys.count("ed25519:" + device)) { + nhlog::crypto()->warn("Skipping device {} since it has no keys!", + device); + continue; + } + auto session = cache::getLatestOlmSession(d.keys.at("curve25519:" + device)); if (!session || force_new_session) {