Fix decryption migration logic

This commit is contained in:
thePR0M3TH3AN committed 2025-07-13 10:22:43 -04:00
1 parent c27eec26e2
commit 2f143b6710
4 files changed
+142 -396

No files matched your search

-1
View File
@@ -40,4 +40,3 @@ def test_legacy_index_migrates(tmp_path: Path):
assert new_file.exists()
assert not legacy_file.exists()
assert not (tmp_path / "seedpass_passwords_db_checksum.txt").exists()
assert (tmp_path / ("seedpass_entries_db.json.enc.fernet")).exists()
+2 -2
View File
@@ -51,7 +51,7 @@ def test_round_trip(monkeypatch):
assert vault.load_index()["pw"] == data["pw"]
from cryptography.exceptions import InvalidTag
from cryptography.fernet import InvalidToken
def test_corruption_detection(monkeypatch):
@@ -68,7 +68,7 @@ def test_corruption_detection(monkeypatch):
content["payload"] = base64.b64encode(payload).decode()
path.write_text(json.dumps(content))
with pytest.raises(InvalidTag):
with pytest.raises(InvalidToken):
import_backup(vault, backup, path, parent_seed=SEED)
+1 -3
View File
@@ -23,9 +23,7 @@ def test_parent_seed_migrates_from_fernet(tmp_path: Path) -> None:
assert decrypted == TEST_SEED
new_file = tmp_path / "parent_seed.enc"
legacy_backup = tmp_path / "parent_seed.enc.fernet"
assert new_file.exists()
assert legacy_backup.exists()
assert new_file.read_bytes() != encrypted
assert legacy_backup.read_bytes() == encrypted
assert new_file.read_bytes().startswith(b"V2:")