1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00
Commit Graph

52 Commits

Author SHA1 Message Date
matejcik
f8bb90366a fix(tests): auto-swipe by using only ButtonRequest.pages 2021-07-09 21:01:07 +02:00
Jan Pochyla
a8623c4b59 refactor(core): fix imports and use new protobuf API in apps 2021-06-08 09:55:19 +02:00
matejcik
b387970468 refactor(core/debug): move "wipe with debug build" to boot.py
otherwise it gets wiped after every workflow
2021-05-06 13:14:21 +02:00
matejcik
b1ca6ca848 refactor(core/debug): offload debug configuration from apps.debug 2021-05-06 13:14:21 +02:00
matejcik
e859c13d70 refactor(core): limit global imports in key places
so that by importing `apps.base`, we don't pull in the whole circus
2021-05-06 13:14:21 +02:00
matejcik
e629a72c3a refactor(core): move app registrations to a single handler function
apps.webauthn.boot() does not need an if-condition because it's only
called from session.py when the usb interface is enabled

This means that they do not need to be stored in RAM at all. The obvious
drawback is that we need to hand-edit the if/elif sequence, but we don't
register new handlers all that often so 🤷
2021-05-06 13:14:21 +02:00
Martin Milata
ac711fb8ee style(core): use more recent type annotation syntax
https://www.python.org/dev/peps/pep-0585/ - Type Hinting Generics In Standard Collections
https://www.python.org/dev/peps/pep-0604/ - Allow writing union types as X | Y
2021-04-01 11:12:30 +02:00
Martin Milata
c0174ff217 refactor(core/ui): raise exception on dialog cancel by default 2021-03-30 22:34:01 +02:00
Andrew Kozlik
3084d1196d feat(core): Support 50 digit PIN and wipe code. 2021-03-25 14:24:41 +01:00
matejcik
cb7152542d feat: drop DebugLinkShowText functionality 2021-03-18 10:59:51 +01:00
Martin Milata
192d0dcf87 feat(core): hold homescreen to lock 2021-02-24 00:10:10 +01:00
Martin Milata
f38abf9d89 refactor(core): introduce layouts
Layouts can be used by the application code to interact with user using
small number of dialogs or other groups of UI components. Each layout is
identified by name and takes some parameters. Most layouts will have an
implementation for each hardware model, mechanism is provided to import
the correct version so that application code can be oblivious to the
model.

This commit introduces the layout concept and converts a couple of
dialogs to use it.
2021-02-10 13:57:19 +01:00
Martin Milata
f1382bf892 refactor(core): model-dependent UI component directories
They now live under trezor.ui.components.tt. Later
trezor.ui.components.t1 will be added and application code will be
rewritten to not use them directly in order to work on both TT and T1.
2021-02-10 13:57:19 +01:00
Pavol Rusnak
1e8673bf5f style(core/apps): use new syntax for typing 2020-12-01 15:52:29 +01:00
matejcik
c008600d08 core/debug: fail if wait_layout is sent without watch_layout 2020-07-29 11:50:47 +02:00
Pavol Rusnak
cec87bba50
core: remove mono bold font variant (not used anywhere) 2020-07-27 23:22:34 +02:00
matejcik
8e44132d3c core: replace load_settings with individual setters 2020-07-24 16:37:58 +02:00
Tomas Susanka
a6acefbdf5 core: wipe before reset and recovery; introduce 'intialized' field 2020-06-16 11:31:29 +02:00
matejcik
01832d5ae9 core: call close_others() in place of ButtonRequest
this makes sense, really: close_others() requests UI exclusivity, and
that is something that generally happens at the same places we emit a
ButtonRequest
2020-06-04 16:18:46 +02:00
matejcik
6f53ca0ac6 core: rework wait_layout()
The original wait_layout was unreliable, because there are no guarantees
re order of arrival of the respective events. Still, TT's event handling
is basically deterministic, so as long as the host sent its messages
close enough to each other, the order worked out.

This is no longer the case with the introduction of loop.spawn: TT's
behavior is still deterministic, but now ButtonAck is processed *before*
the corresponding wait_layout, so the waiting side waits forever.

In the new process, the host must first register to receive layout
events, and then receives all of them (so the number of calls to
wait_layout must match the number of layout changes).

DebugLinkWatchLayout message must be version-gated, because of an
unfortunate collection of bugs in previous versions wrt unknown message
handling; and this interests us because upgrade-tests are using
wait_layout feature.
2020-06-04 16:18:46 +02:00
matejcik
246998910a core: refactor usage of input_signals
this prevents a certain class of UI test failure. It also localizes the
use of debuglink signals into the layout classes instead of call sites,
which is a design we were already using for confirm_signals
2020-06-04 16:18:46 +02:00
matejcik
341c5b7d10 core/wire: make handler lookup pluggable 2020-06-04 16:18:46 +02:00
Tomas Susanka
86b010a18b
Merge pull request #878 from trezor/matejcik/fatfs-corruption
FatFS API rework
2020-02-27 15:58:38 +01:00
Tomas Susanka
495a59c282 core: use wire errors instead of ValueErrors where applicable 2020-02-27 10:46:01 +00:00
matejcik
18ac4fc9ca core: update Python facing APIs 2020-02-27 10:56:23 +01:00
matejcik
ddee77ecb6 core: add SD clearing via debuglink 2020-02-20 12:51:48 +01:00
Tomas Susanka
2c0504ad1c
Merge pull request #803 from trezor/passphrase
Passphrase Redesign
2020-02-11 16:01:59 +01:00
matejcik
05a1d6f771 core/debug: add "show arbitrary screen" capability, for easier prototyping 2020-02-11 11:53:34 +01:00
Tomas Susanka
90d5cdfd5b
all: rework passphrase
The `on_device` field is being moved to PassphraseAck, State messages
are removed. Features newly contain `session_id`.
2020-02-07 11:40:58 +00:00
matejcik
2294fb0453 core: drop unused env variables (TREZOR_TEST, TREZOR_SAVE_SCREEN) 2020-01-23 18:43:20 +01:00
matejcik
a79279115e core: move confirm_signal evaluation into concrete Layout implementations
Apart from making the code more correct for its users in
apps.common.confirm and elsewhere, this fixes a problem where the
confirm_signal would be scheduled before the dialog is rendered.
By making sure that handle_rendering is scheduled (i.e., listed in
create_tasks) before confirm_signal, we can be sure to render at least
once and thus appear in the UI test results.
2020-01-23 15:45:10 +01:00
Tomas Susanka
7c41b40dff
tests: introduce UI tests for core with diffs (#784)
tests: introduce UI tests for core with diffs
2020-01-10 20:39:31 +01:00
Tomas Susanka
30858c4969 tests/ui: omit the red square from screenshots
except the first one on homescreen because it gets rendered only once
2020-01-10 08:25:12 +00:00
matejcik
f90ba10af3 core: modify function signatures to match python-shamir-mnemonic 2020-01-09 16:00:33 +01:00
Tomas Susanka
51ef963738 tests: introduce UI tests for core 2020-01-03 14:28:27 +00:00
matejcik
09962708d3 core: move load_device to the debug app 2019-11-13 16:48:35 +01:00
matejcik
5c93ecd53a core: create top-level storage module
This is to avoid including app-specific functionality in storage and
avoid circular imports. The following policy is now in effect: modules
from `storage` namespace must not import from `apps` namespace.

In most files, the change only involves changing import paths.

A minor refactor was needed in case of webauthn: basic get/set/delete
functionality was left in storage.webauthn, and more advanced logic on
top of it was moved to apps.webauthn.resident_credentials.

A significant refactor was needed for sd_salt, where application (and
UI) logic was tightly coupled with the IO code. This is now separated,
and storage.sd_salt deals exclusively with the IO side, while the app/UI
logic is implemented on top of it in apps.common.sd_salt and
apps.management.sd_protect.
2019-10-31 16:21:56 +01:00
matejcik
a5ccf95260 core: fix mypy problems 2019-10-22 17:06:49 +02:00
matejcik
8d2ae142f3 core/debug: at start, wait for first layout to show up 2019-10-22 17:06:49 +02:00
matejcik
a8fc569016 debug: add support for general layout waiting 2019-10-22 17:06:49 +02:00
matejcik
97525654bb core/debug: avoid running a handler when waiting for layout change
otherwise a running handler would prevent the default task from
starting, which would deadlock a test waiting for the default task
2019-10-22 17:06:49 +02:00
matejcik
3664a5f06f core/debug: reading layouts, inserting synthetic events 2019-10-22 17:06:49 +02:00
Tomas Susanka
0511cc8b8c core: add final mypy fixes! 2019-10-22 14:36:25 +00:00
Andrew Kozlik
564b24191e debug: Add left and right swipe direction to DebugLinkDecision message and unify terminology around swipe direction. 2019-10-10 14:56:49 +02:00
Jan Pochyla
bb2556a22c
core: improve code documentation, simplify wire package
* docs: improve loop.py, ui.init

* docs: improve trezor.loop, rename spawn to race

* docs: wire

* core/wire: simplify and document the session handler

* core/wire: improve documentation

* core/wire: improve docs

* core/docs: document ui.grid function

* core: decouple ui and workflow, document both

* core: improve docs


Co-authored-by: Tomas Susanka <tsusanka@gmail.com>
2019-08-20 16:20:02 +02:00
matejcik
c285bbba7a core: dispatch DebugLinkDecisions from a common queue 2019-08-09 16:53:12 +02:00
matejcik
0890f68c0c core: use channels to give feedback over debuglink
all debug input signals are now channels, and DebugLinkDecision handler
waits until the input was consumed. This means that the input events are
queued; originally, if an input event arrived before the previous was
consumed, the previous input would be lost.

reset words and their positions are now also channels, and
DebugLinkGetState can wait for their updates, if required
2019-08-09 16:53:12 +02:00
Tomas Susanka
c735299bd0 core/backup: fix mnemonic_module to mnemonic_type 2019-07-26 12:06:00 +02:00
Jan Pochyla
758a1a2528 core/typing: add annotations 2019-07-09 12:51:48 +02:00
Tomas Susanka
46e4c02602 core: refactor storage
Each namespace now has its own file in apps.common.storage and
storage/__init__ serves as an entry point.

Updates #274.
2019-07-08 15:24:56 +02:00