mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 23:38:49 +00:00
Merge pull request #30 from PR0M3TH3AN/codex/create-test-for-seed-encryption-and-validation
Add test for seed encryption round trip
This commit is contained in:
24
tests/test_seed_import.py
Normal file
24
tests/test_seed_import.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from tempfile import TemporaryDirectory
|
||||||
|
from cryptography.fernet import Fernet
|
||||||
|
|
||||||
|
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
|
from password_manager.encryption import EncryptionManager
|
||||||
|
from password_manager.manager import PasswordManager
|
||||||
|
|
||||||
|
SEED = "guard rule huge draft embark case any drastic horse bargain orchard mobile"
|
||||||
|
|
||||||
|
|
||||||
|
def test_seed_encryption_round_trip():
|
||||||
|
with TemporaryDirectory() as tmpdir:
|
||||||
|
key = Fernet.generate_key()
|
||||||
|
enc_mgr = EncryptionManager(key, Path(tmpdir))
|
||||||
|
|
||||||
|
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)
|
Reference in New Issue
Block a user