summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/keymanager/keys.py
diff options
context:
space:
mode:
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):
"""