comparison frontends/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 7e43ea75cce8
children 6e975c6b0faf
comparison
equal deleted inserted replaced
1029:f6182f6418ea 1030:15f43b54d697
97 97
98 return getPluginMethod 98 return getPluginMethod
99 def addContact(self, entity_jid, profile_key="@DEFAULT@"): 99 def addContact(self, entity_jid, profile_key="@DEFAULT@"):
100 return self.db_core_iface.addContact(entity_jid, profile_key) 100 return self.db_core_iface.addContact(entity_jid, profile_key)
101 101
102 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): 102 def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None):
103 return self.db_core_iface.asyncConnect(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) 103 return self.db_core_iface.asyncConnect(profile_key, password, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))
104 104
105 def asyncCreateProfile(self, profile, callback=None, errback=None): 105 def asyncCreateProfile(self, profile, password='', callback=None, errback=None):
106 return self.db_core_iface.asyncCreateProfile(profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) 106 return self.db_core_iface.asyncCreateProfile(profile, password, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))
107 107
108 def asyncDeleteProfile(self, profile, callback=None, errback=None): 108 def asyncDeleteProfile(self, profile, callback=None, errback=None):
109 return self.db_core_iface.asyncDeleteProfile(profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) 109 return self.db_core_iface.asyncDeleteProfile(profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))
110 110
111 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): 111 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
112 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))) 112 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
113 113
114 def confirmationAnswer(self, id, accepted, data, profile): 114 def confirmationAnswer(self, id, accepted, data, profile):
115 return self.db_core_iface.confirmationAnswer(id, accepted, data, profile) 115 return self.db_core_iface.confirmationAnswer(id, accepted, data, profile)
116 116
117 def connect(self, profile_key="@DEFAULT@"): 117 def connect(self, profile_key="@DEFAULT@", password=''):
118 return self.db_core_iface.connect(profile_key) 118 return self.db_core_iface.connect(profile_key, password)
119 119
120 def delContact(self, entity_jid, profile_key="@DEFAULT@"): 120 def delContact(self, entity_jid, profile_key="@DEFAULT@"):
121 return self.db_core_iface.delContact(entity_jid, profile_key) 121 return self.db_core_iface.delContact(entity_jid, profile_key)
122 122
123 def discoInfos(self, entity_jid, profile_key, callback=None, errback=None): 123 def discoInfos(self, entity_jid, profile_key, callback=None, errback=None):