mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 15:28:44 +00:00
25 lines
772 B
Python
25 lines
772 B
Python
import sys
|
|
from pathlib import Path
|
|
from tempfile import TemporaryDirectory
|
|
from cryptography.fernet import Fernet
|
|
from mnemonic import Mnemonic
|
|
|
|
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
|
|
|
from password_manager.encryption import EncryptionManager
|
|
from password_manager.manager import PasswordManager
|
|
|
|
|
|
def test_seed_encryption_round_trip():
|
|
with TemporaryDirectory() as tmpdir:
|
|
key = Fernet.generate_key()
|
|
enc_mgr = EncryptionManager(key, Path(tmpdir))
|
|
|
|
seed = Mnemonic("english").generate(strength=128)
|
|
enc_mgr.encrypt_parent_seed(seed)
|
|
decrypted = enc_mgr.decrypt_parent_seed()
|
|
|
|
assert decrypted == seed
|
|
pm = PasswordManager.__new__(PasswordManager)
|
|
assert pm.validate_bip85_seed(seed)
|