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

48 lines
1.3 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-08 15:18:12 +00:00
async def respond_Features(session_id, msg):
from apps.common import storage, coins
from trezor.messages.Features import Features
f = Features()
f.vendor = 'bitcointrezor.com'
f.revision = '0123456789'
f.bootloader_hash = '0123456789'
f.major_version = 2
f.minor_version = 0
f.patch_version = 0
f.coins = coins.COINS
f.device_id = storage.get_device_id()
f.label = storage.get_label()
f.initialized = storage.is_initialized()
f.pin_protection = storage.is_protected_by_pin()
f.passphrase_protection = storage.is_protected_by_passphrase()
2016-11-15 10:51:28 +00:00
return f
2016-04-28 21:43:34 +00:00
2016-12-08 15:18:12 +00:00
async def respond_Pong(session_id, 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.pin_protection:
from apps.common.request_pin import protect_by_pin
await protect_by_pin(session_id)
2016-11-15 10:51:28 +00:00
# TODO: handle other fields:
# button_protection
# passphrase_protection
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)