Commit 2455d00d authored by Maxime Buquet's avatar Maxime Buquet

xep_0384: Add allow_untrusted parameter to decrypt_message

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <>
parent 2a14807c
......@@ -303,7 +303,7 @@ 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) -> Optional[str]:
def decrypt_message(self, msg: Message, allow_untrusted: bool = False) -> Optional[str]:
header = msg['omemo_encrypted']['header']
payload = b64dec(msg['omemo_encrypted']['payload']['value'])
......@@ -330,6 +330,7 @@ class XEP_0384(BasePlugin):
return body
except (omemo.exceptions.NoSessionException,):
......@@ -389,9 +390,7 @@ class XEP_0384(BasePlugin):
devices = bundles.setdefault(exn.bare_jid, {})
devices[exn.device] = bundle
elif isinstance(exn, omemo.exceptions.UntrustedException):
# TODO: Pass the exception down to the lib user
# raise UntrustedException(exn.bare_jid, exn.device, exn.ik), exn.device, exn.ik)
raise UntrustedException(exn.bare_jid, exn.device, exn.ik)
elif isinstance(exn, omemo.exceptions.NoEligibleDevicesException):
# This error is returned by the library to specify that
# encryption is not possible to any device of a user.
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