def check_cb(rows, *args, **kw): logging.debug("IndxUser, get_keys, connected_cb, check_cb") if len(rows) < 1: return_d.callback(None) return try: return_d.callback({"public": load_key(rows[0][0]), "private": load_key(rows[0][1])}) except Exception as e: logging.error("IndxUser, get_keys, Exception loading keys from database: {0}".format(e)) return_d.errback(Failure(e))
def queried_cb(rows): if len(rows) != 1: return_d.callback(None) # no key, return nothing return public_hash, public_key, private_key, username, boxid = rows[0] if private_key is None or private_key == '': key = {"public-hash": public_hash, "public": load_key(public_key), "private": ""} else: key = {"public-hash": public_hash, "public": load_key(public_key), "private": load_key(private_key)} return_d.callback({"username": username, "box": boxid, "key": key})
def queried_cb(rows): if len(rows) != 1: return_d.callback(None) # no key, return nothing return public_hash, public_key, private_key, username, boxid = rows[0] if private_key is None or private_key == '': key = { "public-hash": public_hash, "public": load_key(public_key), "private": "" } else: key = { "public-hash": public_hash, "public": load_key(public_key), "private": load_key(private_key) } return_d.callback({"username": username, "box": boxid, "key": key})