summaryrefslogtreecommitdiff
path: root/service/pixelated/bitmask_libraries
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2017-01-09 16:13:39 -0200
committerTulio Casagrande <tcasagra@thoughtworks.com>2017-01-09 16:13:39 -0200
commitbc84433a06a742c3b29e115fb9e88c86df0f2b1c (patch)
tree6295f79bb5c99e7931e7e56b026aebe472621dd6 /service/pixelated/bitmask_libraries
parent6cbc4b8624e165bdedada83637e1a228247407ef (diff)
Log user's current key for easier debug
Related with: #815
Diffstat (limited to 'service/pixelated/bitmask_libraries')
-rw-r--r--service/pixelated/bitmask_libraries/keymanager.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/service/pixelated/bitmask_libraries/keymanager.py b/service/pixelated/bitmask_libraries/keymanager.py
index 84e3f6aa..28d5f9db 100644
--- a/service/pixelated/bitmask_libraries/keymanager.py
+++ b/service/pixelated/bitmask_libraries/keymanager.py
@@ -48,16 +48,19 @@ class Keymanager(object):
def generate_openpgp_key(self):
current_key = yield self._key_exists(self._email)
if not current_key:
- yield self._generate_key_and_send_to_leap()
+ current_key = yield self._generate_key_and_send_to_leap()
elif current_key.needs_renewal(DEFAULT_EXTENSION_THRESHOLD):
- yield self._regenerate_key_and_send_to_leap()
+ current_key = yield self._regenerate_key_and_send_to_leap()
+
+ logger.info("Current key for {}: {}".format(self._email, current_key.fingerprint))
@defer.inlineCallbacks
def _regenerate_key_and_send_to_leap(self):
logger.info("Regenerating keys - this could take a while...")
- yield self.keymanager.regenerate_key()
+ key = yield self.keymanager.regenerate_key()
try:
- yield self._send_key_to_leap()
+ yield self.keymanager.send_key()
+ defer.returnValue(key)
except Exception as e:
# what to be done when upload key error
raise UploadKeyError(e.message)
@@ -65,9 +68,10 @@ class Keymanager(object):
@defer.inlineCallbacks
def _generate_key_and_send_to_leap(self):
logger.info("Generating keys - this could take a while...")
- yield self._gen_key()
+ key = yield self.keymanager.gen_key()
try:
- yield self._send_key_to_leap()
+ yield self.keymanager.send_key()
+ defer.returnValue(key)
except Exception as e:
yield self.delete_key_pair()
raise UploadKeyError(e.message)
@@ -86,15 +90,6 @@ class Keymanager(object):
defer.returnValue(key)
@defer.inlineCallbacks
- def _gen_key(self):
- key = yield self.keymanager.gen_key()
- defer.returnValue(key)
-
- @defer.inlineCallbacks
- def _send_key_to_leap(self):
- yield self.keymanager.send_key()
-
- @defer.inlineCallbacks
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)