aboutsummaryrefslogtreecommitdiff
path: root/main/src/plugins/omemo/protocol
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2026-10-23 16:46:01 +0200
committerMarvin W <git@larma.de>2026-10-23 17:01:44 +0200
commit5bf8b829b7f7f2fb6e2b920eed8eace6a801157c (patch)
treeb6a4ce6ca29c9ce96dd4547b825436f20e83a793 /main/src/plugins/omemo/protocol
parent2eb311938665f92ef48e2cfa030720fc68ca7cc9 (diff)
omemo: Hand direct database access to libomemo
Previously used an in-memory map to represent the database content and kept those in sync
Diffstat (limited to 'main/src/plugins/omemo/protocol')
-rw-r--r--main/src/plugins/omemo/protocol/bundle.vala4
-rw-r--r--main/src/plugins/omemo/protocol/stream_module.vala13
2 files changed, 13 insertions, 4 deletions
diff --git a/main/src/plugins/omemo/protocol/bundle.vala b/main/src/plugins/omemo/protocol/bundle.vala
index b7e2b9cf..abd5269f 100644
--- a/main/src/plugins/omemo/protocol/bundle.vala
+++ b/main/src/plugins/omemo/protocol/bundle.vala
@@ -58,6 +58,10 @@ public class Bundle {
return list;
}}
+ public bool is_valid { get {
+ return signed_pre_key_id != -1 && signed_pre_key != null && signed_pre_key_signature != null && identity_key != null;
+ }}
+
public class PreKey {
private StanzaNode node;
diff --git a/main/src/plugins/omemo/protocol/stream_module.vala b/main/src/plugins/omemo/protocol/stream_module.vala
index 695c3508..3958bc23 100644
--- a/main/src/plugins/omemo/protocol/stream_module.vala
+++ b/main/src/plugins/omemo/protocol/stream_module.vala
@@ -153,15 +153,20 @@ public class StreamModule : XmppStreamModule {
if (node == null) {
// Device not registered, shouldn't exist
if (ignore_if_non_present) {
- debug("Ignoring device %s/%d: No bundle", jid.bare_jid.to_string(), device_id);
+ warning("Ignoring device %s/%d: No bundle", jid.bare_jid.to_string(), device_id);
stream.get_module(IDENTITY).ignore_device(jid, device_id);
}
bundle_fetch_failed(jid, device_id);
} else {
Bundle bundle = new Bundle(node);
- stream.get_module(IDENTITY).unignore_device(jid, device_id);
- debug("Received bundle for %s/%d: %s", jid.bare_jid.to_string(), device_id, Base64.encode(bundle.identity_key.serialize()));
- bundle_fetched(jid, device_id, bundle);
+ if (bundle.is_valid) {
+ stream.get_module(IDENTITY).unignore_device(jid, device_id);
+ debug("Received bundle for %s/%d: %s", jid.bare_jid.to_string(), device_id, Base64.encode(bundle.identity_key.serialize()));
+ bundle_fetched(jid, device_id, bundle);
+ } else {
+ warning("Ignoring device %s/%d: Invalid bundle", jid.bare_jid.to_string(), device_id);
+ bundle_fetch_failed(jid, device_id);
+ }
}
stream.get_module(IDENTITY).active_bundle_requests.remove(jid.bare_jid.to_string() + @":$device_id");
}