comparison sat_frontends/bridge/pb.py @ 2658:4e130cc9bfc0

core (memore/encryption): new methods and checks: Following methods are now available though bridge: - messageEncryptionStop - messageEncryptionGet: retrieve encryption data for a message session - encryptionPluginsGet: retrieve all registered encryption plugin Following methods are available for internal use: - getPlugins: retrieve registerd plugins - getNSFromName: retrieve namespace from plugin name - getBridgeData: serialise session data (to be used with bridge) - markAsEncrypted: mark message data as encrypted (to be set by encryption plugin in MessageReceived trigger) Behaviours improvments: - start and stop send messageEncryptionStarted and messageEncryptionStopped signals, and a message feedback - new "replace" arguments in start allows to replace a plugin if one is already running (instead of raising a ConflictError) - plugins declare themselves as "directed" (i.e. working with only one device at a time) or not. This is checked while dealing with jids, an exception is raised when a full jid is received for a non directed encryption. - use of new data_format (de)serialise
author Goffi <goffi@goffi.org>
date Sat, 11 Aug 2018 18:24:55 +0200
parents 712cb4ff3e13
children e347e32aa07f
comparison
equal deleted inserted replaced
2657:9190874a8ac5 2658:4e130cc9bfc0
212 d.addCallback(lambda dummy: callback()) 212 d.addCallback(lambda dummy: callback())
213 if errback is None: 213 if errback is None:
214 errback = self._generic_errback 214 errback = self._generic_errback
215 d.addErrback(errback) 215 d.addErrback(errback)
216 216
217 def encryptionPluginsGet(self, callback=None, errback=None):
218 d = self.root.callRemote("encryptionPluginsGet")
219 if callback is not None:
220 d.addCallback(callback)
221 if errback is None:
222 errback = self._generic_errback
223 d.addErrback(errback)
224
217 def getConfig(self, section, name, callback=None, errback=None): 225 def getConfig(self, section, name, callback=None, errback=None):
218 d = self.root.callRemote("getConfig", section, name) 226 d = self.root.callRemote("getConfig", section, name)
219 if callback is not None: 227 if callback is not None:
220 d.addCallback(callback) 228 d.addCallback(callback)
221 if errback is None: 229 if errback is None:
380 d.addCallback(callback) 388 d.addCallback(callback)
381 if errback is None: 389 if errback is None:
382 errback = self._generic_errback 390 errback = self._generic_errback
383 d.addErrback(errback) 391 d.addErrback(errback)
384 392
385 def messageEncryptionStart(self, to_jid, encryption_ns='', profile_key="@NONE@", callback=None, errback=None): 393 def messageEncryptionGet(self, to_jid, profile_key, callback=None, errback=None):
386 d = self.root.callRemote("messageEncryptionStart", to_jid, encryption_ns, profile_key) 394 d = self.root.callRemote("messageEncryptionGet", to_jid, profile_key)
395 if callback is not None:
396 d.addCallback(callback)
397 if errback is None:
398 errback = self._generic_errback
399 d.addErrback(errback)
400
401 def messageEncryptionStart(self, to_jid, encryption_ns='', replace=False, profile_key="@NONE@", callback=None, errback=None):
402 d = self.root.callRemote("messageEncryptionStart", to_jid, encryption_ns, replace, profile_key)
403 if callback is not None:
404 d.addCallback(lambda dummy: callback())
405 if errback is None:
406 errback = self._generic_errback
407 d.addErrback(errback)
408
409 def messageEncryptionStop(self, to_jid, profile_key, callback=None, errback=None):
410 d = self.root.callRemote("messageEncryptionStop", to_jid, profile_key)
387 if callback is not None: 411 if callback is not None:
388 d.addCallback(lambda dummy: callback()) 412 d.addCallback(lambda dummy: callback())
389 if errback is None: 413 if errback is None:
390 errback = self._generic_errback 414 errback = self._generic_errback
391 d.addErrback(errback) 415 d.addErrback(errback)