summaryrefslogtreecommitdiff
path: root/keymanager/src/leap
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-04-18 23:48:17 -0700
committerKali Kaneko (leap communications) <kali@leap.se>2016-04-19 12:16:23 -0400
commitaeb1e6057804a815b216a44979150e3f28ef2a5e (patch)
tree4a58aa5e866195affbb960932a9e50dc8e18e4b3 /keymanager/src/leap
parent349551e78985a5bd678de107e31a0e31c4bc930e (diff)
[bug] encryption keys can now be serialized to json using key.get_dict()
Diffstat (limited to 'keymanager/src/leap')
-rw-r--r--keymanager/src/leap/keymanager/keys.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/keymanager/src/leap/keymanager/keys.py b/keymanager/src/leap/keymanager/keys.py
index 38d66b5f..34d921c5 100644
--- a/keymanager/src/leap/keymanager/keys.py
+++ b/keymanager/src/leap/keymanager/keys.py
@@ -258,6 +258,20 @@ class EncryptionKey(object):
KEY_TAGS_KEY: [KEYMANAGER_ACTIVE_TAG],
})
+ def get_dict(self):
+ """
+ :return: a serializable dict representation of this key.
+ :rtype: dict
+ """
+ return {
+ KEY_ADDRESS_KEY: self.address,
+ KEY_UIDS_KEY: self.uids,
+ KEY_FINGERPRINT_KEY: self.fingerprint,
+ KEY_LENGTH_KEY: self.length,
+ KEY_EXPIRY_DATE_KEY: str(self.expiry_date),
+ KEY_DATA_KEY: self.key_data
+ }
+
def __repr__(self):
"""
Representation of this class