core, memory, bridge: added profile password + password encryption:

/!\ This changeset updates the database version to 2 and modify the database content!

Description:
    - new parameter General / Password to store the profile password
    - profile password is initialized with XMPP password value, it is stored hashed
    - bridge methods asyncCreateProfile/asyncConnect takes a new argument "password" (default = "")
    - bridge method asyncConnect returns a boolean (True = connection already established, False = connection initiated)
    - profile password is checked before initializing the XMPP connection

    - new private individual parameter to store the personal encryption key of each profile
    - personal key is randomly generated and encrypted with the profile password
    - personal key is decrypted after profile authentification and stored in a Sessions instance
    - personal key is used to encrypt/decrypt other passwords when they need to be retrieved/modified

    - modifying the profile password re-encrypt the personal key
    - Memory.setParam now returns a Deferred (the bridge method "setParam" is unchanged)
    - Memory.asyncGetParamA eventually decrypts the password, Memory.getParamA would fail on a password parameter

TODO:
    - if profile authentication is OK but XMPP authentication is KO, prompt the user for another XMPP password
    - fix the method "registerNewAccount" (and move it to a plugin)
    - remove bridge method "connect", sole "asyncConnect" should be used
This commit is contained in:
souliane 2014-05-07 16:02:23 +02:00
commit 0d28c03d27

View file

@ -204,10 +204,12 @@ doc_return=dictionary of asked key,
async=
type=method
category=core
sig_in=s
sig_in=ss
sig_out=
param_1_default=''
doc=Create a new profile
doc_param_0=%(doc_profile)s
doc_param_1=password: password of the profile
doc_return=callback is called when profile actually exists in database and memory
errback is called with error constant as parameter:
- ConflictError: the profile name already exists
@ -243,21 +245,35 @@ doc_param_4=port: port of the server to register to
[connect]
type=method
category=core
sig_in=s
sig_out=
sig_in=ss
sig_out=b
param_0_default="@DEFAULT@"
param_1_default=''
doc=Connect a profile
doc_param_0=%(doc_profile_key)s
doc_param_1=password: the SàT profile password
doc_return=a deferred boolean or failure:
- boolean if the profile authentication succeed:
- True if the XMPP connection was already established
- False if the XMPP connection has been initiated (it may still fail)
- failure if the profile authentication failed
[asyncConnect]
async=
type=method
category=core
sig_in=s
sig_out=
sig_in=ss
sig_out=b
param_0_default="@DEFAULT@"
param_1_default=''
doc=Connect a profile
doc_param_0=%(doc_profile_key)s
doc_param_1=password: the SàT profile password
doc_return=a deferred boolean or failure:
- boolean if the profile authentication succeed:
- True if the XMPP connection was already established
- False if the XMPP connection has been initiated (it may still fail)
- failure if the profile authentication failed
[disconnect]
type=method