summaryrefslogtreecommitdiff
path: root/soledad
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-14 14:56:02 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-14 14:56:02 -0300
commit5513cbb2432255087cfff47f1a287cdd351b892e (patch)
tree361a7b6b50acc90d95ffa8c9a35f715fc62cca05 /soledad
parent03b25515137012043121399f3b8e155b80403621 (diff)
parent6db7c3b0bdb4d3f9a82b134865063eeeffa63c17 (diff)
Merge remote-tracking branch 'drebs/feature/3118_provide-a-way-to-access-saved-password' into develop
Diffstat (limited to 'soledad')
-rw-r--r--soledad/changes/feature_3118-provide-a-way-to-access-the-saved-password1
-rw-r--r--soledad/src/leap/soledad/__init__.py11
-rw-r--r--soledad/src/leap/soledad/tests/test_soledad.py7
3 files changed, 18 insertions, 1 deletions
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):
"""