Enforce 12-word managed account seeds

This commit is contained in:
thePR0M3TH3AN
2025-07-07 22:28:09 -04:00
parent 988a50e066
commit 34784eefe0
6 changed files with 15 additions and 14 deletions

View File

@@ -481,11 +481,13 @@ class EntryManager:
parent_seed: str,
*,
index: int | None = None,
word_count: int = 24,
notes: str = "",
archived: bool = False,
) -> int:
"""Add a new managed account seed entry."""
"""Add a new managed account seed entry.
Managed accounts always use a 12-word seed phrase.
"""
if index is None:
index = self.get_next_index()
@@ -497,6 +499,8 @@ class EntryManager:
seed_bytes = Bip39SeedGenerator(parent_seed).Generate()
bip85 = BIP85(seed_bytes)
word_count = 12
seed_phrase = derive_seed_phrase(bip85, index, word_count)
fingerprint = generate_fingerprint(seed_phrase)
@@ -540,7 +544,7 @@ class EntryManager:
seed_bytes = Bip39SeedGenerator(parent_seed).Generate()
bip85 = BIP85(seed_bytes)
words = int(entry.get("word_count", 24))
words = int(entry.get("word_count", 12))
seed_index = int(entry.get("index", index))
return derive_seed_phrase(bip85, seed_index, words)