changeset 3696:52ee22d78e18

plugin XEP-0384: fix encryption for user own devices: our own jid is added automatically by OMEMO library, but during the generation of the stanza, our list of jids was used to get the keys (and thus our own jid and devices keys was missing). fix 402
author Goffi <goffi@goffi.org>
date Fri, 22 Oct 2021 18:46:51 +0200
parents 87caf6284c55
children 842b522d525e
files sat/plugins/plugin_xep_0384.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0384.py	Fri Oct 22 10:40:24 2021 +0200
+++ b/sat/plugins/plugin_xep_0384.py	Fri Oct 22 18:46:51 2021 +0200
@@ -1424,13 +1424,12 @@
         header_elt = encrypted_elt.addElement('header')
         header_elt['sid'] = str(encryption_data['sid'])
 
-        for to_jid in to_jids:
-            bare_jid_s = to_jid.userhost()
-
-            for rid, data in encryption_data['keys'][bare_jid_s].items():
+        for key_data in encryption_data['keys'].values():
+            for rid, data in key_data.items():
                 key_elt = header_elt.addElement(
                     'key',
-                    content=b64enc(data['data']))
+                    content=b64enc(data['data'])
+                )
                 key_elt['rid'] = str(rid)
                 if data['pre_key']:
                     key_elt['prekey'] = 'true'