mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
migrate seed entry field
This commit is contained in:
@@ -75,6 +75,9 @@ class EntryManager:
|
|||||||
if "archived" not in entry and "blacklisted" in entry:
|
if "archived" not in entry and "blacklisted" in entry:
|
||||||
entry["archived"] = entry["blacklisted"]
|
entry["archived"] = entry["blacklisted"]
|
||||||
entry.pop("blacklisted", None)
|
entry.pop("blacklisted", None)
|
||||||
|
if "word_count" not in entry and "words" in entry:
|
||||||
|
entry["word_count"] = entry["words"]
|
||||||
|
entry.pop("words", None)
|
||||||
logger.debug("Index loaded successfully.")
|
logger.debug("Index loaded successfully.")
|
||||||
return data
|
return data
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -407,7 +410,7 @@ class EntryManager:
|
|||||||
"kind": EntryType.SEED.value,
|
"kind": EntryType.SEED.value,
|
||||||
"index": index,
|
"index": index,
|
||||||
"label": label,
|
"label": label,
|
||||||
"words": words_num,
|
"word_count": words_num,
|
||||||
"notes": notes,
|
"notes": notes,
|
||||||
"archived": archived,
|
"archived": archived,
|
||||||
}
|
}
|
||||||
@@ -434,7 +437,7 @@ class EntryManager:
|
|||||||
seed_bytes = Bip39SeedGenerator(parent_seed).Generate()
|
seed_bytes = Bip39SeedGenerator(parent_seed).Generate()
|
||||||
bip85 = BIP85(seed_bytes)
|
bip85 = BIP85(seed_bytes)
|
||||||
|
|
||||||
words = int(entry.get("words", 24))
|
words = int(entry.get("word_count", entry.get("words", 24)))
|
||||||
seed_index = int(entry.get("index", index))
|
seed_index = int(entry.get("index", index))
|
||||||
return derive_seed_phrase(bip85, seed_index, words)
|
return derive_seed_phrase(bip85, seed_index, words)
|
||||||
|
|
||||||
|
@@ -1458,7 +1458,7 @@ class PasswordManager:
|
|||||||
from local_bip85.bip85 import BIP85
|
from local_bip85.bip85 import BIP85
|
||||||
from bip_utils import Bip39SeedGenerator
|
from bip_utils import Bip39SeedGenerator
|
||||||
|
|
||||||
words = int(entry.get("words", 24))
|
words = int(entry.get("word_count", entry.get("words", 24)))
|
||||||
bytes_len = {12: 16, 18: 24, 24: 32}.get(words, 32)
|
bytes_len = {12: 16, 18: 24, 24: 32}.get(words, 32)
|
||||||
seed_bytes = Bip39SeedGenerator(self.parent_seed).Generate()
|
seed_bytes = Bip39SeedGenerator(self.parent_seed).Generate()
|
||||||
bip85 = BIP85(seed_bytes)
|
bip85 = BIP85(seed_bytes)
|
||||||
|
@@ -45,5 +45,5 @@ def test_seed_phrase_determinism():
|
|||||||
assert len(phrase24_a.split()) == 24
|
assert len(phrase24_a.split()) == 24
|
||||||
assert Mnemonic("english").check(phrase12_a)
|
assert Mnemonic("english").check(phrase12_a)
|
||||||
assert Mnemonic("english").check(phrase24_a)
|
assert Mnemonic("english").check(phrase24_a)
|
||||||
assert entry12.get("words") == 12
|
assert entry12.get("word_count") == 12
|
||||||
assert entry24.get("words") == 24
|
assert entry24.get("word_count") == 24
|
||||||
|
Reference in New Issue
Block a user