Change decrypt_message API. Don't take the entire message anymore

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-08-27 23:43:04 +02:00
parent 2b63352626
commit e893e6aeec
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -414,11 +414,16 @@ class XEP_0384(BasePlugin):
def is_encrypted(self, msg: Message) -> bool:
return msg.xml.find('{%s}encrypted' % OMEMO_BASE_NS) is not None
def decrypt_message(self, msg: Message, allow_untrusted: bool = False) -> Optional[str]:
header = msg['omemo_encrypted']['header']
payload = b64dec(msg['omemo_encrypted']['payload']['value'])
def decrypt_message(
self,
encrypted: Encrypted,
sender: JID,
allow_untrusted: bool = False,
) -> Optional[str]:
header = encrypted['header']
payload = b64dec(encrypted['payload']['value'])
jid = msg['from'].bare
jid = sender
sid = int(header['sid'])
key = header.xml.find("{%s}key[@rid='%s']" % (