Mercurial > libervia-backend
comparison src/bridge/DBus.py @ 1030:15f43b54d697
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
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 07 May 2014 16:02:23 +0200 |
parents | 8bae81e254a2 |
children | 6e975c6b0faf |
comparison
equal
deleted
inserted
replaced
1029:f6182f6418ea | 1030:15f43b54d697 |
---|---|
192 async_callbacks=None) | 192 async_callbacks=None) |
193 def addContact(self, entity_jid, profile_key="@DEFAULT@"): | 193 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
194 return self._callback("addContact", unicode(entity_jid), unicode(profile_key)) | 194 return self._callback("addContact", unicode(entity_jid), unicode(profile_key)) |
195 | 195 |
196 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 196 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
197 in_signature='s', out_signature='', | 197 in_signature='ss', out_signature='b', |
198 async_callbacks=('callback', 'errback')) | 198 async_callbacks=('callback', 'errback')) |
199 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): | 199 def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None): |
200 return self._callback("asyncConnect", unicode(profile_key), callback=callback, errback=errback) | 200 return self._callback("asyncConnect", unicode(profile_key), unicode(password), callback=callback, errback=errback) |
201 | 201 |
202 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 202 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
203 in_signature='s', out_signature='', | 203 in_signature='ss', out_signature='', |
204 async_callbacks=('callback', 'errback')) | 204 async_callbacks=('callback', 'errback')) |
205 def asyncCreateProfile(self, profile, callback=None, errback=None): | 205 def asyncCreateProfile(self, profile, password='', callback=None, errback=None): |
206 return self._callback("asyncCreateProfile", unicode(profile), callback=callback, errback=errback) | 206 return self._callback("asyncCreateProfile", unicode(profile), unicode(password), callback=callback, errback=errback) |
207 | 207 |
208 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 208 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
209 in_signature='s', out_signature='', | 209 in_signature='s', out_signature='', |
210 async_callbacks=('callback', 'errback')) | 210 async_callbacks=('callback', 'errback')) |
211 def asyncDeleteProfile(self, profile, callback=None, errback=None): | 211 def asyncDeleteProfile(self, profile, callback=None, errback=None): |
222 async_callbacks=None) | 222 async_callbacks=None) |
223 def confirmationAnswer(self, id, accepted, data, profile): | 223 def confirmationAnswer(self, id, accepted, data, profile): |
224 return self._callback("confirmationAnswer", unicode(id), accepted, data, unicode(profile)) | 224 return self._callback("confirmationAnswer", unicode(id), accepted, data, unicode(profile)) |
225 | 225 |
226 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 226 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
227 in_signature='s', out_signature='', | 227 in_signature='ss', out_signature='b', |
228 async_callbacks=None) | 228 async_callbacks=None) |
229 def connect(self, profile_key="@DEFAULT@"): | 229 def connect(self, profile_key="@DEFAULT@", password=''): |
230 return self._callback("connect", unicode(profile_key)) | 230 return self._callback("connect", unicode(profile_key), unicode(password)) |
231 | 231 |
232 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 232 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
233 in_signature='ss', out_signature='', | 233 in_signature='ss', out_signature='', |
234 async_callbacks=None) | 234 async_callbacks=None) |
235 def delContact(self, entity_jid, profile_key="@DEFAULT@"): | 235 def delContact(self, entity_jid, profile_key="@DEFAULT@"): |