# Path: cfg.py
# API_VERSION = 1
# SKIER_VERSION = 1.5
# 
# Path: skier/keyinfo.py
# def jsondes(obj):
# def wrap(i):
#     def __init__(self, uid: list = None, keyid: str = None, fingerprint: str = None,
#                  length: int = None, algo: PGPAlgo = None, created: int = None, expires: int = None,
#                  subkeys: list = None,
#                  sigs: dict = None,
#                  expired: bool = False, revoked: bool = False, armored: str = "", oid=None):
#     def expired(self):
#     def __repr__(self):
#     def to_pks(self):
#     def _setup_keybase(self, username):
#     def from_json(self, data: str):
#     def to_json(self):
#     def get_expired_ymd(self):
#     def get_created_ymd(self):
#     def get_algo_name(self):
#     def get_algo_id(self):
#     def get_user_fingerprint(self):
#     def translate(self, sig):
#     def get_length(self):
#     def __eq__(self, other):
#     def pgp_dump(cls, armored: str, packets: list = None):
#     def from_database_object(cls, keyob: db.Key):
# class PGPAlgo(Enum):
# class KeyInfo(object):
#     RSA = 1
#     RSA_E = 2
#     RSA_S = 3
#     ELGAMAL = 16
#     DSA = 17
#     ECC = 18
#     ECDSA = 19
#     DH = 21
# 
# Path: app.py
# def setup_logging():


import json
import multiprocessing
import redis
from cfg import cfg, redis_host
from skier import keyinfo
from app import gpg
            cache.set(keyid + "-armor", key)
            cache.expire(keyid + "-armor", 600)
            cache.set(keyid, gpg.export_keys(keyid, armor=False))
            cache.expire(keyid, 600)
            return key
        else:
            return None

def invalidate_cache_key_old(keyid: str) -> bool:
    """
    Invalidate a key on the cache (delete it) so it can be updated.
    :param keyid: The key to delete.
    :return: If the key was deleted or not.
    """
    if has_pgp_key_old(keyid):
        deleted = cache.delete(keyid)
        deleted_1 = cache.delete(keyid + "-armor")
        return deleted and deleted_1
    else:
        return False

def get_pgp_keyinfo_old(keyid: str) -> keyinfo.KeyInfo:
    """
    Gets a :skier.keyinfo.KeyInfo: object for the specified key.
    :param keyid: The ID of the key to lookup.
    :return: A new :skier.keyinfo.KeyInfo: object for the key.
    """

    # Lookup keyinfo from the cache.
    if cache.exists(keyid + "-keyinfo"):

# Path: cfg.py
# API_VERSION = 1
# SKIER_VERSION = 1.5
# 
# Path: skier/keyinfo.py
# def jsondes(obj):
# def wrap(i):
#     def __init__(self, uid: list = None, keyid: str = None, fingerprint: str = None,
#                  length: int = None, algo: PGPAlgo = None, created: int = None, expires: int = None,
#                  subkeys: list = None,
#                  sigs: dict = None,
#                  expired: bool = False, revoked: bool = False, armored: str = "", oid=None):
#     def expired(self):
#     def __repr__(self):
#     def to_pks(self):
#     def _setup_keybase(self, username):
#     def from_json(self, data: str):
#     def to_json(self):
#     def get_expired_ymd(self):
#     def get_created_ymd(self):
#     def get_algo_name(self):
#     def get_algo_id(self):
#     def get_user_fingerprint(self):
#     def translate(self, sig):
#     def get_length(self):
#     def __eq__(self, other):
#     def pgp_dump(cls, armored: str, packets: list = None):
#     def from_database_object(cls, keyob: db.Key):
# class PGPAlgo(Enum):
# class KeyInfo(object):
#     RSA = 1
#     RSA_E = 2
#     RSA_S = 3
#     ELGAMAL = 16
#     DSA = 17
#     ECC = 18
#     ECDSA = 19
#     DH = 21
# 
# Path: app.py
# def setup_logging():


# Path: skier/old/pgp.py
import json
import multiprocessing
import redis
from cfg import cfg, redis_host
from skier import keyinfo
from app import gpg

            cache.set(keyid + "-armor", key)
            cache.expire(keyid + "-armor", 600)
            cache.set(keyid, gpg.export_keys(keyid, armor=False))
            cache.expire(keyid, 600)
            return key
        else:
            return None

def invalidate_cache_key_old(keyid: str) -> bool:
    """
    Invalidate a key on the cache (delete it) so it can be updated.
    :param keyid: The key to delete.
    :return: If the key was deleted or not.
    """
    if has_pgp_key_old(keyid):
        deleted = cache.delete(keyid)
        deleted_1 = cache.delete(keyid + "-armor")
        return deleted and deleted_1
    else:
        return False

def get_pgp_keyinfo_old(keyid: str) -> keyinfo.KeyInfo:
    """
    Gets a :skier.keyinfo.KeyInfo: object for the specified key.
    :param keyid: The ID of the key to lookup.
    :return: A new :skier.keyinfo.KeyInfo: object for the key.
    """

    # Lookup keyinfo from the cache.
    if cache.exists(keyid + "-keyinfo"):

        return keyinfo.KeyInfo.from_key_listing(json.loads(cache.get(keyid + "-keyinfo").decode()))