summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-08-20 14:00:16 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-08-20 14:00:35 +0200
commit54169880577d3ec98aad0f96020d665052776027 (patch)
treee448f353ad3d5add4575f507728dde8cfb4ab43b /src
parentDisable async timeline loading, since it hangs in a layout loop sometimes (diff)
downloadnheko-54169880577d3ec98aad0f96020d665052776027.tar.xz
Trust key forwards from the original sender
Diffstat (limited to 'src')
-rw-r--r--src/Olm.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Olm.cpp b/src/Olm.cpp
index 05eefce4..c0360e1c 100644
--- a/src/Olm.cpp
+++ b/src/Olm.cpp
@@ -835,6 +835,13 @@ import_inbound_megolm_session(
                 data.sender_claimed_ed25519_key = roomKey.content.sender_claimed_ed25519_key;
                 // may have come from online key backup, so we can't trust it...
                 data.trusted = false;
+                // if we got it forwarded from the sender, assume it is trusted. They may still have
+                // used key backup, but it is unlikely.
+                if (roomKey.content.forwarding_curve25519_key_chain.size() == 1 &&
+                    roomKey.content.forwarding_curve25519_key_chain.back() ==
+                      roomKey.content.sender_key) {
+                        data.trusted = true;
+                }
 
                 cache::saveInboundMegolmSession(index, std::move(megolm_session), data);
         } catch (const lmdb::error &e) {