Skip to content

Commit 10052ef

Browse files
committed
Change encoding of strings / bytes
1 parent 648c032 commit 10052ef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pw_encryption.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ class SynchronousEncryption:
55
def __init__(self, encryption_key):
66
self.cipher = Fernet(encryption_key)
77

8-
def encrypt(self, text: str):
8+
def encrypt(self, text: str) -> str:
99
encrypted_text = self.cipher.encrypt(text.encode('utf-8'))
10-
return encrypted_text
10+
return encrypted_text.decode('utf-8')
1111

12-
def decrypt(self, encrypted_text: bytes):
12+
def decrypt(self, encrypted_text: str) -> str:
1313
"""Decrypt an encrypted text."""
14-
decrypted_text = self.cipher.decrypt(encrypted_text)
14+
decrypted_text = self.cipher.decrypt(encrypted_text.encode('utf-8'))
1515
return decrypted_text.decode()
1616

1717
@staticmethod

0 commit comments

Comments
 (0)