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
This commit is contained in:
Goffi 2021-10-22 18:46:51 +02:00
commit bdbf4596da

View file

@ -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'