summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/keymanager/keys.py
diff options
context:
space:
mode:
authorZara Gebru <zgebru@thoughtworks.com>2016-07-08 11:55:55 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2016-11-22 15:57:03 +0100
commite5717e853af7d2f91ac69e66c1b2ee058289e78d (patch)
tree1fd7058206dd934a8ad0444c0f40a82e3d95dd09 /src/leap/bitmask/keymanager/keys.py
parentf02921a627e9ea0e6524e4b8e7744806e654a733 (diff)
[feature] keymanager: background update keys
Port of the original commit: 8f1fe8dd4a54fd2bdda2fc78c339ce9b3d0fc331 by Zara Gebru that introduced updating keys in the background. This was made in the legacy leapcode/keymanager repo, but was lost in the merge to the unified bitmask-dev. Original commit message follows: -------------------------------- - refresh random key in random time - add get key by fingerprint - refactor nicknym methods to own file - tests - note this do not include a check for revoked key, since that need some changes in gnupg - Related: #6089
Diffstat (limited to 'src/leap/bitmask/keymanager/keys.py')
-rw-r--r--src/leap/bitmask/keymanager/keys.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/leap/bitmask/keymanager/keys.py b/src/leap/bitmask/keymanager/keys.py
index 45a7d720..1b236c3d 100644
--- a/src/leap/bitmask/keymanager/keys.py
+++ b/src/leap/bitmask/keymanager/keys.py
@@ -272,6 +272,28 @@ class OpenPGPKey(object):
self.address,
"priv" if self.private else "publ")
+ def is_active(self):
+ """
+ Indicates if a key is active.
+ :return: True if key is active.
+ :rtype: bool
+ """
+ return True if self.address is not None else False
+
+ def set_unactive(self):
+ """
+ Sets a key as unactive.
+ """
+ self.address = None
+
+ def is_expired(self):
+ """
+ Indicates if a key is expired.
+ :return: True if key expired.
+ :rtype: bool
+ """
+ return False if self.expiry_date is None else self.expiry_date < datetime.now()
+
def parse_address(address):
"""