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:
parent
2b63352626
commit
e893e6aeec
1 changed files with 9 additions and 4 deletions
|
@ -414,11 +414,16 @@ class XEP_0384(BasePlugin):
|
||||||
def is_encrypted(self, msg: Message) -> bool:
|
def is_encrypted(self, msg: Message) -> bool:
|
||||||
return msg.xml.find('{%s}encrypted' % OMEMO_BASE_NS) is not None
|
return msg.xml.find('{%s}encrypted' % OMEMO_BASE_NS) is not None
|
||||||
|
|
||||||
def decrypt_message(self, msg: Message, allow_untrusted: bool = False) -> Optional[str]:
|
def decrypt_message(
|
||||||
header = msg['omemo_encrypted']['header']
|
self,
|
||||||
payload = b64dec(msg['omemo_encrypted']['payload']['value'])
|
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'])
|
sid = int(header['sid'])
|
||||||
|
|
||||||
key = header.xml.find("{%s}key[@rid='%s']" % (
|
key = header.xml.find("{%s}key[@rid='%s']" % (
|
||||||
|
|
Loading…
Reference in a new issue