1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-16 08:06:05 +00:00

apps.common.seed: add get_root_without_passphrase

TODO: decomplect storage/seed/workflows after introducing storage classes (session/request/persistent)
This commit is contained in:
Jan Pochyla 2017-05-23 12:44:36 +02:00
parent e0fc5fb5a5
commit cb9a856484

View File

@ -31,3 +31,14 @@ async def compute_seed(session_id: int) -> bytes:
passphrase = await protect_by_passphrase(session_id)
return bip39.seed(storage.get_mnemonic(), passphrase)
def get_root_without_passphrase(curve_name=_DEFAULT_CURVE):
from . import storage
if not storage.is_initialized():
raise Exception('Device is not initialized')
if storage.is_locked():
raise Exception('Unlock first')
seed = bip39.seed(storage.get_mnemonic(), '')
root = bip32.from_seed(seed, curve_name)
return root