Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits: 09cffc03 by Philipp Hörist at 2023-05-10T20:12:53+02:00 change: OMEMO: Add device id and namespace to OMEMOBundle
- - - - -
2 changed files:
- nbxmpp/modules/omemo.py - nbxmpp/structs.py
Changes:
===================================== 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):
===================================== 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)
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/09cffc03dc54c95766a0ad206...