diff options
-rw-r--r-- | client/src/leap/soledad/client/_secrets/__init__.py | 4 | ||||
-rw-r--r-- | client/src/leap/soledad/client/_secrets/storage.py | 4 | ||||
-rw-r--r-- | client/src/leap/soledad/client/_secrets/util.py | 10 |
3 files changed, 13 insertions, 5 deletions
diff --git a/client/src/leap/soledad/client/_secrets/__init__.py b/client/src/leap/soledad/client/_secrets/__init__.py index 43541e16..79b6844a 100644 --- a/client/src/leap/soledad/client/_secrets/__init__.py +++ b/client/src/leap/soledad/client/_secrets/__init__.py @@ -24,7 +24,7 @@ from leap.soledad.common.log import getLogger from leap.soledad.client._secrets.storage import SecretsStorage from leap.soledad.client._secrets.crypto import SecretsCrypto -from leap.soledad.client._secrets.util import emit, EmitMixin +from leap.soledad.client._secrets.util import emit, UserDataMixin logger = getLogger(__name__) @@ -33,7 +33,7 @@ logger = getLogger(__name__) SecretLength = namedtuple('SecretLength', 'name length') -class Secrets(EmitMixin): +class Secrets(UserDataMixin): # remote secret is used diff --git a/client/src/leap/soledad/client/_secrets/storage.py b/client/src/leap/soledad/client/_secrets/storage.py index bb74dba3..89b44266 100644 --- a/client/src/leap/soledad/client/_secrets/storage.py +++ b/client/src/leap/soledad/client/_secrets/storage.py @@ -25,13 +25,13 @@ from leap.soledad.common.log import getLogger from leap.soledad.common.document import SoledadDocument from leap.soledad.client.shared_db import SoledadSharedDatabase -from leap.soledad.client._secrets.util import emit, EmitMixin +from leap.soledad.client._secrets.util import emit, UserDataMixin logger = getLogger(__name__) -class SecretsStorage(EmitMixin): +class SecretsStorage(UserDataMixin): def __init__(self, soledad): self._soledad = soledad diff --git a/client/src/leap/soledad/client/_secrets/util.py b/client/src/leap/soledad/client/_secrets/util.py index 75418518..6401889b 100644 --- a/client/src/leap/soledad/client/_secrets/util.py +++ b/client/src/leap/soledad/client/_secrets/util.py @@ -23,12 +23,20 @@ class SecretsError(Exception): pass -class EmitMixin(object): +class UserDataMixin(object): + """ + When emitting an event, we have to pass a dictionary containing user data. + This class only defines a property so we don't have to define it in + multiple places. + """ @property def _user_data(self): uuid = self._soledad.uuid userid = self._soledad.userid + # TODO: seems that uuid and userid hold the same value! We should check + # whether we should pass something different or if the events api + # really needs two different values. return {'uuid': uuid, 'userid': userid} |