You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/src/apps/tezos/get_public_key.py

22 lines
725 B

from trezor.messages.TezosPublicKey import TezosPublicKey
from trezor.ui.layouts import show_pubkey
from apps.common import paths, seed
from apps.common.keychain import with_slip44_keychain
from . import CURVE, PATTERNS, SLIP44_ID, helpers
@with_slip44_keychain(*PATTERNS, slip44_id=SLIP44_ID, curve=CURVE)
async def get_public_key(ctx, msg, keychain):
await paths.validate_path(ctx, keychain, msg.address_n)
node = keychain.derive(msg.address_n)
pk = seed.remove_ed25519_prefix(node.public_key())
pk_prefixed = helpers.base58_encode_check(pk, prefix=helpers.TEZOS_PUBLICKEY_PREFIX)
if msg.show_display:
await show_pubkey(ctx, pk_prefixed)
return TezosPublicKey(public_key=pk_prefixed)