diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-07-15 14:01:10 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:23 +0200 |
commit | 8022ed744579aae6839f7d3c8e1a8c0903b426d5 (patch) | |
tree | 95bfccd957ebea197a239f6b86850bebe2e8041c | |
parent | c50160d7ac0aaf86339694c3bb2e513a7531bde0 (diff) |
keymanager reenabled
-rw-r--r-- | service/pixelated/bitmask_libraries/nicknym.py | 20 | ||||
-rw-r--r-- | service/pixelated/bitmask_libraries/session.py | 3 |
2 files changed, 13 insertions, 10 deletions
diff --git a/service/pixelated/bitmask_libraries/nicknym.py b/service/pixelated/bitmask_libraries/nicknym.py index 220d75e5..2d66e4da 100644 --- a/service/pixelated/bitmask_libraries/nicknym.py +++ b/service/pixelated/bitmask_libraries/nicknym.py @@ -15,6 +15,7 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. from leap.keymanager import KeyManager, openpgp, KeyNotFound from .certs import LeapCertificate +from twisted.internet import defer class NickNym(object): @@ -27,24 +28,27 @@ class NickNym(object): provider.api_version, uuid, config.gpg_binary) + @defer.inlineCallbacks def generate_openpgp_key(self): - if not self._key_exists(self._email): + key_present = yield self._key_exists(self._email) + if not key_present: print "Generating keys - this could take a while..." - self._gen_key() - self._send_key_to_leap() + yield self._gen_key() + yield self._send_key_to_leap() + @defer.inlineCallbacks def _key_exists(self, email): try: - self.keymanager.get_key(email, openpgp.OpenPGPKey, private=True, fetch_remote=False) - return True + yield self.keymanager.get_key(email, openpgp.OpenPGPKey, private=True) + defer.returnValue(True) except KeyNotFound: - return False + defer.returnValue(False) def _gen_key(self): - self.keymanager.gen_key(openpgp.OpenPGPKey) + return self.keymanager.gen_key(openpgp.OpenPGPKey) def _send_key_to_leap(self): - self.keymanager.send_key(openpgp.OpenPGPKey) + return self.keymanager.send_key(openpgp.OpenPGPKey) def _discover_nicknym_server(provider): diff --git a/service/pixelated/bitmask_libraries/session.py b/service/pixelated/bitmask_libraries/session.py index bebc741d..925af0c0 100644 --- a/service/pixelated/bitmask_libraries/session.py +++ b/service/pixelated/bitmask_libraries/session.py @@ -60,8 +60,7 @@ class LeapSession(object): self.nicknym = nicknym self.account = soledad_account self.incoming_mail_fetcher = incoming_mail_fetcher - self.soledad_session.soledad.sync(defer_decryption=False) - # self.nicknym.generate_openpgp_key() + self.nicknym.generate_openpgp_key() if self.config.start_background_jobs: self.start_background_jobs() |