trezor-core/src/apps/wallet/get_entropy.py

25 lines
671 B
Python
Raw Normal View History

from trezor import ui
2017-05-08 13:11:30 -07:00
2017-08-15 06:09:09 -07:00
async def layout_get_entropy(ctx, msg):
2017-05-08 13:11:30 -07:00
from trezor.messages.Entropy import Entropy
from trezor.crypto import random
l = min(msg.size, 1024)
2017-08-15 06:09:09 -07:00
await _show_entropy(ctx)
2017-05-08 13:11:30 -07:00
return Entropy(entropy=random.bytes(l))
2017-08-15 06:09:09 -07:00
async def _show_entropy(ctx):
2017-05-08 13:11:30 -07:00
from trezor.messages.ButtonRequestType import ProtectCall
from trezor.ui.text import Text
from ..common.confirm import require_confirm
2017-11-06 07:09:22 -08:00
await require_confirm(ctx, Text(
'Confirm entropy', ui.ICON_DEFAULT,
2017-11-06 07:09:22 -08:00
ui.BOLD, 'Do you really want', 'to send entropy?',
2017-12-09 09:38:36 -08:00
ui.NORMAL, 'Continue only if you', 'know what you are doing!'),
code=ProtectCall)