mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-04 15:18:46 +00:00
seed: cleanup
This commit is contained in:
parent
51df249949
commit
270d85f249
@ -1,3 +1,4 @@
|
|||||||
|
from micropython import const
|
||||||
from trezor import wire
|
from trezor import wire
|
||||||
from trezor.crypto import bip32, bip39
|
from trezor.crypto import bip32, bip39
|
||||||
from apps.common import cache, storage
|
from apps.common import cache, storage
|
||||||
@ -6,10 +7,9 @@ from apps.common.request_passphrase import protect_by_passphrase
|
|||||||
_DEFAULT_CURVE = 'secp256k1'
|
_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)
|
seed = await _get_cached_seed(ctx)
|
||||||
node = bip32.from_seed(seed, curve_name)
|
node = bip32.from_seed(seed, curve_name)
|
||||||
if path:
|
|
||||||
node.derive_path(path)
|
node.derive_path(path)
|
||||||
return node
|
return node
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ async def _get_cached_passphrase(ctx: wire.Context) -> str:
|
|||||||
return cache.get_passphrase()
|
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():
|
if not storage.is_initialized():
|
||||||
raise Exception('Device is not initialized')
|
raise Exception('Device is not initialized')
|
||||||
|
|
||||||
|
@ -122,12 +122,6 @@ async def send_signature(ctx, msg: EthereumSignTx, digest):
|
|||||||
return req
|
return req
|
||||||
|
|
||||||
|
|
||||||
def node_derive(root, address_n: list):
|
|
||||||
node = root.clone()
|
|
||||||
node.derive_path(address_n)
|
|
||||||
return node
|
|
||||||
|
|
||||||
|
|
||||||
def check(msg: EthereumSignTx):
|
def check(msg: EthereumSignTx):
|
||||||
if msg.tx_type not in [1, 6, None]:
|
if msg.tx_type not in [1, 6, None]:
|
||||||
raise wire.DataError('tx_type out of bounds')
|
raise wire.DataError('tx_type out of bounds')
|
||||||
|
Loading…
Reference in New Issue
Block a user