From e6f297075a200d6ba98e827db4cb6c4de7c8f0cc Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 26 Oct 2018 12:16:56 +0200 Subject: [PATCH] cardano: add high-level support for passhrase --- src/apps/cardano/get_address.py | 5 +++-- src/apps/cardano/get_public_key.py | 3 ++- src/apps/cardano/sign_tx.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/apps/cardano/get_address.py b/src/apps/cardano/get_address.py index db22e6207..ecf8445c7 100644 --- a/src/apps/cardano/get_address.py +++ b/src/apps/cardano/get_address.py @@ -5,12 +5,13 @@ from trezor.messages.CardanoAddress import CardanoAddress from .address import derive_address_and_node from .layout import confirm_with_pagination -from apps.common import storage +from apps.common import seed, storage async def get_address(ctx, msg): mnemonic = storage.get_mnemonic() - root_node = bip32.from_mnemonic_cardano(mnemonic, "") + passphrase = await seed._get_cached_passphrase(ctx) + root_node = bip32.from_mnemonic_cardano(mnemonic, passphrase) try: address, _ = derive_address_and_node(root_node, msg.address_n) diff --git a/src/apps/cardano/get_public_key.py b/src/apps/cardano/get_public_key.py index 9c80b2602..8e5d0eb2a 100644 --- a/src/apps/cardano/get_public_key.py +++ b/src/apps/cardano/get_public_key.py @@ -12,7 +12,8 @@ from apps.common import layout, seed, storage async def get_public_key(ctx, msg): mnemonic = storage.get_mnemonic() - root_node = bip32.from_mnemonic_cardano(mnemonic, "") + passphrase = await seed._get_cached_passphrase(ctx) + root_node = bip32.from_mnemonic_cardano(mnemonic, passphrase) try: key = _get_public_key(root_node, msg.address_n) diff --git a/src/apps/cardano/sign_tx.py b/src/apps/cardano/sign_tx.py index 547bdeb12..962f7cf50 100644 --- a/src/apps/cardano/sign_tx.py +++ b/src/apps/cardano/sign_tx.py @@ -80,7 +80,8 @@ async def request_transaction(ctx, tx_req: CardanoTxRequest, index: int): async def sign_tx(ctx, msg): mnemonic = storage.get_mnemonic() - root_node = bip32.from_mnemonic_cardano(mnemonic, "") + passphrase = await seed._get_cached_passphrase(ctx) + root_node = bip32.from_mnemonic_cardano(mnemonic, passphrase) progress.init(msg.transactions_count, "Loading data")