Hello! We are running our annual fundraising. Please consider making a donation if you value this freely available service or want to support people around the world working towards liberatory social change. https://riseup.net/donate.

Commit 24225612 authored by drebs's avatar drebs
Browse files

[refactor] use get_token in client secrets api

parent 459c5efd
......@@ -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()
......
......@@ -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
#
......
......@@ -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):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment