summaryrefslogtreecommitdiff
path: root/keymanager
diff options
context:
space:
mode:
Diffstat (limited to 'keymanager')
-rw-r--r--keymanager/CHANGELOG.rst29
-rw-r--r--keymanager/HISTORY.rst (renamed from keymanager/CHANGELOG)0
-rw-r--r--keymanager/MANIFEST.in2
-rw-r--r--keymanager/changes/async_gpg1
-rw-r--r--keymanager/changes/next-changelog.txt12
-rw-r--r--keymanager/setup.py27
-rw-r--r--keymanager/src/leap/keymanager/keys.py27
7 files changed, 74 insertions, 24 deletions
diff --git a/keymanager/CHANGELOG.rst b/keymanager/CHANGELOG.rst
new file mode 100644
index 0000000..3716025
--- /dev/null
+++ b/keymanager/CHANGELOG.rst
@@ -0,0 +1,29 @@
+0.5.1 - 04 Apr, 2016
+++++++++++++++++++++
+
+Features
+~~~~~~~~
+- Create an iterator on EncryptionKey to be able to represent it as a dict
+
+
+0.5.0 - 18 Apr, 2016
+++++++++++++++++++++
+
+Features
+~~~~~~~~
+- `#7485 <https://leap.se/code/issues/7485>`_: Move validation, usage and audited date to the active document.
+- `#7713 <https://leap.se/code/issues/7713>`_: Update soledad documents by adding versioning field.
+- `#7500 <https://leap.se/code/issues/7500>`_: Use fingerprints instead of key ids.
+- `#7712 <https://leap.se/code/issues/7712>`_: Document the soledad docs fields.
+- Make EncryptionKey aware of the active address.
+- Defer encrypt, decrypt and gen_key operations from gnupg to external threads,
+ limited by cpu core amount.
+
+Bugfixes
+~~~~~~~~
+- `#7974 <https://leap.se/code/issues/7974>`_: Return KeyNotFound Failure if not valid key is given to put_raw_key.
+
+Misc
+~~~~
+- This version includes changes in the Soledad Documents and minor modifications to the API.
+- Changelog migrated to rst.
diff --git a/keymanager/CHANGELOG b/keymanager/HISTORY.rst
index 0a9221d..0a9221d 100644
--- a/keymanager/CHANGELOG
+++ b/keymanager/HISTORY.rst
diff --git a/keymanager/MANIFEST.in b/keymanager/MANIFEST.in
index d1a0e9a..8a66511 100644
--- a/keymanager/MANIFEST.in
+++ b/keymanager/MANIFEST.in
@@ -1,5 +1,5 @@
include pkg/*
include versioneer.py
include LICENSE
-include CHANGELOG
+include CHANGELOG.rst
include src/leap/keymanager/_version.py
diff --git a/keymanager/changes/async_gpg b/keymanager/changes/async_gpg
deleted file mode 100644
index 59d4d41..0000000
--- a/keymanager/changes/async_gpg
+++ /dev/null
@@ -1 +0,0 @@
--- Defer encrypt, decrypt and gen_key operations from gnupg to external threads, limited by cpu core amount.
diff --git a/keymanager/changes/next-changelog.txt b/keymanager/changes/next-changelog.txt
index 2dd34d4..09b2e71 100644
--- a/keymanager/changes/next-changelog.txt
+++ b/keymanager/changes/next-changelog.txt
@@ -1,4 +1,4 @@
-0.5.0 - xxx
+0.5.2 - xxx
+++++++++++++++++++++++++++++++
Please add lines to this file, they will be moved to the CHANGELOG.rst during
@@ -10,26 +10,16 @@ I've added a new category `Misc` so we can track doc/style/packaging stuff.
Features
~~~~~~~~
-- `#7485 <https://leap.se/code/issues/7485>`_: Move validation, usage and audited date to the active document.
-- `#7713 <https://leap.se/code/issues/7713>`_: Update soledad documents by adding versioning field.
-- `#7500 <https://leap.se/code/issues/7500>`_: Use fingerprints instead of key ids.
-- `#7712 <https://leap.se/code/issues/7712>`_: Document the soledad docs fields.
-- Make EncryptionKey aware of the active address.
-
- `#1234 <https://leap.se/code/issues/1234>`_: Description of the new feature corresponding with issue #1234.
- New feature without related issue number.
Bugfixes
~~~~~~~~
-- `#7974 <https://leap.se/code/issues/7974>`_: Return KeyNotFound Failure if not valid key is given to put_raw_key.
-
- `#1235 <https://leap.se/code/issues/1235>`_: Description for the fixed stuff corresponding with issue #1235.
- Bugfix without related issue number.
Misc
~~~~
-- This version includes changes in the Soledad Documents and minor modifications to the API.
-
- `#1236 <https://leap.se/code/issues/1236>`_: Description of the new feature corresponding with issue #1236.
- Some change without issue number.
diff --git a/keymanager/setup.py b/keymanager/setup.py
index 4a05a1e..cde5f8b 100644
--- a/keymanager/setup.py
+++ b/keymanager/setup.py
@@ -53,7 +53,6 @@ if len(_version_short) > 0:
VERSION_SHORT = _version_short[0]
DOWNLOAD_URL = DOWNLOAD_BASE % VERSION_SHORT
-
class freeze_debianver(Command):
"""
@@ -68,14 +67,20 @@ class freeze_debianver(Command):
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
-version_version = '{version}'
-full_revisionid = '{full_revisionid}'
-"""
- templatefun = r"""
+import json
+import sys
+
+version_json = '''
+{
+ "dirty": false,
+ "error": null,
+ "full-revisionid": "FULL_REVISIONID",
+ "version": "VERSION_STRING"
+}
+''' # END VERSION_JSON
-def get_versions(default={}, verbose=False):
- return {'version': version_version,
- 'full-revisionid': full_revisionid}
+def get_versions():
+ return json.loads(version_json)
"""
def initialize_options(self):
@@ -90,9 +95,9 @@ def get_versions(default={}, verbose=False):
if proceed != "y":
print("He. You scared. Aborting.")
return
- subst_template = self.template.format(
- version=VERSION_SHORT,
- full_revisionid=VERSION_REVISION) + self.templatefun
+ subst_template = self.template.replace(
+ 'VERSION_STRING', VERSION_SHORT).replace(
+ 'FULL_REVISIONID', VERSION_REVISION)
versioneer_cfg = versioneer.get_config_from_root('.')
with open(versioneer_cfg.versionfile_source, 'w') as f:
f.write(subst_template)
diff --git a/keymanager/src/leap/keymanager/keys.py b/keymanager/src/leap/keymanager/keys.py
index 38d66b5..1955d54 100644
--- a/keymanager/src/leap/keymanager/keys.py
+++ b/keymanager/src/leap/keymanager/keys.py
@@ -192,6 +192,11 @@ class EncryptionKey(object):
__metaclass__ = ABCMeta
+ __slots__ = ('address', 'uids', 'fingerprint', 'key_data',
+ 'private', 'length', 'expiry_date', 'validation',
+ 'last_audited_at', 'refreshed_at',
+ 'encr_used', 'sign_used', '_index')
+
def __init__(self, address=None, uids=[], fingerprint="",
key_data="", private=False, length=0, expiry_date=None,
validation=ValidationLevels.Weak_Chain, last_audited_at=None,
@@ -212,6 +217,7 @@ class EncryptionKey(object):
self.refreshed_at = refreshed_at
self.encr_used = encr_used
self.sign_used = sign_used
+ self._index = len(self.__slots__)
def get_json(self):
"""
@@ -258,6 +264,27 @@ class EncryptionKey(object):
KEY_TAGS_KEY: [KEYMANAGER_ACTIVE_TAG],
})
+ def next(self):
+ if self._index == 0:
+ self._index = len(self.__slots__)
+ raise StopIteration
+
+ self._index -= 1
+ key = self.__slots__[self._index]
+
+ if key.startswith('_'):
+ return self.next()
+
+ value = getattr(self, key)
+ if key == "validation":
+ value = str(value)
+ elif key in ["expiry_date", "last_audited_at", "refreshed_at"]:
+ value = str(value)
+ return key, value
+
+ def __iter__(self):
+ return self
+
def __repr__(self):
"""
Representation of this class