From 33d605f5e2ccee2589a4cac94e34c379db7eb154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 31 Jan 2019 11:07:29 +0100 Subject: [PATCH] xep_0384: Use DefaultOTPKPolicy from the lib. Remove stuff implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- otpkpolicy.py | 15 --------------- plugin.py | 5 ++--- 2 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 otpkpolicy.py diff --git a/otpkpolicy.py b/otpkpolicy.py deleted file mode 100644 index 4c232a5..0000000 --- a/otpkpolicy.py +++ /dev/null @@ -1,15 +0,0 @@ -""" - Slixmpp: The Slick XMPP Library - - Shamelessly inspired from Syndace's python-omemo examples. -""" - -import omemo - - -class KeepingOTPKPolicy(omemo.OTPKPolicy): - @staticmethod - def decideOTPK(preKeyMessages): - # Always keep the OTPK. - # This is the unsafest behaviour possible and should be avoided at all costs. - return True diff --git a/plugin.py b/plugin.py index 48da101..0bd0597 100644 --- a/plugin.py +++ b/plugin.py @@ -28,12 +28,11 @@ log = logging.getLogger(__name__) HAS_OMEMO = True try: import omemo.exceptions - from omemo import SessionManager, ExtendedPublicBundle + from omemo import SessionManager, ExtendedPublicBundle, DefaultOTPKPolicy from omemo.util import generateDeviceID from omemo.backends import Backend from omemo_backend_signal import BACKEND as SignalBackend from omemo.implementation import JSONFileStorage - from slixmpp.plugins.xep_0384.otpkpolicy import KeepingOTPKPolicy except (ImportError,): HAS_OMEMO = False @@ -132,7 +131,7 @@ class XEP_0384(BasePlugin): default_config = { 'data_dir': None, 'storage_backend': JSONFileStorage, - 'otpk_policy': KeepingOTPKPolicy, + 'otpk_policy': DefaultOTPKPolicy, 'omemo_backend': SignalBackend, }