xep_0384: Use DefaultOTPKPolicy from the lib. Remove stuff implementation

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-01-31 11:07:29 +01:00
parent 7ccd6c89fb
commit 33d605f5e2
2 changed files with 2 additions and 18 deletions

View file

@ -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

View file

@ -28,12 +28,11 @@ log = logging.getLogger(__name__)
HAS_OMEMO = True HAS_OMEMO = True
try: try:
import omemo.exceptions import omemo.exceptions
from omemo import SessionManager, ExtendedPublicBundle from omemo import SessionManager, ExtendedPublicBundle, DefaultOTPKPolicy
from omemo.util import generateDeviceID from omemo.util import generateDeviceID
from omemo.backends import Backend from omemo.backends import Backend
from omemo_backend_signal import BACKEND as SignalBackend from omemo_backend_signal import BACKEND as SignalBackend
from omemo.implementation import JSONFileStorage from omemo.implementation import JSONFileStorage
from slixmpp.plugins.xep_0384.otpkpolicy import KeepingOTPKPolicy
except (ImportError,): except (ImportError,):
HAS_OMEMO = False HAS_OMEMO = False
@ -132,7 +131,7 @@ class XEP_0384(BasePlugin):
default_config = { default_config = {
'data_dir': None, 'data_dir': None,
'storage_backend': JSONFileStorage, 'storage_backend': JSONFileStorage,
'otpk_policy': KeepingOTPKPolicy, 'otpk_policy': DefaultOTPKPolicy,
'omemo_backend': SignalBackend, 'omemo_backend': SignalBackend,
} }