diff options
author | Philipp Hörist <philipp@hoerist.com> | 2023-05-10 21:12:53 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2023-05-10 21:12:53 +0300 |
commit | 09cffc03dc54c95766a0ad2060939b34d75027b7 (patch) | |
tree | cc629f6ecacd16f0c1b76aa8d38bd4aeac3fdc46 | |
parent | 7cd4a1e7afe2c11191a629de49d17333d5faa45b (diff) |
change: OMEMO: Add device id and namespace to OMEMOBundle
-rw-r--r-- | nbxmpp/modules/omemo.py | 8 | ||||
-rw-r--r-- | nbxmpp/structs.py | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/nbxmpp/modules/omemo.py b/nbxmpp/modules/omemo.py index d980c23..780f5ca 100644 --- a/nbxmpp/modules/omemo.py +++ b/nbxmpp/modules/omemo.py @@ -161,7 +161,7 @@ class OMEMO(BaseModule): if not items: yield task.set_result(None) - yield _parse_bundle(items[0]) + yield _parse_bundle(items[0], device_id) def _parse_omemo_message(stanza): @@ -235,7 +235,7 @@ def _parse_omemo_message(stanza): return OMEMOMessage(sid=sid, iv=iv, keys=keys, payload=payload) -def _parse_bundle(item): +def _parse_bundle(item, device_id): ''' <item id='current'> <bundle xmlns='eu.siacs.conversations.axolotl'> @@ -317,7 +317,9 @@ def _parse_bundle(item): result['otpks'].append({'key': key, 'id': id_}) - return OMEMOBundle(**result) + return OMEMOBundle(**result, + device_id=device_id, + namespace=Namespace.OMEMO_TEMP) def _make_bundle(bundle): diff --git a/nbxmpp/structs.py b/nbxmpp/structs.py index 663b49b..1b1398f 100644 --- a/nbxmpp/structs.py +++ b/nbxmpp/structs.py @@ -732,6 +732,8 @@ class OMEMOBundle(NamedTuple): spk_signature: bytes ik: bytes otpks: list[dict[str, str]] + device_id: int = -1 + namespace: str = Namespace.OMEMO_TEMP def pick_prekey(self) -> dict[str, str]: return random.SystemRandom().choice(self.otpks) |