From bdbf4596da03936277bd1a7a5674fb3eabd53637 Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 22 Oct 2021 18:46:51 +0200 Subject: [PATCH] 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 --- sat/plugins/plugin_xep_0384.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sat/plugins/plugin_xep_0384.py b/sat/plugins/plugin_xep_0384.py index 85e11ad2..74545dd6 100644 --- a/sat/plugins/plugin_xep_0384.py +++ b/sat/plugins/plugin_xep_0384.py @@ -1424,13 +1424,12 @@ class OMEMO: 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'