mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-22 05:10:56 +00:00
sign message layout
This commit is contained in:
parent
43e6bc2f11
commit
2482d3935d
@ -22,8 +22,21 @@ def dispatch_SignTx(mtype, mbuf):
|
|||||||
return layout_sign_tx(message)
|
return layout_sign_tx(message)
|
||||||
|
|
||||||
|
|
||||||
|
@unimport_func
|
||||||
|
def dispatch_SignMessage(mtype, mbuf):
|
||||||
|
from trezor.messages.SignMessage import SignMessage
|
||||||
|
|
||||||
|
message = SignMessage.loads(mbuf)
|
||||||
|
|
||||||
|
from .layout_sign_message import layout_sign_message
|
||||||
|
return layout_sign_message(message)
|
||||||
|
|
||||||
|
|
||||||
def boot():
|
def boot():
|
||||||
GetPublicKey = 11
|
GetPublicKey = 11
|
||||||
register(GetPublicKey, dispatch_GetPublicKey)
|
register(GetPublicKey, dispatch_GetPublicKey)
|
||||||
SignTx = 15
|
SignTx = 15
|
||||||
register(SignTx, dispatch_SignTx)
|
register(SignTx, dispatch_SignTx)
|
||||||
|
SignMessage = 38
|
||||||
|
register(SignMessage, dispatch_SignMessage)
|
||||||
|
|
||||||
|
18
src/apps/wallet/layout_sign_message.py
Normal file
18
src/apps/wallet/layout_sign_message.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from trezor import wire, ui
|
||||||
|
from trezor.utils import unimport_gen
|
||||||
|
from trezor.workflows.confirm import confirm
|
||||||
|
|
||||||
|
@unimport_gen
|
||||||
|
def layout_sign_message(message):
|
||||||
|
ui.clear()
|
||||||
|
ui.display.text(10, 30, 'Signing message', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
|
||||||
|
ui.display.text(10, 60, message.message, ui.MONO, ui.WHITE, ui.BLACK)
|
||||||
|
confirmed = yield from confirm()
|
||||||
|
|
||||||
|
if confirmed:
|
||||||
|
from trezor.messages.Success import Success
|
||||||
|
yield from wire.write(Success(message='Signed'))
|
||||||
|
else:
|
||||||
|
from trezor.messages.Failure import Failure
|
||||||
|
from trezor.messages.FailureType import ActionCancelled
|
||||||
|
yield from wire.write(Failure(message='Cancelled', code=ActionCancelled))
|
Loading…
Reference in New Issue
Block a user