diff --git a/core/src/apps/bitcoin/get_public_key.py b/core/src/apps/bitcoin/get_public_key.py index 07b3fcc16..e87b04a30 100644 --- a/core/src/apps/bitcoin/get_public_key.py +++ b/core/src/apps/bitcoin/get_public_key.py @@ -2,9 +2,8 @@ from trezor import wire from trezor.messages import InputScriptType from trezor.messages.HDNodeType import HDNodeType from trezor.messages.PublicKey import PublicKey -from trezor.ui.layouts import show_xpub -from apps.common import coins, paths +from apps.common import coininfo, paths from apps.common.keychain import get_keychain if False: @@ -14,7 +13,7 @@ if False: async def get_public_key(ctx: wire.Context, msg: GetPublicKey) -> PublicKey: coin_name = msg.coin_name or "Bitcoin" script_type = msg.script_type or InputScriptType.SPENDADDRESS - coin = coins.by_name(coin_name) + coin = coininfo.by_name(coin_name) curve_name = msg.ecdsa_curve_name or coin.curve_name keychain = await get_keychain(ctx, curve_name, [paths.AlwaysMatchingSchema]) @@ -59,6 +58,8 @@ async def get_public_key(ctx: wire.Context, msg: GetPublicKey) -> PublicKey: ) if msg.show_display: + from trezor.ui.layouts import show_xpub + await show_xpub(ctx, node_xpub, "XPUB", "Cancel") return PublicKey( diff --git a/core/src/apps/common/paths.py b/core/src/apps/common/paths.py index 197db19e1..a953561e9 100644 --- a/core/src/apps/common/paths.py +++ b/core/src/apps/common/paths.py @@ -1,8 +1,4 @@ -from trezor.ui.constants import MONO_CHARS_PER_LINE -from trezor.ui.layouts import confirm_path_warning - from . import HARDENED -from .layout import address_n_to_str if False: from typing import ( @@ -326,6 +322,9 @@ async def validate_path( async def show_path_warning(ctx: wire.Context, path: Bip32Path) -> None: + from trezor.ui.layouts import confirm_path_warning + from .layout import address_n_to_str + await confirm_path_warning(ctx, address_n_to_str(path)) @@ -338,6 +337,9 @@ def path_is_hardened(address_n: Bip32Path) -> bool: def break_address_n_to_lines(address_n: Bip32Path) -> list[str]: + from trezor.ui.constants import MONO_CHARS_PER_LINE + from .layout import address_n_to_str + lines = [] path_str = address_n_to_str(address_n) diff --git a/core/src/storage/sd_salt.py b/core/src/storage/sd_salt.py index b3539fcb3..350452153 100644 --- a/core/src/storage/sd_salt.py +++ b/core/src/storage/sd_salt.py @@ -2,7 +2,6 @@ from micropython import const import storage.device from trezor import fatfs -from trezor.crypto import hmac from trezor.sdcard import with_filesystem from trezor.utils import consteq @@ -25,6 +24,8 @@ def is_enabled() -> bool: def compute_auth_tag(salt: bytes, auth_key: bytes) -> bytes: + from trezor.crypto import hmac + digest = hmac(hmac.SHA256, auth_key, salt).digest() return digest[:SD_SALT_AUTH_TAG_LEN_BYTES] diff --git a/core/tests/test_apps.common.paths.py b/core/tests/test_apps.common.paths.py index dde5149dd..4b8401cc3 100644 --- a/core/tests/test_apps.common.paths.py +++ b/core/tests/test_apps.common.paths.py @@ -1,5 +1,6 @@ from common import * from trezor.utils import ensure +from apps.common.layout import address_n_to_str from apps.common.paths import *