From f9cab77861b4fdaa5371b290b25bb4fec841c5dc Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Mon, 11 Apr 2011 01:33:32 -0400 Subject: Preliminary support of a user private key. --- server/plugin.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'server/plugin.py') diff --git a/server/plugin.py b/server/plugin.py index 892977e..393e675 100644 --- a/server/plugin.py +++ b/server/plugin.py @@ -17,7 +17,7 @@ class AliasQuery(ElementBase): name = 'query' plugin_attrib = 'alias' interfaces = set(('node', 'type', 'content', 'permission', 'key')) - sub_interfaces = set(('content', 'permission', 'key')) + sub_interfaces = set(('content', 'permission', 'key', 'salt')) def addItem(self, node, key, permission = None): item = AliasItem(None, self) @@ -55,11 +55,21 @@ class AliasPlugin(base.base_plugin): iq.send() def handle_alias_query(self, iq): + caller = iq['from'].bare + + if iq['alias']['type'] == 'keys': + key, salt = Object(caller).get_private_key(); + iq.reply() + iq['alias']['type'] = 'keys' + iq['alias']['key'] = key + iq['alias']['salt'] = salt + iq.send() + try: callee = base64.b64decode(iq['to'].user) except TypeError: logging.error("callee field not base64 encoded") - caller = iq['from'].bare + node = iq['alias']['node'] if not node: node = hashlib.sha1(callee).hexdigest() -- cgit v1.2.3-70-g09d2