Commit f6f6895e authored by Philipp Hörist's avatar Philipp Hörist

OMEMO: Add support for key transport messages

parent 92b6173d
......@@ -25,6 +25,7 @@ from nbxmpp.protocol import NS_EME
from nbxmpp.protocol import NS_HINTS
from nbxmpp.protocol import NodeProcessed
from nbxmpp.protocol import Node
from nbxmpp.protocol import Message
from nbxmpp.protocol import isResultNode
from nbxmpp.protocol import StanzaMalformed
from nbxmpp.util import call_on_response
......@@ -435,6 +436,25 @@ def create_omemo_message(stanza, omemo_message, store_hint=True,
stanza.addChild(node=Node('store', attrs={'xmlns': NS_HINTS}))
def get_key_transport_message(typ, jid, omemo_message):
message = Message(typ=typ, to=jid)
encrypted = Node('encrypted', attrs={'xmlns': NS_OMEMO_TEMP})
header = Node('header', attrs={'sid': omemo_message.sid})
for rid, (key, prekey) in omemo_message.keys.items():
attrs = {'rid': rid}
if prekey:
attrs['prekey'] = 'true'
child = header.addChild('key', attrs=attrs)
return message
def cleanup_stanza(stanza, node_whitelist):
whitelisted_nodes = []
for tag, ns in node_whitelist:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment