mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-16 02:10:55 +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):
|
async def layout_lisk_get_address(ctx, msg):
|
||||||
from trezor.messages.LiskAddress import LiskAddress
|
from trezor.messages.LiskAddress import LiskAddress
|
||||||
from trezor.crypto.curve import ed25519
|
|
||||||
from ..common import seed
|
from ..common import seed
|
||||||
|
|
||||||
address_n = msg.address_n or ()
|
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)
|
||||||
|
pubkey = node.public_key()
|
||||||
seckey = node.private_key()
|
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||||
public_key = ed25519.publickey(seckey)
|
address = get_address_from_public_key(pubkey)
|
||||||
address = get_address_from_public_key(public_key)
|
|
||||||
|
|
||||||
if msg.show_display:
|
if msg.show_display:
|
||||||
while True:
|
while True:
|
||||||
|
@ -4,17 +4,15 @@ from .helpers import LISK_CURVE
|
|||||||
|
|
||||||
async def lisk_get_public_key(ctx, msg):
|
async def lisk_get_public_key(ctx, msg):
|
||||||
from trezor.messages.LiskPublicKey import LiskPublicKey
|
from trezor.messages.LiskPublicKey import LiskPublicKey
|
||||||
from trezor.crypto.curve import ed25519
|
|
||||||
from ..common import seed
|
from ..common import seed
|
||||||
|
|
||||||
address_n = msg.address_n or ()
|
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)
|
||||||
|
pubkey = node.public_key()
|
||||||
seckey = node.private_key()
|
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||||
public_key = ed25519.publickey(seckey)
|
|
||||||
|
|
||||||
if msg.show_display:
|
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)
|
await require_confirm_sign_message(ctx, message)
|
||||||
|
|
||||||
address_n = msg.address_n or ()
|
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()
|
seckey = node.private_key()
|
||||||
public_key = ed25519.publickey(seckey)
|
pubkey = node.public_key()
|
||||||
address = get_address_from_public_key(public_key)
|
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||||
|
address = get_address_from_public_key(pubkey)
|
||||||
|
|
||||||
signature = ed25519.sign(seckey, message)
|
signature = ed25519.sign(seckey, message)
|
||||||
|
|
||||||
|
@ -104,7 +104,6 @@ def _get_asset_data_bytes(msg):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
async def _get_keys(ctx, msg):
|
async def _get_keys(ctx, msg):
|
||||||
from trezor.crypto.curve import ed25519
|
|
||||||
from ..common import seed
|
from ..common import seed
|
||||||
from .helpers import LISK_CURVE
|
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)
|
node = await seed.derive_node(ctx, address_n, LISK_CURVE)
|
||||||
|
|
||||||
seckey = node.private_key()
|
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):
|
def update_raw_tx(transaction, public_key):
|
||||||
from .helpers import get_address_from_public_key
|
from .helpers import get_address_from_public_key
|
||||||
|
Loading…
Reference in New Issue
Block a user