In development. It changes without notice.
Topic
Application States
The states of the application, what moves it from one to the next, and the handler that runs each.
The application is one flat state machine. Each state has one handler (AppStateHandler), and what the handlers share is in AppContext: the open vault's session, the inputs, the settings in force, and the one path into the production sleep.
The states
When a state ends
| State | Goes to | When |
|---|---|---|
| BOOT_CHECK | ONBOARDING | There is no vault, and setup was never finished. |
| BOOT_CHECK | PIN_ENTRY | Anything else, a lookup that failed included. |
| ONBOARDING | HOME | Setup is finished. |
| PIN_ENTRY | HOME | The secret is accepted. |
| PIN_ENTRY | ONBOARDING | There is no vault, and no finished setup. |
| PIN_ENTRY | ADMIN_MODE | The secret is accepted, and the portal was asked for before the restart. |
| PIN_ENTRY | Production sleep | 30 s pass without input. |
| PIN_ENTRY | BOOT_CHECK, through a restart | The tenth failure in a row, after the factory reset. |
| HOME | BLE_ | A send starts. With two or more hosts it asks which one first. |
| HOME | ADMIN_MODE | The portal is chosen while Bluetooth is off. |
| HOME | BOOT_CHECK, through a restart | The portal is chosen while Bluetooth is up, and opens after the next unlock. Or the settings wipe the vault, reset the settings, or make a factory reset. |
| HOME | PIN_ENTRY | The automatic lock, on the boards without a keyboard, or a restore from a card that changed the vault. |
| HOME | Production sleep | The idle limit, a shake, or a lock. |
| BLE_ | HOME | The send is done, failed, refused or cancelled. |
| BLE_ | Production sleep | A send landed with the lock set to follow one, a shake, or the idle limit while connected. |
| ADMIN_MODE | HOME | A long press of the side key on the Sticks, or of Backspace on the M5Cardputer ADV and the LILYGO T-Deck; on the CoreInk, its back key. |
| ADMIN_MODE | Production sleep | The dial's center press on the CoreInk, or the middle touch button under the panel on the Core2 v1.3 and the CoreS3 SE; the session ended from the portal; or 5 minutes without activity. |
| ADMIN_MODE | BOOT_CHECK, through a restart | An update was installed, the portal asked for a restart, or Bluetooth was still up as the portal opened. |
In any state the lock key or the power key puts the board in its production sleep, and so does a critical battery on the boards without a keyboard. What ends that sleep depends on the board (The boards).
Every way into the sleep is one path, AppContext::
The portal is the one state that installs an update, and the only one with Wi-Fi's access point up. A request for it made before a restart says where to go after the next unlock and unlocks nothing.
What is where: State Context & Shared Flows holds what the handlers share, Shared Screen Parts the parts several screens draw, State Rules the rules with no screen behind them, First-Time Setup the first-time setup, Home Screen what HOME shows and Settings Screen & Service the settings screen. The options those settings are made of are Settings Model.
A debug build has two more states, a hardware test and a gallery of the interface's components, reached from its console (Serial Debug Console).
Topics | |
| State Context & Shared Flows | |
| What every state handler shares: the context and its sleep path, the handler's interface, and the flows that several states run. | |
| Home Screen | |
| What the home screen shows and does besides settings: the lists, a record's detail, the one-time codes, the choice of a host, the SD card's flows and the edits. | |
| First-Time Setup | |
| The first use of a board: its keys, the language, a rehearsal of each control, the unlock secret, and the pairing of a first computer. | |
| Settings Screen & Service | |
| The settings screen, its overlays and wizards, and the service that reads and applies an option. | |
| Shared Screen Parts | |
| The pieces several screens draw or steer by: the header, the lock screen's clock, the Bluetooth chip, the list's motion, and the navigation with two buttons or a dial. | |
| State Rules | |
| The decisions the handlers take, with no screen, no context and no device behind them, and the list of states itself. | |
Files | |
| file | src/ |
| FSM handler for the Wi-Fi admin portal, which also installs an update. | |
| file | src/ |
| FSM handler for the BLE HID credential-typing screen. | |
| file | src/ |
| FSM handler for the unlocked vault menu and its sub-screens. | |
| file | src/ |
| FSM handler for the hardware self-test screens. | |
| file | src/ |
| FSM handler for the unlock screen. | |
Classes | |
| class | kleidos:: |
| Hosts the WiFi soft-AP admin portal (status, QR, OTA progress) and exits to deep sleep on user request, or reboots on OTA success. More about kleidos:: | |
| class | kleidos:: |
| Brings BLE up, types the selected credential to the paired host, then tears the radio down and returns to the vault menu or deep sleep. More about kleidos:: | |
| class | kleidos:: |
| Unlocked vault menu handler; dispatches credential typing, TOTP, settings, admin entry, and the change-PIN wizard across device input layouts. More about kleidos:: | |
| class | kleidos:: |
| Cycles through boot info, button, battery, RTC, IMU, and power test screens. More about kleidos:: | |
| class | kleidos:: |
| Drives the secret's entry and the vault unlock; advances to the vault menu on success. More about kleidos:: | |