1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-13 18:18:08 +00:00
trezor-firmware/core/src/apps/management/get_nonce.py
2022-01-31 18:00:22 +01:00

11 lines
297 B
Python

from storage import cache
from trezor import wire
from trezor.crypto import random
from trezor.messages import GetNonce, Nonce
async def get_nonce(ctx: wire.Context, msg: GetNonce) -> Nonce:
nonce = random.bytes(32)
cache.set(cache.APP_COMMON_NONCE, nonce)
return Nonce(nonce=nonce)