mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
Merge pull request #258 from PR0M3TH3AN/codex/add-assertions-in-test_seed_entry.py
Validate BIP‑39 seed entries
This commit is contained in:
@@ -3,6 +3,7 @@ from pathlib import Path
|
|||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
from helpers import create_vault, TEST_SEED, TEST_PASSWORD
|
from helpers import create_vault, TEST_SEED, TEST_PASSWORD
|
||||||
|
from mnemonic import Mnemonic
|
||||||
|
|
||||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
@@ -30,6 +31,9 @@ def test_seed_phrase_determinism():
|
|||||||
phrase24_a = entry_mgr.get_seed_phrase(idx_24, TEST_SEED)
|
phrase24_a = entry_mgr.get_seed_phrase(idx_24, TEST_SEED)
|
||||||
phrase24_b = entry_mgr.get_seed_phrase(idx_24, TEST_SEED)
|
phrase24_b = entry_mgr.get_seed_phrase(idx_24, TEST_SEED)
|
||||||
|
|
||||||
|
entry12 = entry_mgr.retrieve_entry(idx_12)
|
||||||
|
entry24 = entry_mgr.retrieve_entry(idx_24)
|
||||||
|
|
||||||
seed_bytes = Bip39SeedGenerator(TEST_SEED).Generate()
|
seed_bytes = Bip39SeedGenerator(TEST_SEED).Generate()
|
||||||
bip85 = BIP85(seed_bytes)
|
bip85 = BIP85(seed_bytes)
|
||||||
expected12 = derive_seed_phrase(bip85, idx_12, 12)
|
expected12 = derive_seed_phrase(bip85, idx_12, 12)
|
||||||
@@ -39,3 +43,7 @@ def test_seed_phrase_determinism():
|
|||||||
assert phrase24_a == phrase24_b == expected24
|
assert phrase24_a == phrase24_b == expected24
|
||||||
assert len(phrase12_a.split()) == 12
|
assert len(phrase12_a.split()) == 12
|
||||||
assert len(phrase24_a.split()) == 24
|
assert len(phrase24_a.split()) == 24
|
||||||
|
assert Mnemonic("english").check(phrase12_a)
|
||||||
|
assert Mnemonic("english").check(phrase24_a)
|
||||||
|
assert entry12.get("words") == 12
|
||||||
|
assert entry24.get("words") == 24
|
||||||
|
Reference in New Issue
Block a user