1
0

wizard: fix regression: allow passphrase for some '2fa' seeds

fixes https://github.com/spesmilo/electrum/issues/9088
This commit is contained in:
SomberNight
2024-06-10 19:35:56 +00:00
parent 4f7dcc98bd
commit b95fbbb86f
3 changed files with 39 additions and 4 deletions

View File

@@ -276,6 +276,23 @@ def seed_type(x: str) -> str:
return ''
def can_seed_have_passphrase(seed: str) -> bool:
stype = seed_type(seed)
if not stype:
raise Exception(f'unexpected seed type: {stype!r}')
if stype == 'old':
return False
if stype == '2fa':
# post-version-2.7 2fa seeds can have passphrase, but older ones cannot
num_words = len(seed.split())
if num_words == 12:
return True
else:
return False
# all other types can have a seed extension/passphrase
return True
def is_seed(x: str) -> bool:
return bool(seed_type(x))