1
0

wizard: display seed type. restore 2fa if needed

This commit is contained in:
ThomasV
2016-09-28 06:30:00 +02:00
parent 1fe1fc3c08
commit c32f75a313
7 changed files with 88 additions and 33 deletions

View File

@@ -173,16 +173,25 @@ def is_old_seed(seed):
uses_electrum_words = True
except Exception:
uses_electrum_words = False
try:
seed.decode('hex')
is_hex = (len(seed) == 32 or len(seed) == 64)
except Exception:
is_hex = False
return is_hex or (uses_electrum_words and (len(words) == 12 or len(words) == 24))
def seed_type(x):
if is_old_seed(x):
return 'old'
elif is_new_seed(x):
return 'standard'
elif is_new_seed(x, version.SEED_PREFIX_2FA):
return '2fa'
return ''
is_seed = lambda x: bool(seed_type(x))
# pywallet openssl private key implementation
def i2o_ECPublicKey(pubkey, compressed=False):