1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-10 22:52:46 +00:00
trezor-firmware/src/apps/homescreen/__init__.py

56 lines
1.5 KiB
Python
Raw Normal View History

2016-12-08 15:18:12 +00:00
from trezor.wire import register, protobuf_workflow
from trezor.utils import unimport
2016-11-12 14:13:00 +00:00
from trezor.messages.wire_types import Initialize, GetFeatures, Ping
2016-12-15 11:48:33 +00:00
@unimport
2017-08-15 13:09:09 +00:00
async def respond_Features(ctx, msg):
from apps.common import storage, coins
from trezor.messages.Features import Features
f = Features()
2017-01-10 15:31:30 +00:00
f.vendor = 'trezor.io'
f.revision = '0123456789'
f.bootloader_hash = '0123456789'
f.major_version = 2
f.minor_version = 0
f.patch_version = 0
2017-12-04 21:40:42 +00:00
f.model = 'T'
f.coins = coins.COINS
f.device_id = storage.get_device_id()
f.label = storage.get_label()
f.initialized = storage.is_initialized()
2017-10-24 11:58:40 +00:00
f.passphrase_protection = storage.has_passphrase()
f.pin_protection = False
f.language = 'english'
2016-11-15 10:51:28 +00:00
return f
2016-04-28 21:43:34 +00:00
2016-12-15 11:48:33 +00:00
@unimport
2017-08-15 13:09:09 +00:00
async def respond_Pong(ctx, msg):
2016-11-12 14:13:00 +00:00
from trezor.messages.Success import Success
2016-11-15 10:51:28 +00:00
s = Success()
s.message = msg.message
if msg.button_protection:
from apps.common.confirm import require_confirm
from trezor.messages.ButtonRequestType import ProtectCall
from trezor.ui.text import Text
from trezor import ui
await require_confirm(ctx, Text('Confirm', ui.ICON_RESET), ProtectCall)
if msg.passphrase_protection:
from apps.common.request_passphrase import protect_by_passphrase
2017-08-15 13:09:09 +00:00
await protect_by_passphrase(ctx)
2016-11-15 10:51:28 +00:00
return s
2016-11-12 14:13:00 +00:00
2016-04-28 21:43:34 +00:00
def boot():
2016-12-08 15:18:12 +00:00
register(Initialize, protobuf_workflow, respond_Features)
register(GetFeatures, protobuf_workflow, respond_Features)
register(Ping, protobuf_workflow, respond_Pong)