mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 06:18:07 +00:00
feat(core): spinner for authenticate_device
[no changelog]
This commit is contained in:
parent
f6c659357a
commit
bd1d0822b3
@ -9,8 +9,10 @@ async def authenticate_device(msg: AuthenticateDevice) -> AuthenticityProof:
|
||||
from trezor.crypto import optiga
|
||||
from trezor.crypto.der import read_length
|
||||
from trezor.crypto.hashlib import sha256
|
||||
from trezor.loop import sleep
|
||||
from trezor.messages import AuthenticityProof
|
||||
from trezor.ui.layouts import confirm_action
|
||||
from trezor.ui.layouts.progress import progress
|
||||
from trezor.utils import BufferReader, bootloader_locked
|
||||
|
||||
from apps.common.writers import write_compact_size
|
||||
@ -21,7 +23,8 @@ async def authenticate_device(msg: AuthenticateDevice) -> AuthenticityProof:
|
||||
await confirm_action(
|
||||
"authenticate_device",
|
||||
"Authenticate device",
|
||||
description="Do you wish to verify the authenticity of your device?",
|
||||
description=f"Allow connected computer to confirm your {utils.MODEL_FULL_NAME} is genuine?",
|
||||
verb="Allow",
|
||||
)
|
||||
|
||||
header = b"AuthenticateDevice:"
|
||||
@ -31,6 +34,9 @@ async def authenticate_device(msg: AuthenticateDevice) -> AuthenticityProof:
|
||||
write_compact_size(h, len(msg.challenge))
|
||||
h.extend(msg.challenge)
|
||||
|
||||
spinner = progress("", description="Checking authenticity...")
|
||||
spinner.report(0)
|
||||
|
||||
try:
|
||||
signature = optiga.sign(optiga.DEVICE_ECC_KEY_INDEX, h.get_digest())
|
||||
except optiga.SigningInaccessible:
|
||||
@ -47,6 +53,14 @@ async def authenticate_device(msg: AuthenticateDevice) -> AuthenticityProof:
|
||||
r.seek(cert_begin)
|
||||
certificates.append(r.read_memoryview(cert_len))
|
||||
|
||||
if not utils.DISABLE_ANIMATION:
|
||||
frame_delay = sleep(60)
|
||||
for i in range(1, 20):
|
||||
spinner.report(i * 50)
|
||||
await frame_delay
|
||||
|
||||
spinner.report(1000)
|
||||
|
||||
return AuthenticityProof(
|
||||
certificates=certificates,
|
||||
signature=signature,
|
||||
|
@ -1860,10 +1860,10 @@
|
||||
"TR_stellar-test_stellar.py::test_sign_tx[timebounds-0-1575234180]": "769f0c5a338ce0cda686cf16be2dac99aa421c129d27ec0951d196c4d7fb6655",
|
||||
"TR_stellar-test_stellar.py::test_sign_tx[timebounds-461535181-0]": "f554096547fe95c21dd82a32817358628e115997ba789fa269f0fcd11b37cda7",
|
||||
"TR_stellar-test_stellar.py::test_sign_tx[timebounds-461535181-1575234180]": "ae15615f214c9a78205732a8003bf782cb512f83893e7b81856ce505d9d79d79",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[!\\xf3\\xd4\\x0ec\\xc3\\x04\\xd01-b\\xeb\\x82-e4b4eb3a": "5bbde07a26ce37bd72d0c792c4dc9807c169c9fc731d1bcf30a72a5f2da7f602",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\-d824e03c": "5bbde07a26ce37bd72d0c792c4dc9807c169c9fc731d1bcf30a72a5f2da7f602",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[]": "5bbde07a26ce37bd72d0c792c4dc9807c169c9fc731d1bcf30a72a5f2da7f602",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[hello world]": "5bbde07a26ce37bd72d0c792c4dc9807c169c9fc731d1bcf30a72a5f2da7f602",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[!\\xf3\\xd4\\x0ec\\xc3\\x04\\xd01-b\\xeb\\x82-e4b4eb3a": "9ad82d25e289d01433142a2949389e51a9c9045a46c5fd0f7b2d81c08231a82e",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\-d824e03c": "9ad82d25e289d01433142a2949389e51a9c9045a46c5fd0f7b2d81c08231a82e",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[]": "9ad82d25e289d01433142a2949389e51a9c9045a46c5fd0f7b2d81c08231a82e",
|
||||
"TR_test_authenticate_device.py::test_authenticate_device[hello world]": "9ad82d25e289d01433142a2949389e51a9c9045a46c5fd0f7b2d81c08231a82e",
|
||||
"TR_test_autolock.py::test_apply_auto_lock_delay": "f74f7417dd27279b9c2db47f5d2049c3e10e5b45aeb853fed0ae01da85373a7e",
|
||||
"TR_test_autolock.py::test_apply_auto_lock_delay_out_of_range[0]": "c440a218850ec7ec8a4f8ee218d2c28251d12aa455f4726202d8bde897b0a555",
|
||||
"TR_test_autolock.py::test_apply_auto_lock_delay_out_of_range[1]": "c440a218850ec7ec8a4f8ee218d2c28251d12aa455f4726202d8bde897b0a555",
|
||||
|
Loading…
Reference in New Issue
Block a user