1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-12 18:49:07 +00:00

sign message layout

This commit is contained in:
chren 2016-06-09 17:34:43 +02:00 committed by Pavol Rusnak
parent 43e6bc2f11
commit 2482d3935d
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 31 additions and 0 deletions

View File

@ -22,8 +22,21 @@ def dispatch_SignTx(mtype, mbuf):
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():
GetPublicKey = 11
register(GetPublicKey, dispatch_GetPublicKey)
SignTx = 15
register(SignTx, dispatch_SignTx)
SignMessage = 38
register(SignMessage, dispatch_SignMessage)

View 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))