mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-13 12:28:47 +00:00
feat(core): make get_seed synchronous
[no changelog]
This commit is contained in:
parent
b6d06e9397
commit
cd649b1f78
@ -322,7 +322,7 @@ async def handle_UnlockPath(msg: UnlockPath) -> protobuf.MessageType:
|
|||||||
if msg.address_n != [SLIP25_PURPOSE]:
|
if msg.address_n != [SLIP25_PURPOSE]:
|
||||||
raise wire.DataError("Invalid path")
|
raise wire.DataError("Invalid path")
|
||||||
|
|
||||||
seed = await get_seed()
|
seed = get_seed()
|
||||||
node = Slip21Node(seed)
|
node = Slip21Node(seed)
|
||||||
node.derive_path(_KEYCHAIN_MAC_KEY_PATH)
|
node.derive_path(_KEYCHAIN_MAC_KEY_PATH)
|
||||||
mac = utils.HashWriter(hmac(hmac.SHA256, node.key()))
|
mac = utils.HashWriter(hmac(hmac.SHA256, node.key()))
|
||||||
|
@ -152,7 +152,7 @@ async def _get_keychain_bip39(derivation_type: CardanoDerivationType) -> Keychai
|
|||||||
raise wire.NotInitialized("Device is not initialized")
|
raise wire.NotInitialized("Device is not initialized")
|
||||||
|
|
||||||
if derivation_type == CardanoDerivationType.LEDGER:
|
if derivation_type == CardanoDerivationType.LEDGER:
|
||||||
seed = await get_seed()
|
seed = get_seed()
|
||||||
return Keychain(cardano.from_seed_ledger(seed))
|
return Keychain(cardano.from_seed_ledger(seed))
|
||||||
|
|
||||||
if not context.cache_get_bool(APP_COMMON_DERIVE_CARDANO):
|
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)
|
return await _get_keychain_bip39(derivation_type)
|
||||||
else:
|
else:
|
||||||
# derive the root node via SLIP-0023 https://github.com/satoshilabs/slips/blob/master/slip-0023.md
|
# 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))
|
return Keychain(cardano.from_seed_slip23(seed))
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ async def get_keychain(
|
|||||||
) -> Keychain:
|
) -> Keychain:
|
||||||
from .seed import get_seed
|
from .seed import get_seed
|
||||||
|
|
||||||
seed = await get_seed()
|
seed = get_seed()
|
||||||
keychain = Keychain(seed, curve, schemas, slip21_namespaces)
|
keychain = Keychain(seed, curve, schemas, slip21_namespaces)
|
||||||
return keychain
|
return keychain
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class Slip21Node:
|
|||||||
return Slip21Node(data=self.data)
|
return Slip21Node(data=self.data)
|
||||||
|
|
||||||
|
|
||||||
async def get_seed() -> bytes:
|
def get_seed() -> bytes:
|
||||||
common_seed = context.cache_get(APP_COMMON_SEED)
|
common_seed = context.cache_get(APP_COMMON_SEED)
|
||||||
assert common_seed is not None
|
assert common_seed is not None
|
||||||
return common_seed
|
return common_seed
|
||||||
|
Loading…
Reference in New Issue
Block a user