def verify_key(key: str) -> Optional['ApiKey']: key_info = ApiKey.from_db(db.get_key(key)) if key_info and key_info.expire_time > datetime.utcnow(): db.update_key_last_used(key) return key_info return None
def verify_key(key): key_info = ApiKey.from_db(db.get_key(key)) if key_info and key_info.expire_time > datetime.utcnow(): db.update_key_last_used(key) return key_info