mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-15 18:00:59 +00:00
app.lisk: remove sign/verify code
This commit is contained in:
parent
523e57ea52
commit
3a81a4b2f0
@ -1,6 +1,6 @@
|
||||
from trezor.wire import register, protobuf_workflow
|
||||
from trezor.messages.wire_types import \
|
||||
LiskGetAddress, LiskSignMessage, LiskVerifyMessage, LiskSignTx, LiskGetPublicKey
|
||||
LiskGetAddress, LiskSignTx, LiskGetPublicKey
|
||||
|
||||
|
||||
def dispatch_LiskGetAddress(*args, **kwargs):
|
||||
@ -13,16 +13,6 @@ def dispatch_LiskGetPublicKey(*args, **kwargs):
|
||||
return lisk_get_public_key(*args, **kwargs)
|
||||
|
||||
|
||||
def dispatch_LiskSignMessage(*args, **kwargs):
|
||||
from .sign_message import lisk_sign_message
|
||||
return lisk_sign_message(*args, **kwargs)
|
||||
|
||||
|
||||
def dispatch_LiskVerifyMessage(*args, **kwargs):
|
||||
from .verify_message import lisk_verify_message
|
||||
return lisk_verify_message(*args, **kwargs)
|
||||
|
||||
|
||||
def dispatch_LiskSignTx(*args, **kwargs):
|
||||
from .sign_tx import lisk_sign_tx
|
||||
return lisk_sign_tx(*args, **kwargs)
|
||||
@ -31,6 +21,4 @@ def dispatch_LiskSignTx(*args, **kwargs):
|
||||
def boot():
|
||||
register(LiskGetPublicKey, protobuf_workflow, dispatch_LiskGetPublicKey)
|
||||
register(LiskGetAddress, protobuf_workflow, dispatch_LiskGetAddress)
|
||||
register(LiskSignMessage, protobuf_workflow, dispatch_LiskSignMessage)
|
||||
register(LiskVerifyMessage, protobuf_workflow, dispatch_LiskVerifyMessage)
|
||||
register(LiskSignTx, protobuf_workflow, dispatch_LiskSignTx)
|
||||
|
@ -1,23 +0,0 @@
|
||||
from .helpers import LISK_CURVE, get_address_from_public_key
|
||||
from apps.wallet.sign_message import require_confirm_sign_message
|
||||
|
||||
async def lisk_sign_message(ctx, msg):
|
||||
from trezor.messages.LiskMessageSignature import LiskMessageSignature
|
||||
from trezor.crypto.curve import ed25519
|
||||
from ..common import seed
|
||||
|
||||
message = msg.message
|
||||
|
||||
await require_confirm_sign_message(ctx, message)
|
||||
|
||||
address_n = msg.address_n or ()
|
||||
|
||||
node = await seed.derive_node(ctx, address_n, LISK_CURVE)
|
||||
seckey = node.private_key()
|
||||
pubkey = node.public_key()
|
||||
pubkey = pubkey[1:] # skip ed25519 pubkey marker
|
||||
address = get_address_from_public_key(pubkey)
|
||||
|
||||
signature = ed25519.sign(seckey, message)
|
||||
|
||||
return LiskMessageSignature(address=address, signature=signature)
|
@ -1,19 +0,0 @@
|
||||
|
||||
async def lisk_verify_message(ctx, msg):
|
||||
from trezor.crypto.curve import ed25519
|
||||
from .helpers import get_address_from_public_key
|
||||
from trezor import wire
|
||||
from trezor.messages.Success import Success
|
||||
from trezor.messages.FailureType import ProcessError
|
||||
from apps.wallet.verify_message import require_confirm_verify_message
|
||||
|
||||
verify = ed25519.verify(msg.public_key, msg.signature, msg.message)
|
||||
|
||||
if not verify:
|
||||
raise wire.FailureError(ProcessError, 'Invalid signature')
|
||||
|
||||
address = get_address_from_public_key(msg.public_key)
|
||||
|
||||
await require_confirm_verify_message(ctx, address, msg.message)
|
||||
|
||||
return Success(message='Message verified')
|
Loading…
Reference in New Issue
Block a user