From 6db7c3b0bdb4d3f9a82b134865063eeeffa63c17 Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 14 Aug 2013 08:52:27 -0300 Subject: Add getter for soledad password. --- .../feature_3118-provide-a-way-to-access-the-saved-password | 1 + soledad/src/leap/soledad/__init__.py | 11 ++++++++++- soledad/src/leap/soledad/tests/test_soledad.py | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 soledad/changes/feature_3118-provide-a-way-to-access-the-saved-password (limited to 'soledad') diff --git a/soledad/changes/feature_3118-provide-a-way-to-access-the-saved-password b/soledad/changes/feature_3118-provide-a-way-to-access-the-saved-password new file mode 100644 index 00000000..69cb0b1d --- /dev/null +++ b/soledad/changes/feature_3118-provide-a-way-to-access-the-saved-password @@ -0,0 +1 @@ + o Add public method to access the saved password. Closes #3118. diff --git a/soledad/src/leap/soledad/__init__.py b/soledad/src/leap/soledad/__init__.py index 00ac21f8..638ead8a 100644 --- a/soledad/src/leap/soledad/__init__.py +++ b/soledad/src/leap/soledad/__init__.py @@ -238,7 +238,7 @@ class Soledad(object): MINIMUM_PASSPHRASE_LENGTH = 6 """ The minimum length for a passphrase. The passphrase length is only checked - when the user changes her passphras, not when she instantiates Soledad. + when the user changes her passphrase, not when she instantiates Soledad. """ IV_SEPARATOR = ":" @@ -1120,6 +1120,14 @@ class Soledad(object): _get_storage_secret, doc='The secret used for symmetric encryption.') + def _get_passphrase(self): + return self._passphrase + + passphrase = property( + _get_passphrase, + doc='The passphrase for locking and unlocking encryption secrets for ' + 'local and remote storage.') + #----------------------------------------------------------------------------- # Monkey patching u1db to be able to provide a custom SSL cert @@ -1128,6 +1136,7 @@ class Soledad(object): # We need a more reasonable timeout (in seconds) SOLEDAD_TIMEOUT = 10 + class VerifiedHTTPSConnection(httplib.HTTPSConnection): """HTTPSConnection verifying server side certificates.""" # derived from httplib.py diff --git a/soledad/src/leap/soledad/tests/test_soledad.py b/soledad/src/leap/soledad/tests/test_soledad.py index 875ecc56..63ab5551 100644 --- a/soledad/src/leap/soledad/tests/test_soledad.py +++ b/soledad/src/leap/soledad/tests/test_soledad.py @@ -140,6 +140,13 @@ class AuxMethodsTestCase(BaseSoledadTest): soledad.PassphraseTooShort, sol.change_passphrase, '54321') + def test_get_passphrase(self): + """ + Assert passphrase getter works fine. + """ + sol = self._soledad_instance() + self.assertEqual('123', sol.passphrase) + class SoledadSharedDBTestCase(BaseSoledadTest): """ -- cgit v1.2.3