tests: use AES-GCM key generation

This commit is contained in:
thePR0M3TH3AN committed 2025-07-12 20:32:04 -04:00
1 parent f4a169ca80
commit f7c2017f1c
9 files changed
+31 -20

No files matched your search

+4 -3
View File
@@ -3,7 +3,8 @@ import sys
from pathlib import Path
from tempfile import TemporaryDirectory
from cryptography.fernet import Fernet
import os
import base64
sys.path.append(str(Path(__file__).resolve().parents[1]))
@@ -12,7 +13,7 @@ from password_manager.encryption import EncryptionManager
def test_json_save_and_load_round_trip():
with TemporaryDirectory() as tmpdir:
key = Fernet.generate_key()
key = base64.urlsafe_b64encode(os.urandom(32))
manager = EncryptionManager(key, Path(tmpdir))
data = {"hello": "world", "nums": [1, 2, 3]}
@@ -27,7 +28,7 @@ def test_json_save_and_load_round_trip():
def test_encrypt_and_decrypt_file_binary_round_trip():
with TemporaryDirectory() as tmpdir:
key = Fernet.generate_key()
key = base64.urlsafe_b64encode(os.urandom(32))
manager = EncryptionManager(key, Path(tmpdir))
payload = b"binary secret"