summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/src/leap/soledad/client/_secrets/__init__.py4
-rw-r--r--client/src/leap/soledad/client/_secrets/storage.py9
-rw-r--r--client/src/leap/soledad/client/api.py3
3 files changed, 10 insertions, 6 deletions
diff --git a/client/src/leap/soledad/client/_secrets/__init__.py b/client/src/leap/soledad/client/_secrets/__init__.py
index 26294364..69c9141f 100644
--- a/client/src/leap/soledad/client/_secrets/__init__.py
+++ b/client/src/leap/soledad/client/_secrets/__init__.py
@@ -43,7 +43,7 @@ class Secrets(EmitMixin):
'local_secret': 448, # local_secret to derive a local_key for storage
}
- def __init__(self, uuid, passphrase, url, local_path, creds, userid,
+ def __init__(self, uuid, passphrase, url, local_path, get_token, userid,
shared_db=None):
self._uuid = uuid
self._passphrase = passphrase
@@ -51,7 +51,7 @@ class Secrets(EmitMixin):
self._secrets = {}
self.crypto = SecretsCrypto(self.get_passphrase)
self.storage = SecretsStorage(
- uuid, self.get_passphrase, url, local_path, creds, userid,
+ uuid, self.get_passphrase, url, local_path, get_token, userid,
shared_db=shared_db)
self._bootstrap()
diff --git a/client/src/leap/soledad/client/_secrets/storage.py b/client/src/leap/soledad/client/_secrets/storage.py
index 730926ee..5fde8988 100644
--- a/client/src/leap/soledad/client/_secrets/storage.py
+++ b/client/src/leap/soledad/client/_secrets/storage.py
@@ -33,16 +33,21 @@ logger = getLogger(__name__)
class SecretsStorage(EmitMixin):
- def __init__(self, uuid, get_pass, url, local_path, creds, userid,
+ def __init__(self, uuid, get_pass, url, local_path, get_token, userid,
shared_db=None):
self._uuid = uuid
self._get_pass = get_pass
self._local_path = local_path
+ self._get_token = get_token
self._userid = userid
- self._shared_db = shared_db or self._init_shared_db(url, creds)
+ self._shared_db = shared_db or self._init_shared_db(url, self._creds)
self.__remote_doc = None
+ @property
+ def _creds(self):
+ return {'token': {'uuid': self._uuid, 'token': self._get_token()}}
+
#
# local storage
#
diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py
index 6a508d05..e84ba848 100644
--- a/client/src/leap/soledad/client/api.py
+++ b/client/src/leap/soledad/client/api.py
@@ -249,10 +249,9 @@ class Soledad(object):
"""
Initialize Soledad secrets.
"""
- creds = {'token': {'uuid': self.uuid, 'token': self.token}}
self._secrets = Secrets(
self._uuid, self._passphrase, self._server_url, self._secrets_path,
- creds, self.userid, shared_db=shared_db)
+ self.get_token, self.userid, shared_db=shared_db)
def _init_u1db_sqlcipher_backend(self):
"""