From df0aaf359090e1b0aee116c11bc4cdb38b1204f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 11 May 2018 03:59:32 +0200 Subject: [PATCH] xep_0384: Add 'encrypted' element --- stanza.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/stanza.py b/stanza.py index 6bdd5e9..bc42009 100644 --- a/stanza.py +++ b/stanza.py @@ -34,5 +34,46 @@ class Device(ElementBase): return children[0] +class Encrypted(ElementBase): + namespace = OMEMO_BASE_NS + name = 'encrypted' + plugin_attrib = 'omemo_encrypted' + interfaces = set() + + +class Header(ElementBase): + namespace = OMEMO_BASE_NS + name = 'header' + plugin_attrib = name + interfaces = {'sid'} + + +class Key(ElementBase): + namespace = OMEMO_BASE_NS + name = 'key' + plugin_attrib = name + interfaces = {'rid', 'prekey'} + + +class IV(ElementBase): + namespace = OMEMO_BASE_NS + name = 'iv' + plugin_attrib = name + interfaces = set() + + +class Payload(ElementBase): + namespace = OMEMO_BASE_NS + name = 'payload' + plugin_attrib = name + interfaces = set() + + +register_stanza_plugin(Message, Encrypted) +register_stanza_plugin(Encrypted, Header) +register_stanza_plugin(Header, Key) +register_stanza_plugin(Header, IV) +register_stanza_plugin(Encrypted, Payload) + register_stanza_plugin(EventItem, Devices) register_stanza_plugin(Devices, Device, iterable=True)