1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-14 02:28:19 +00:00
trezor-firmware/src/apps/lisk/get_address.py
Tomas Susanka 31f987e988 coins: validate derivation paths
Based on SLIP-44 ids and other checks. See docs/coins/README for info.
2018-11-12 12:10:32 +01:00

26 lines
847 B
Python

from trezor.messages.LiskAddress import LiskAddress
from .helpers import LISK_CURVE, get_address_from_public_key, validate_full_path
from apps.common import paths, seed
from apps.common.layout import address_n_to_str, show_address, show_qr
async def get_address(ctx, msg):
await paths.validate_path(ctx, validate_full_path, path=msg.address_n)
node = await seed.derive_node(ctx, msg.address_n, LISK_CURVE)
pubkey = node.public_key()
pubkey = pubkey[1:] # skip ed25519 pubkey marker
address = get_address_from_public_key(pubkey)
if msg.show_display:
desc = address_n_to_str(msg.address_n)
while True:
if await show_address(ctx, address, desc=desc):
break
if await show_qr(ctx, address, desc=desc):
break
return LiskAddress(address=address)