diff options
author | drebs <drebs@leap.se> | 2017-02-25 08:53:38 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2017-02-25 08:53:38 -0300 |
commit | b433c1ed736f5d4c19da4cdb21108a02459ca7fd (patch) | |
tree | 57058c396516dd1c63ad5dd40f7c8fc713c5e496 /client/src/leap/soledad/client/_secrets/crypto.py | |
parent | a2e29d8bebbe7809dc10195982a205ed3709459c (diff) |
[refactor] pass soledad object to client secrets api
In order to be able to change passphrase, token and offline status of
soledad from the bitmask client api, the secrets api also has to be able
to use up-to-date values when encrypting/decrypting secrets and
uploading/downloading them to the server. This commit makes public some
soledad attributes that were previously "private" (i.e. used to start
with "_" and were not meant to be accessed from outside), and passes the
whole soledad object to the client secrets api. This makes the code
cleaner and also allows for always getting newest values of soledad
attributes.
Diffstat (limited to 'client/src/leap/soledad/client/_secrets/crypto.py')
-rw-r--r-- | client/src/leap/soledad/client/_secrets/crypto.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/leap/soledad/client/_secrets/crypto.py b/client/src/leap/soledad/client/_secrets/crypto.py index 02d7dc02..fa7aaca0 100644 --- a/client/src/leap/soledad/client/_secrets/crypto.py +++ b/client/src/leap/soledad/client/_secrets/crypto.py @@ -34,11 +34,12 @@ class SecretsCrypto(object): VERSION = 2 - def __init__(self, get_pass): - self._get_pass = get_pass + def __init__(self, soledad): + self._soledad = soledad def _get_key(self, salt): - key = scrypt.hash(self._get_pass(), salt, buflen=32) + passphrase = self._soledad.passphrase.encode('utf8') + key = scrypt.hash(passphrase, salt, buflen=32) return key # |