mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-12 09:38:08 +00:00
25 lines
705 B
Python
25 lines
705 B
Python
from trezor.crypto import random
|
|
from trezor.messages import ButtonRequestType
|
|
from trezor.messages.Entropy import Entropy
|
|
from trezor.ui.layouts import confirm_action
|
|
|
|
if False:
|
|
from trezor.wire import Context
|
|
from trezor.messages.GetEntropy import GetEntropy
|
|
|
|
|
|
async def get_entropy(ctx: Context, msg: GetEntropy) -> Entropy:
|
|
await confirm_action(
|
|
ctx,
|
|
"get_entropy",
|
|
"Confirm entropy",
|
|
action="Do you really want\nto send entropy?",
|
|
description="Continue only if you\nknow what you are doing!",
|
|
br_code=ButtonRequestType.ProtectCall,
|
|
)
|
|
|
|
size = min(msg.size, 1024)
|
|
entropy = random.bytes(size)
|
|
|
|
return Entropy(entropy=entropy)
|