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
This commit is contained in:
Goffi 2018-08-11 18:24:55 +02:00
commit e4bda681b8

View file

@ -438,14 +438,48 @@ doc_param_5=%(doc_profile_key)s
[messageEncryptionStart]
type=method
category=core
sig_in=sss
sig_in=ssbs
sig_out=
param_1_default=''
param_2_default="@NONE@"
param_2_default=False
param_3_default="@NONE@"
doc=Start an encryption session
doc_param_0=to_jid: JID of the recipient (bare_jid if it must be encoded for all devices)
doc_param_0=to_jid: JID of the recipient (bare jid if it must be encrypted for all devices)
doc_param_1=encryption_ns: Namespace of the encryption algorithm to use
doc_param_2=%(doc_profile_key)s
doc_param_2=replace: If True and an encryption session already exists, it will be replaced by this one
else a ConflictError will be raised
doc_param_3=%(doc_profile_key)s
[messageEncryptionStop]
type=method
category=core
sig_in=ss
sig_out=
doc=Start an encryption session
doc_param_0=to_jid: JID of the recipient (full jid if encryption must be stopped for one device only)
doc_param_1=%(doc_profile_key)s
[messageEncryptionGet]
type=method
category=core
sig_in=ss
sig_out=s
doc=Retrieve encryption data for a given entity
doc_param_0=to_jid: bare JID of the recipient
doc_param_1=%(doc_profile_key)s
doc_return=[JSON_OBJ] empty string if session is unencrypted, else a json encoded objects.
In case of dict, following keys are always present:
- name: human readable name of the encryption algorithm
- namespace: namespace of the plugin
following key can be present if suitable:
- directed_devices: list or resource where session is encrypted
[encryptionPluginsGet]
type=method
category=core
sig_in=
sig_out=aa{ss}
doc=Retrieve registered plugins for encryption
[setPresence]
type=method