summaryrefslogtreecommitdiff
path: root/service/app
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2014-08-08 18:01:48 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2014-08-08 18:03:58 +0200
commit77b12bda3df10710daf7c441512146170523f003 (patch)
treee8332c492d79e8b7482e5a5b560f14213cc8933a /service/app
parentd3a31756c17165d4685287868f53265e49762377 (diff)
Updated some leap components to latest version.
- Send public key to leap now works - Fetching mail works with a recent leap provider version - Added register to LeapAuthenticator to create a new account
Diffstat (limited to 'service/app')
-rw-r--r--service/app/bitmask_libraries/auth.py5
-rw-r--r--service/app/bitmask_libraries/nicknym.py5
-rw-r--r--service/app/bitmask_libraries/session.py7
3 files changed, 11 insertions, 6 deletions
diff --git a/service/app/bitmask_libraries/auth.py b/service/app/bitmask_libraries/auth.py
index 4958c586..0b963587 100644
--- a/service/app/bitmask_libraries/auth.py
+++ b/service/app/bitmask_libraries/auth.py
@@ -20,3 +20,8 @@ class LeapAuthenticator(object):
srp = LeapSecureRemotePassword(ca_bundle=which_bundle(self._provider), timeout_in_s=config.timeout_in_s)
srp_session = srp.authenticate(self._provider.api_uri, credentials.user_name, credentials.password)
return srp_session
+
+ def register(self, credentials):
+ config = self._provider.config
+ srp = LeapSecureRemotePassword(ca_bundle=which_bundle(self._provider), timeout_in_s=config.timeout_in_s)
+ srp.register(self._provider.api_uri, credentials.user_name, credentials.password)
diff --git a/service/app/bitmask_libraries/nicknym.py b/service/app/bitmask_libraries/nicknym.py
index 8f5f06d1..c4939e9a 100644
--- a/service/app/bitmask_libraries/nicknym.py
+++ b/service/app/bitmask_libraries/nicknym.py
@@ -8,7 +8,7 @@ class NickNym(object):
self._email = '%s@%s' % (srp_session.user_name, provider.domain)
self.keymanager = KeyManager('%s@%s' % (srp_session.user_name, provider.domain), nicknym_url,
soledad_session.soledad,
- srp_session.session_id, which_bundle(provider), provider.api_uri,
+ srp_session.token, which_bundle(provider), provider.api_uri,
provider.api_version,
srp_session.uuid, config.gpg_binary)
@@ -28,9 +28,6 @@ class NickNym(object):
self.keymanager.gen_key(openpgp.OpenPGPKey)
def _send_key_to_leap(self):
- if True:
- raise NotImplementedError(
- 'No key sent to leap provider. Reason: leap.keymanager.KeyManager.send_key in latest python module is not compatible with latest LEAP provider')
self.keymanager.send_key(openpgp.OpenPGPKey)
diff --git a/service/app/bitmask_libraries/session.py b/service/app/bitmask_libraries/session.py
index 66e4fcab..d4b507dc 100644
--- a/service/app/bitmask_libraries/session.py
+++ b/service/app/bitmask_libraries/session.py
@@ -2,8 +2,10 @@ import os
import errno
import traceback
from leap.mail.imap.fetch import LeapIncomingMail
-from leap.mail.imap.server import SoledadBackedAccount
+from leap.mail.imap.account import SoledadBackedAccount
import sys
+from leap.mail.imap.memorystore import MemoryStore
+from leap.mail.imap.soledadstore import SoledadStore
from twisted.internet import reactor
from .nicknym import NickNym
@@ -138,7 +140,8 @@ class LeapSessionFactory(object):
return NickNym(self._provider, self._config, soledad_session, srp_session)
def _create_account(self, srp_session, soledad_session):
- return SoledadBackedAccount(srp_session.uuid, soledad_session.soledad)
+ memstore = MemoryStore(permanent_store=SoledadStore(soledad_session.soledad))
+ return SoledadBackedAccount(srp_session.uuid, soledad_session.soledad, memstore)
def _create_incoming_mail_fetcher(self, nicknym, soledad_session, account, auth):
return LeapIncomingMail(nicknym.keymanager, soledad_session.soledad, account,