From e7bad69fc712859c05a57cdf7af1e2c4956fe10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 14 May 2018 11:16:54 +0200 Subject: [PATCH] xep_0384: b64 helpers --- plugin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin.py b/plugin.py index d02a3a2..621f8b0 100644 --- a/plugin.py +++ b/plugin.py @@ -9,6 +9,7 @@ import logging from slixmpp.jid import JID +import base64 from slixmpp.plugins.xep_0384.stanza import OMEMO_BASE_NS from slixmpp.plugins.xep_0384.stanza import OMEMO_DEVICES_NS, OMEMO_BUNDLE_NS from slixmpp.plugins.base import BasePlugin, register_plugin @@ -22,6 +23,14 @@ except ImportError as e: HAS_OMEMO = False +def b64enc(data): + return base64.b64encode(bytes(bytearray(data))).decode('ASCII') + + +def b64dec(data): + return base64.b64decode(data.decode('ASCII')) + + class XEP_0384(BasePlugin): """