summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-10-24 11:53:10 +0200
committerRuben Pollan <meskio@sindominio.net>2017-10-26 18:37:05 +0200
commit5243c7eb4c58a4419da2103af8c1e4004f01053b (patch)
treeb12fcb016fc95ed9a07a5a2501329db8ec2a623d /src/leap/bitmask/core
parentd16b25da0962156601615587a612b57b918b0dc6 (diff)
[feat] add fetch key by fingerprint to keymanager
- Resolves: #9023
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.py9
2 files changed, 19 insertions, 0 deletions
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index 91168d87..f2b3e8ca 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -363,6 +363,16 @@ class KeysCmd(SubCommand):
return service.do_export(uid, address, private, fetch_remote)
@register_method('dict')
+ def do_FETCH(self, service, *parts, **kw):
+ if len(parts) < 5:
+ raise ValueError("An email address is needed")
+ uid = parts[2]
+ address = parts[3]
+ fingerprint = parts[4]
+
+ return service.do_fetch(uid, address, fingerprint)
+
+ @register_method('dict')
def do_INSERT(self, service, *parts, **kw):
if len(parts) < 6:
raise ValueError("An email address is needed")
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 31c27364..23105c7a 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -422,6 +422,15 @@ class KeymanagerService(HookableService):
d.addCallback(lambda key: dict(key))
return d
+ def do_fetch(self, userid, address, fingerprint):
+ km = self._container.get_instance(userid)
+ if km is None:
+ return defer.fail(ValueError("User " + userid + " has no active "
+ "keymanager"))
+ d = km.fetch_key_fingerprint(address, fingerprint)
+ d.addCallback(lambda key: dict(key))
+ return d
+
def do_insert(self, userid, address, rawkey, validation='Fingerprint'):
km = self._container.get_instance(userid)
if km is None: