summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-06-15 11:27:32 +0200
committerRuben Pollan <meskio@sindominio.net>2017-06-15 11:27:32 +0200
commitfe67a55d8744aede22f69b53b5ce0b983a3f4823 (patch)
tree6e677cda78795f157aabed3ec40d85e92d7525dd /src/leap/bitmask/core
parent69e4fb92bad4bb593d59cfe29eb51d238e0fd8db (diff)
[feat] Add a 'fetch' flag to key export
If is set keyamanger will try to discover and download the key. - Resolves: #8821
Diffstat (limited to 'src/leap/bitmask/core')
-rw-r--r--src/leap/bitmask/core/dispatcher.py10
-rw-r--r--src/leap/bitmask/core/mail_services.py4
2 files changed, 9 insertions, 5 deletions
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index e0cc1297..3d6f6704 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -315,10 +315,14 @@ class KeysCmd(SubCommand):
address = parts[3]
private = False
- if parts[-1] == 'private':
- private = True
+ fetch_remote = False
+ if len(parts) > 4:
+ if parts[4] == 'private':
+ private = True
+ elif parts[4] == 'fetch':
+ fetch_remote = True
- return service.do_export(uid, address, private)
+ return service.do_export(uid, address, private, fetch_remote)
@register_method('dict')
def do_INSERT(self, service, *parts, **kw):
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index a0238279..48528d8d 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -397,13 +397,13 @@ class KeymanagerService(HookableService):
d.addCallback(lambda keys: [dict(key) for key in keys])
return d
- def do_export(self, userid, address, private=False):
+ def do_export(self, userid, address, private=False, fetch_remote=False):
km = self._container.get_instance(userid)
if km is None:
return defer.fail(ValueError("User " + userid + " has no active "
"keymanager"))
- d = km.get_key(address, private=private, fetch_remote=False)
+ d = km.get_key(address, private=private, fetch_remote=fetch_remote)
d.addCallback(lambda key: dict(key))
return d