From cd649b1f788bf58147d6be6dc58bbda05bb03698 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Wed, 16 Oct 2024 16:52:14 +0200 Subject: [PATCH] feat(core): make get_seed synchronous [no changelog] --- core/src/apps/base.py | 2 +- core/src/apps/cardano/seed.py | 4 ++-- core/src/apps/common/keychain.py | 2 +- core/src/apps/common/seed.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/apps/base.py b/core/src/apps/base.py index e9d01c2897..c44d7178a3 100644 --- a/core/src/apps/base.py +++ b/core/src/apps/base.py @@ -322,7 +322,7 @@ async def handle_UnlockPath(msg: UnlockPath) -> protobuf.MessageType: if msg.address_n != [SLIP25_PURPOSE]: raise wire.DataError("Invalid path") - seed = await get_seed() + seed = get_seed() node = Slip21Node(seed) node.derive_path(_KEYCHAIN_MAC_KEY_PATH) mac = utils.HashWriter(hmac(hmac.SHA256, node.key())) diff --git a/core/src/apps/cardano/seed.py b/core/src/apps/cardano/seed.py index 0ddfbf8ac2..a843ea9a2b 100644 --- a/core/src/apps/cardano/seed.py +++ b/core/src/apps/cardano/seed.py @@ -152,7 +152,7 @@ async def _get_keychain_bip39(derivation_type: CardanoDerivationType) -> Keychai raise wire.NotInitialized("Device is not initialized") if derivation_type == CardanoDerivationType.LEDGER: - seed = await get_seed() + seed = get_seed() return Keychain(cardano.from_seed_ledger(seed)) if not context.cache_get_bool(APP_COMMON_DERIVE_CARDANO): @@ -179,7 +179,7 @@ async def _get_keychain(derivation_type: CardanoDerivationType) -> Keychain: return await _get_keychain_bip39(derivation_type) else: # derive the root node via SLIP-0023 https://github.com/satoshilabs/slips/blob/master/slip-0023.md - seed = await get_seed() + seed = get_seed() return Keychain(cardano.from_seed_slip23(seed)) diff --git a/core/src/apps/common/keychain.py b/core/src/apps/common/keychain.py index 16913d1529..79951cbb9d 100644 --- a/core/src/apps/common/keychain.py +++ b/core/src/apps/common/keychain.py @@ -172,7 +172,7 @@ async def get_keychain( ) -> Keychain: from .seed import get_seed - seed = await get_seed() + seed = get_seed() keychain = Keychain(seed, curve, schemas, slip21_namespaces) return keychain diff --git a/core/src/apps/common/seed.py b/core/src/apps/common/seed.py index 48cabdb9f9..894de096e3 100644 --- a/core/src/apps/common/seed.py +++ b/core/src/apps/common/seed.py @@ -60,7 +60,7 @@ class Slip21Node: return Slip21Node(data=self.data) -async def get_seed() -> bytes: +def get_seed() -> bytes: common_seed = context.cache_get(APP_COMMON_SEED) assert common_seed is not None return common_seed