mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-15 18:00:59 +00:00
app.lisk: simplify pubkey computation
This commit is contained in:
parent
83a1df99f4
commit
c78c6616f6
@ -4,16 +4,14 @@ from .helpers import LISK_CURVE, get_address_from_public_key
|
||||
|
||||
async def layout_lisk_get_address(ctx, msg):
|
||||
from trezor.messages.LiskAddress import LiskAddress
|
||||
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)
|
||||
address = get_address_from_public_key(public_key)
|
||||
pubkey = node.public_key()
|
||||
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||
address = get_address_from_public_key(pubkey)
|
||||
|
||||
if msg.show_display:
|
||||
while True:
|
||||
|
@ -4,17 +4,15 @@ 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)
|
||||
pubkey = node.public_key()
|
||||
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||
|
||||
if msg.show_display:
|
||||
await _show_pubkey(ctx, public_key)
|
||||
await _show_pubkey(ctx, pubkey)
|
||||
|
||||
return LiskPublicKey(public_key=public_key)
|
||||
return LiskPublicKey(public_key=pubkey)
|
||||
|
@ -11,11 +11,12 @@ async def lisk_sign_message(ctx, msg):
|
||||
await require_confirm_sign_message(ctx, message)
|
||||
|
||||
address_n = msg.address_n or ()
|
||||
node = await seed.derive_node(ctx, address_n, LISK_CURVE)
|
||||
|
||||
node = await seed.derive_node(ctx, address_n, LISK_CURVE)
|
||||
seckey = node.private_key()
|
||||
public_key = ed25519.publickey(seckey)
|
||||
address = get_address_from_public_key(public_key)
|
||||
pubkey = node.public_key()
|
||||
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||
address = get_address_from_public_key(pubkey)
|
||||
|
||||
signature = ed25519.sign(seckey, message)
|
||||
|
||||
|
@ -104,7 +104,6 @@ def _get_asset_data_bytes(msg):
|
||||
return data
|
||||
|
||||
async def _get_keys(ctx, msg):
|
||||
from trezor.crypto.curve import ed25519
|
||||
from ..common import seed
|
||||
from .helpers import LISK_CURVE
|
||||
|
||||
@ -112,9 +111,10 @@ async def _get_keys(ctx, msg):
|
||||
node = await seed.derive_node(ctx, address_n, LISK_CURVE)
|
||||
|
||||
seckey = node.private_key()
|
||||
public_key = ed25519.publickey(seckey)
|
||||
pubkey = node.public_key()
|
||||
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||
|
||||
return public_key, seckey
|
||||
return pubkey, seckey
|
||||
|
||||
def update_raw_tx(transaction, public_key):
|
||||
from .helpers import get_address_from_public_key
|
||||
|
Loading…
Reference in New Issue
Block a user