summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorNavaL <ayoyo@thoughtworks.com>2016-11-21 14:23:20 +0100
committerThais Siqueira <thais.siqueira@gmail.com>2017-01-02 14:29:45 -0200
commit56a0db46f2e53c453b8c5e67202601f7dac6c0b5 (patch)
tree2c9c785f4be54efac139bb45cd25e98bf64a9bbd /service/pixelated
parent7f7cb59a38a3be3d486bafc810133b584d7fd7a7 (diff)
[#815] regenerating new keys when the current one expires
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/bitmask_libraries/keymanager.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/service/pixelated/bitmask_libraries/keymanager.py b/service/pixelated/bitmask_libraries/keymanager.py
index 4af7d982..464604db 100644
--- a/service/pixelated/bitmask_libraries/keymanager.py
+++ b/service/pixelated/bitmask_libraries/keymanager.py
@@ -47,6 +47,7 @@ class Keymanager(object):
yield self._regenerate_key()
yield self._send_key_to_leap()
+ @defer.inlineCallbacks
def _regenerate_key(self):
yield self.keymanager.regenerate_key()
@@ -57,7 +58,7 @@ class Keymanager(object):
try:
yield self._send_key_to_leap()
except Exception as e:
- yield self.delete_key_pair(self._email)
+ yield self.delete_key_pair()
raise UploadKeyError(e.message)
@defer.inlineCallbacks
@@ -68,17 +69,22 @@ class Keymanager(object):
except KeyNotFound:
defer.returnValue(None)
+ @defer.inlineCallbacks
def get_key(self, email, private=False, fetch_remote=True):
- return self.keymanager.get_key(email, private=private, fetch_remote=fetch_remote)
+ key = yield self.keymanager.get_key(email, private=private, fetch_remote=fetch_remote)
+ defer.returnValue(key)
+ @defer.inlineCallbacks
def _gen_key(self):
- return self.keymanager.gen_key()
+ key = yield self.keymanager.gen_key()
+ defer.returnValue(key)
+ @defer.inlineCallbacks
def _send_key_to_leap(self):
- return self.keymanager.send_key()
+ yield self.keymanager.send_key()
@defer.inlineCallbacks
- def delete_key_pair(self, key):
+ def delete_key_pair(self):
private_key = yield self.get_key(self._email, private=True, fetch_remote=False)
public_key = yield self.get_key(self._email, private=False, fetch_remote=False)