We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 648c032 commit 10052efCopy full SHA for 10052ef
src/pw_encryption.py
@@ -5,13 +5,13 @@ class SynchronousEncryption:
5
def __init__(self, encryption_key):
6
self.cipher = Fernet(encryption_key)
7
8
- def encrypt(self, text: str):
+ def encrypt(self, text: str) -> str:
9
encrypted_text = self.cipher.encrypt(text.encode('utf-8'))
10
- return encrypted_text
+ return encrypted_text.decode('utf-8')
11
12
- def decrypt(self, encrypted_text: bytes):
+ def decrypt(self, encrypted_text: str) -> str:
13
"""Decrypt an encrypted text."""
14
- decrypted_text = self.cipher.decrypt(encrypted_text)
+ decrypted_text = self.cipher.decrypt(encrypted_text.encode('utf-8'))
15
return decrypted_text.decode()
16
17
@staticmethod
0 commit comments