Finished client result API.
Need to work on adjustment user codes and server email notifications.
This commit is contained in:
		@@ -37,11 +37,22 @@ def encrypt(input):
 | 
			
		||||
def decrypt(input):
 | 
			
		||||
    if not check_keyfile_exists():
 | 
			
		||||
        raise EncryptionKeyMissing
 | 
			
		||||
    input = input.encode()
 | 
			
		||||
    _encryption_key = load_key()
 | 
			
		||||
    fernet = Fernet(_encryption_key)
 | 
			
		||||
    output = fernet.decrypt(input)
 | 
			
		||||
    return output.decode()
 | 
			
		||||
    if type(input) == str:
 | 
			
		||||
        input = input.encode()
 | 
			
		||||
        output = fernet.decrypt(input)
 | 
			
		||||
        return output.decode()
 | 
			
		||||
    if type(input) == dict:
 | 
			
		||||
        output = {}
 | 
			
		||||
        for key, value in input.items():
 | 
			
		||||
            if type(value) == dict:
 | 
			
		||||
                output[key] = decrypt(value)
 | 
			
		||||
            else:
 | 
			
		||||
                value = value.encode()
 | 
			
		||||
                output[key] = fernet.decrypt(value)
 | 
			
		||||
                output[key] = output[key].decode()
 | 
			
		||||
        return output
 | 
			
		||||
 | 
			
		||||
class EncryptionKeyMissing(Exception):
 | 
			
		||||
    def __init__(self, message='There is no encryption keyfile.'):
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ def decrypt_find(collection:collection, query:dict):
 | 
			
		||||
        if not query:
 | 
			
		||||
            output_list.append(decrypted_document)
 | 
			
		||||
        else:
 | 
			
		||||
            if set(query.items()).issubset(set(decrypted_document.items())):
 | 
			
		||||
            if query.items() <= decrypted_document.items():
 | 
			
		||||
                output_list.append(decrypted_document)
 | 
			
		||||
    return output_list
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user