diff --git a/src/apps/lisk/__init__.py b/src/apps/lisk/__init__.py index e9630e57e9..854cd38a2a 100644 --- a/src/apps/lisk/__init__.py +++ b/src/apps/lisk/__init__.py @@ -1,11 +1,18 @@ from trezor.wire import register, protobuf_workflow from trezor.messages.wire_types import \ - LiskGetAddress + LiskGetAddress, LiskGetPublicKey def dispatch_LiskGetAddress(*args, **kwargs): from .get_address import layout_lisk_get_address return layout_lisk_get_address(*args, **kwargs) + +def dispatch_LiskGetPublicKey(*args, **kwargs): + from .get_public_key import lisk_get_public_key + return lisk_get_public_key(*args, **kwargs) + + def boot(): + register(LiskGetPublicKey, protobuf_workflow, dispatch_LiskGetPublicKey) register(LiskGetAddress, protobuf_workflow, dispatch_LiskGetAddress) diff --git a/src/apps/lisk/get_public_key.py b/src/apps/lisk/get_public_key.py new file mode 100644 index 0000000000..7880999046 --- /dev/null +++ b/src/apps/lisk/get_public_key.py @@ -0,0 +1,20 @@ +from apps.wallet.get_public_key import _show_pubkey +from .helpers import LISK_CURVE + + +async def lisk_get_public_key(ctx, msg): + from trezor.messages.LiskPublicKey import LiskPublicKey + from trezor.crypto.curve import ed25519 + from ..common import seed + + address_n = msg.address_n or () + + node = await seed.derive_node(ctx, address_n, LISK_CURVE) + + seckey = node.private_key() + public_key = ed25519.publickey(seckey) + + if msg.show_display: + await _show_pubkey(ctx, public_key) + + return LiskPublicKey(public_key=public_key)