1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-25 04:25:42 +00:00

seed: cleanup

This commit is contained in:
Jan Pochyla 2018-06-21 14:00:02 +02:00
parent 51df249949
commit 270d85f249
2 changed files with 4 additions and 10 deletions
src/apps
common
ethereum

View File

@ -1,3 +1,4 @@
from micropython import const
from trezor import wire
from trezor.crypto import bip32, bip39
from apps.common import cache, storage
@ -6,11 +7,10 @@ from apps.common.request_passphrase import protect_by_passphrase
_DEFAULT_CURVE = 'secp256k1'
async def derive_node(ctx: wire.Context, path: list, curve_name=_DEFAULT_CURVE):
async def derive_node(ctx: wire.Context, path: list, curve_name: str = _DEFAULT_CURVE) -> bip32.HDNode:
seed = await _get_cached_seed(ctx)
node = bip32.from_seed(seed, curve_name)
if path:
node.derive_path(path)
node.derive_path(path)
return node
@ -31,7 +31,7 @@ async def _get_cached_passphrase(ctx: wire.Context) -> str:
return cache.get_passphrase()
def derive_node_without_passphrase(path, curve_name=_DEFAULT_CURVE):
def derive_node_without_passphrase(path: list, curve_name: str = _DEFAULT_CURVE) -> bip32.HDNode:
if not storage.is_initialized():
raise Exception('Device is not initialized')

View File

@ -122,12 +122,6 @@ async def send_signature(ctx, msg: EthereumSignTx, digest):
return req
def node_derive(root, address_n: list):
node = root.clone()
node.derive_path(address_n)
return node
def check(msg: EthereumSignTx):
if msg.tx_type not in [1, 6, None]:
raise wire.DataError('tx_type out of bounds')