diff options
Diffstat (limited to 'src/leap/bitmask/core')
-rw-r--r-- | src/leap/bitmask/core/dispatcher.py | 11 | ||||
-rw-r--r-- | src/leap/bitmask/core/mail_services.py | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py index db40a675..785c60dc 100644 --- a/src/leap/bitmask/core/dispatcher.py +++ b/src/leap/bitmask/core/dispatcher.py @@ -171,6 +171,17 @@ class KeysCmd(SubCommand): d.addCallback(service.do_export, address) return d + @register_method('str') + def do_DELETE(self, service, *parts, **kw): + if len(parts) < 3: + return defer.fail("An email address is needed") + address = parts[2] + + bonafide = kw['bonafide'] + d = bonafide.do_get_active_user() + d.addCallback(service.do_delete, address) + return d + class CommandDispatcher(object): diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py index 0dd53189..8d205d92 100644 --- a/src/leap/bitmask/core/mail_services.py +++ b/src/leap/bitmask/core/mail_services.py @@ -358,6 +358,13 @@ class KeymanagerService(HookableService): d.addCallback(lambda key: dict(key)) return d + @defer.inlineCallbacks + def do_delete(self, userid, address): + km = self._container.get_instance(userid) + key = yield km.get_key(address, fetch_remote=False) + km.delete_key(key) + defer.returnValue(key.fingerprint) + class StandardMailService(service.MultiService, HookableService): """ |