mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-09 16:18:10 +00:00

Changes many fields to required -- as far as we were able to figure out, signing would fail if these fields aren't provided anyway, so this should not pose a compatibility problem. Co-authored-by: matejcik <ja@matejcik.cz>
30 lines
926 B
Python
30 lines
926 B
Python
from typing import TYPE_CHECKING
|
|
|
|
from trezor.messages import TezosGetPublicKey, 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
|
|
|
|
if TYPE_CHECKING:
|
|
from apps.common.keychain import Keychain
|
|
from trezor.wire import Context
|
|
|
|
|
|
@with_slip44_keychain(*PATTERNS, slip44_id=SLIP44_ID, curve=CURVE)
|
|
async def get_public_key(
|
|
ctx: Context, msg: TezosGetPublicKey, keychain: Keychain
|
|
) -> TezosPublicKey:
|
|
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)
|