summaryrefslogtreecommitdiff
path: root/keymanager
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-09-06 15:32:48 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-09-06 15:32:48 -0300
commit1666a3d7a9d9162344e95b8ee574f7357eb2acc5 (patch)
tree055d9fb354c083d91fd07df7fcd3e55353bbc5e3 /keymanager
parentdfcf271220ef0742041c3e08f141910f7e7e0a24 (diff)
parent04323f8e7e49d44c653914afd514bdc3455d23d2 (diff)
Merge branch 'release-0.3.2'
Diffstat (limited to 'keymanager')
-rw-r--r--keymanager/CHANGELOG6
-rw-r--r--keymanager/README.rst4
-rw-r--r--keymanager/src/leap/keymanager/__init__.py15
-rw-r--r--keymanager/src/leap/keymanager/keys.py2
-rw-r--r--keymanager/src/leap/keymanager/openpgp.py4
5 files changed, 23 insertions, 8 deletions
diff --git a/keymanager/CHANGELOG b/keymanager/CHANGELOG
index d2e45aa..9cd53b3 100644
--- a/keymanager/CHANGELOG
+++ b/keymanager/CHANGELOG
@@ -1,3 +1,9 @@
+0.3.2 Sep 6:
+ o Do not raise exception when a GET request doesn't return 2XX
+ code. Nickserver uses error codes for more verbosity in the
+ result.
+ o Accept unicode ascii keys along with str.
+
0.3.1 Aug 23:
o Signal different key related events, like key generation, key
upload.
diff --git a/keymanager/README.rst b/keymanager/README.rst
index f542214..8aedfb4 100644
--- a/keymanager/README.rst
+++ b/keymanager/README.rst
@@ -1,6 +1,8 @@
LEAP's Key Manager
==================
+.. image:: https://pypip.in/v/leap.keymanager/badge.png
+ :target: https://crate.io/packages/leap.keymanager
-The Key Manager is a Nicknym agent for LEAP client:
+The Key Manager is a Nicknym agent for the LEAP project:
https://leap.se/pt/docs/design/nicknym
diff --git a/keymanager/src/leap/keymanager/__init__.py b/keymanager/src/leap/keymanager/__init__.py
index 05cbcca..2f39ad9 100644
--- a/keymanager/src/leap/keymanager/__init__.py
+++ b/keymanager/src/leap/keymanager/__init__.py
@@ -127,11 +127,16 @@ class KeyManager(object):
self._ca_cert_path is not None,
'We need the CA certificate path!')
res = self._fetcher.get(uri, data=data, verify=self._ca_cert_path)
- # assert that the response is valid
- res.raise_for_status()
- leap_assert(
- res.headers['content-type'].startswith('application/json'),
- 'Content-type is not JSON.')
+ # Nickserver now returns 404 for key not found and 500 for
+ # other cases (like key too small), so we are skipping this
+ # check for the time being
+ # res.raise_for_status()
+
+ # Responses are now text/plain, although it's json anyway, but
+ # this will fail when it shouldn't
+ # leap_assert(
+ # res.headers['content-type'].startswith('application/json'),
+ # 'Content-type is not JSON.')
return res
def _put(self, uri, data=None):
diff --git a/keymanager/src/leap/keymanager/keys.py b/keymanager/src/leap/keymanager/keys.py
index 1c33745..b8e88d4 100644
--- a/keymanager/src/leap/keymanager/keys.py
+++ b/keymanager/src/leap/keymanager/keys.py
@@ -219,6 +219,8 @@ class EncryptionScheme(object):
"""
Initialize the database indexes.
"""
+ leap_assert(self._soledad is not None,
+ "Cannot init indexes with null soledad")
# Ask the database for currently existing indexes.
db_indexes = dict(self._soledad.list_indexes())
# Loop through the indexes we expect to find.
diff --git a/keymanager/src/leap/keymanager/openpgp.py b/keymanager/src/leap/keymanager/openpgp.py
index aa04ed0..7946db8 100644
--- a/keymanager/src/leap/keymanager/openpgp.py
+++ b/keymanager/src/leap/keymanager/openpgp.py
@@ -301,9 +301,9 @@ class OpenPGPScheme(EncryptionScheme):
Put key contained in ascii-armored C{key_data} in local storage.
:param key_data: The key data to be stored.
- :type key_data: str
+ :type key_data: str or unicode
"""
- leap_assert_type(key_data, str)
+ leap_assert_type(key_data, (str, unicode))
# TODO: add more checks for correct key data.
leap_assert(key_data is not None, 'Data does not represent a key.')