Kleidos API Search

In development. It changes without notice.

Topic

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.

There are three views of the lists, chosen by the board's screen and keys. On the keyboard boards a panel beside the list edits a record and the settings by typing.

See also
Application States, Settings Screen & Service, Login Detail View Model

Files

file src/states/home/clock_fix_offer.h
Whether a Wi-Fi network is saved, read when a 2FA surface is entered, for the fix it offers while the TOTP gate refuses a code.
file src/states/home/cred_detail_controller.h
Credential-detail overlay collaborator for HomeStateHandler.
file src/states/home/cred_detail_epaper.cpp
The CoreInk half of CredDetailController: the identity card, its action band, and the levels the dial opens from it.
file src/states/home/cred_detail_internal.h
The constants and helpers the sources of CredDetailController share.
file src/states/home/cred_detail_stick.cpp
The Stick half of CredDetailController: the identity card, its action carousel, the more list, and the two-button input.
file src/states/home/cred_detail_three_button.cpp
The three-button half of CredDetailController: the header, identity, body and action row of the detail on the Core2 v1.3 and the CoreS3 SE, and their button and touch input.
file src/states/home/cred_row_cache.h
Shared per-row cache of the credential origin domain the list renders.
file src/states/home/epaper_vault_render.h
E-paper (1-bit) render of the wide-panel vault menu.
file src/states/home/host_select_controller.h
BLE host-picker collaborator for HomeStateHandler.
file src/states/home/keyboard_panel.h
On-device settings and credential-management panel (keyboard boards).
file src/states/home/keyboard_panel_chrome.h
The chrome the keyboard panel's drawn screens share: the standard header and the key-hint shelf.
file src/states/home/keyboard_panel_cred.cpp
The keyboard panel's credential card (part of KeyboardPanel).
file src/states/home/keyboard_panel_screens.cpp
The keyboard panel's drawn screens: the stepper, the pickers' popover and the info panels (part of KeyboardPanel).
file src/states/home/keyboard_panel_text_input.cpp
The keyboard panel's text input: the settings text entry and the field editor every typed value goes through (part of KeyboardPanel).
file src/states/home/keyboard_vault_view.h
Keyboard-board vault-menu layout (kleidos::VaultMenuView strategy).
file src/states/home/narrow_vault_view.h
Narrow-panel vault-menu layout (kleidos::VaultMenuView strategy).
file src/states/home/sd_backup_flow.h
Seal the vault into a card backup, and put one back — on every board.
file src/states/home/sd_csv_import_flow.h
Ask what an SD CSV import should do, then run it.
file src/states/home/sd_restore_report.h
What an on-device SD restore tells the owner it did to their vault.
file src/states/home/sd_result_notice.cpp
SD result notices (see sd_result_notice.h).
file src/states/home/sd_result_notice.h
The notice an SD card action leaves once it has run.
file src/states/home/totp_row_cache.h
Per-row lazy decrypt + generate cache for a vault view's TOTP list.
file src/states/home/totp_row_model.h
Pure per-row TOTP window math for a vault view's TOTP list.
file src/states/home/totp_screen_controller.h
Full-screen TOTP display collaborator for HomeStateHandler.
file src/states/home/vault_filter.h
Pure type-to-filter matching for the keyboard-board vault list.
file src/states/home/vault_menu_view.h
Device-layout strategy for the vault menu + its semantic-event seam.
file src/states/home/vault_tab_actions.h
The rows of the vault's Actions tab on the three-key vault layouts, and the label each row reads.
file src/states/home/vault_write_flow.h
Perform an on-device vault write and classify what it did.
file src/states/home/wide_vault_view.h
Wide-panel vault-menu layout (kleidos::VaultMenuView strategy).

Classes

class kleidos::states::SavedNetworkMemo
The saved-network answer a 2FA surface names its fix from. More about kleidos::states::SavedNetworkMemo
class kleidos::CredDetailController
Owns the credential-detail overlay: state, both render paths, input, the hold-progress feedback, and the decrypted credential buffers. More about kleidos::CredDetailController
struct kleidos::states::cred_detail::ThreeButtonDetailGeo
Resolved geometry of the three-button detail: the one definition its draw and its pointer read. More about kleidos::states::cred_detail::ThreeButtonDetailGeo
struct kleidos::CredRowCache
Per-row cache of the origin domain a vault list row renders. More about kleidos::CredRowCache
struct kleidos::states::EpaperVaultFrame
One frame of the ink vault menu: the active tab and its selection. More about kleidos::states::EpaperVaultFrame
struct kleidos::states::EpaperVaultScratch
Scratch buffers the ink render borrows from its owning view. More about kleidos::states::EpaperVaultScratch
class kleidos::HostSelectController
Owns the BLE host picker: state, drawing, input, animation, debug seam. More about kleidos::HostSelectController
struct kleidos::PanelServices
The services of the running application the panel uses itself. More about kleidos::PanelServices
class kleidos::KeyboardPanel
On-device settings panel controller. Manages sub-screens with their own menus and input handling. More about kleidos::KeyboardPanel
struct kleidos::states::panel::PanelChrome
The chrome every drawn panel screen shares: the standard header and the shelf. More about kleidos::states::panel::PanelChrome
class kleidos::KeyboardVaultView
Keyboard-board three-tab vault menu: render + input (keyboard, touch, trackball) for one device class, owning the KeyboardPanel sub-state and returning the FSM transition. More about kleidos::KeyboardVaultView
class kleidos::NarrowVaultView
Narrow-panel pager vault menu: render + input + animation for one screen geometry, returning the FSM transition. More about kleidos::NarrowVaultView
struct kleidos::states::sdbackup::RestoreResult
What a restore attempt found and did. More about kleidos::states::sdbackup::RestoreResult
struct kleidos::states::sdrestore::Banner
A finished restore's notice: headline, the sentence that states what happened to the vault, and the tone carrying the severity. More about kleidos::states::sdrestore::Banner
struct kleidos::TotpRowCache
Per-row cache of the currently displayed TOTP codes. More about kleidos::TotpRowCache
class kleidos::TotpScreenController
Owns the full-screen TOTP display: state, drawing, input, debug seams. More about kleidos::TotpScreenController
class kleidos::VaultMenuHost
Semantic-event seam a VaultMenuView invokes to activate a menu item; the parent HomeStateHandler implements it. More about kleidos::VaultMenuHost
class kleidos::VaultMenuView
Abstract per-device vault-menu layout: owns render + input for one device class and returns the FSM transition. More about kleidos::VaultMenuView
class kleidos::WideVaultView
Wide-panel vault menu: render + input for one screen geometry, returning the FSM transition. More about kleidos::WideVaultView

Enumerations

enum class kleidos::CredDetailOutcome : uint8_t { kleidos::CredDetailOutcome::Stay, kleidos::CredDetailOutcome::Closed, kleidos::CredDetailOutcome::TypeBle, kleidos::CredDetailOutcome::Deleted, kleidos::CredDetailOutcome::RunClockFix }
enum class kleidos::HostSelectResult : uint8_t { kleidos::HostSelectResult::Stay , kleidos::HostSelectResult::BackToMenu , kleidos::HostSelectResult::TypeBle }
Outcome of one HostSelectController::update tick. More about kleidos::HostSelectResult
enum class kleidos::PanelScreen : uint8_t { kleidos::PanelScreen::NONE, kleidos::PanelScreen::MainSettings, kleidos::PanelScreen::SettingsGroup, kleidos::PanelScreen::SettingsStepper, kleidos::PanelScreen::SettingsPicker, kleidos::PanelScreen::SettingsInfo, kleidos::PanelScreen::SettingsBleHosts, kleidos::PanelScreen::SettingsText, kleidos::PanelScreen::CredDetail, kleidos::PanelScreen::CredEditName, kleidos::PanelScreen::CredEditUser, kleidos::PanelScreen::CredEditPass, kleidos::PanelScreen::CredAdd, kleidos::PanelScreen::PASSGEN, kleidos::PanelScreen::ConfirmDelete, kleidos::PanelScreen::CredMore, kleidos::PanelScreen::CredEdit, kleidos::PanelScreen::SettingsBleHostActions, kleidos::PanelScreen::Count }
On-device sub-screen identifiers. More about kleidos::PanelScreen
enum class kleidos::PanelRequest : uint8_t { kleidos::PanelRequest::None, kleidos::PanelRequest::EnterAdmin, kleidos::PanelRequest::SdExport, kleidos::PanelRequest::SdImport, kleidos::PanelRequest::SdCsv, kleidos::PanelRequest::SdKeyfile, kleidos::PanelRequest::SdFormat, kleidos::PanelRequest::PairHost }
A settings action the panel defers to the keyboard vault view. More about kleidos::PanelRequest
enum class kleidos::states::sdbackup::ExportOutcome : uint8_t { kleidos::states::sdbackup::ExportOutcome::Written , kleidos::states::sdbackup::ExportOutcome::Cancelled , kleidos::states::sdbackup::ExportOutcome::Failed }
What an export attempt left on the card. More about kleidos::states::sdbackup::ExportOutcome
enum class kleidos::TotpScreenResult : uint8_t { kleidos::TotpScreenResult::Stay , kleidos::TotpScreenResult::BackToMenu , kleidos::TotpScreenResult::TypeBle , kleidos::TotpScreenResult::RunClockFix }
Outcome of one TotpScreenController::update tick. More about kleidos::TotpScreenResult

Functions

boolkleidos::states::vaultHasSavedNetwork (const AppContext &ctx)
Whether the unlocked vault holds at least one saved Wi-Fi network.
ui::ClockFixkleidos::states::readClockFix (kleidos::totp::Gate gate, const AppContext &ctx)
The fix to offer for gate, reading the vault now when it refuses.
voidkleidos::states::cred_detail::drawValueRows (ui::Canvas &canvas, const char *text, hal::display::Font font, int16_t x, int16_t top, int16_t maxW, int16_t lineH, std::size_t lines, uint16_t ink, uint8_t datum)
ui::HeaderPropskleidos::states::cred_detail::threeButtonHeaderShape (const ui::LayoutContext &layout)
ThreeButtonDetailGeokleidos::states::cred_detail::threeButtonDetailGeo (const ui::LayoutContext &layout)
ui::HeaderStatuskleidos::states::epaperHeaderStatus (const AppContext &ctx)
The status cluster the e-paper header draws: the battery level and the charge mark (the panel's header carries no link icon).
uint16_tkleidos::states::drawEpaperVaultMenu (const EpaperVaultFrame &frame, uint16_t prevScrollTop, EpaperVaultScratch scratch, AppContext &ctx)
Draw one full frame of the e-paper vault menu.
PanelChromekleidos::states::panel::panelChrome (const ui::LayoutContext &layout, const char *title)
The header and shelf of a drawn panel screen titled title.
ExportOutcomekleidos::states::sdbackup::runEncryptedExport (AppContext &ctx)
Ask for a passphrase, then seal the vault into the card's backup file.
voidkleidos::states::sdbackup::offerVaultWipe (AppContext &ctx)
After an export, offer to take the vault off this device.
RestoreResultkleidos::states::sdbackup::runEncryptedRestore (AppContext &ctx)
Ask for the passphrase, then put the card's backup back.
CsvImportResultkleidos::states::sdcsv::importWithOwnerAnswer (AppContext &ctx)
Run an SD CSV import, asking about passwordless rows if there are any.
constexpr boolkleidos::states::sdrestore::vaultModified (kleidos::vault::backup::ImportStatus status)
Whether the vault on flash still holds what it held before the restore.
constexpr boolkleidos::states::sdrestore::attemptIsFinal (kleidos::vault::backup::ImportStatus status)
Whether a finished .kexp attempt settles the passphrase prompt.
constexpr boolkleidos::states::sdrestore::attemptIsFinal (kleidos::vault::backup::ImportStatus status, bool opened, bool tried)
Whether a finished .kexp attempt settles the passphrase prompt, told also whether the passphrase was tried and whether the envelope opened.
constexpr boolkleidos::states::sdrestore::partialVerdict (kleidos::vault::backup::ImportStatus status)
Whether a finished restore replaced the vault with only part of the backup.
Bannerkleidos::states::sdrestore::bannerFor (kleidos::vault::backup::ImportStatus status)
Notice for a finished .kexp restore, in the active language.
const char *kleidos::states::sdrestore::overCapacityQuestion (const kleidos::vault::backup::RestoreTally &tally, char *out, size_t cap)
The question a backup bigger than this device asks before any write: what it holds, what fits, and where the owner can choose instead.
const char *kleidos::states::sdrestore::leftOutDetail (const kleidos::vault::backup::RestoreTally &tally, char *out, size_t cap)
The detail line of a restore that left entries out: how many of each.
const char *kleidos::states::sdrestore::noticeDetail (kleidos::vault::backup::ImportStatus status, const kleidos::vault::backup::RestoreTally &tally, const Banner &report, char *out, size_t cap)
The line under a finished restore's headline.
voidkleidos::states::sdnotice::show (i18n::StringId title, ui::popup::Severity sev, const char *detail=nullptr)
Show an SD result.
voidkleidos::states::sdnotice::showCsv (const CsvImportResult &result)
Show what a CSV import put in the vault: the counts, and a full vault by name, so an import that stopped short does not read as the whole file.
voidkleidos::states::sdnotice::showRestore (kleidos::vault::backup::ImportStatus status, const kleidos::vault::backup::RestoreTally &tally={})
Show what a .kexp restore did to the vault (kleidos::states::sdrestore::bannerFor), with how many entries were left out when the device filled up before the backup ended.
uint64_tkleidos::states::totpStepIndex (uint64_t epoch, uint16_t period)
RFC 6238 step index (epoch / period) of a TOTP window.
boolkleidos::states::totpRowNeedsRefresh (bool loaded, uint64_t cachedStep, uint64_t epoch, uint16_t period)
Whether a cached row code must be re-generated for epoch.
constexpr uint8_tkleidos::states::totpSteppedRemaining (uint8_t remaining)
Seconds left in a window, floored to a whole e-paper step.
constexpr uint64_tkleidos::states::totpEpaperStepKey (uint64_t epoch, uint16_t period)
A key that changes exactly when an e-paper TOTP row must repaint.
constexpr uint16_tkleidos::states::totpSharedPeriod (std::span< const uint16_t > periods)
The period most of periods share, the first one on a tie.
boolkleidos::states::vaultFilterMatches (const char *name, const char *filter)
Case-insensitive substring test of filter against name.
template<typename NameAt>
uint16_tkleidos::states::buildVaultFilterMap (uint16_t count, const char *filter, NameAt &&nameAt, uint16_t *out, uint16_t outCap)
Build a filtered visible-row → entry-index map.
constexpr std::span< const VaultAction >kleidos::states::vaultTabActions (bool hasLockKey)
The Actions-tab rows of a board.
constexpr i18n::StringIdkleidos::states::vaultTabActionLabel (VaultAction action)
The label an Actions-tab row reads.
SaveOutcomekleidos::states::writeflow::saveCredentialInSlot (const uint8_t *key, uint16_t slot, const Credential &cred)
Store cred into an existing slot.
SaveOutcomekleidos::states::writeflow::createCredential (const uint8_t *key, const Credential &cred, uint16_t &slotOut)
Store cred into the first free slot.
DeleteOutcomekleidos::states::writeflow::deleteCredentialAt (uint16_t slot)
Remove the credential in slot.
DeleteOutcomekleidos::states::writeflow::deleteTotpAt (uint8_t slot)
Remove the TOTP entry in slot.

Variables

constexpr const char *kleidos::states::cred_detail::kTag
Log tag of the credential detail.
constexpr int16_tkleidos::states::cred_detail::kDetailFooterReserveH
constexpr intkleidos::states::cred_detail::kValueRowsMax
constexpr int16_tkleidos::states::cred_detail::kThreeButtonActionBtnH
Height of the three-button layout's action button.
constexpr int16_tkleidos::states::cred_detail::kThreeButtonActionBtnGap
Gap between that button and the footer under it.
constexpr uint8_tkleidos::kBrandCacheLen
Domain cache length per credential (bytes, NUL included).
CredRowCachekleidos::s_credRowCache
The one session row cache, stored out of line so its PLACEMENT can be decided independently of its owner.
constexpr uint8_tkleidos::kPanelMaxChoices
constexpr uint8_tkleidos::kNoCardFocus
The credential card with no button focused (the trackball has not moved).
std::array< ui::MenuItemDesc, kMaxCredentials+kMaxTotp >kleidos::s_narrowMenuItems
Backing store for NarrowVaultView::narrowMenuItems_.
constexpr size_tkleidos::states::sdrestore::kNoticeDetailBytes
constexpr uint32_tkleidos::states::sdnotice::kNoticeMs
How long an SD result stays up (ms).
constexpr uint32_tkleidos::states::sdnotice::kCountsNoticeMs
How long a result carrying counts the owner has to read stays up (ms).
constexpr uint16_tkleidos::states::kEpaperTotpStepSec
constexpr uint8_tkleidos::states::kVaultFilterMaxLen
Maximum characters retained in the type-to-filter query buffer.
constexpr uint8_tkleidos::states::kVaultFilterCap
NUL-inclusive capacity of the query buffer (kVaultFilterMaxLen + 1).
constexpr autokleidos::states::kVaultTabActions
Every Actions-tab row, in order; Lock is always last.
std::array< ui::MenuItemDesc, kMaxCredentials >kleidos::s_wideMenuItems
Backing store for WideVaultView::menuItems_.

Back to the top

Enumeration Type Documentation

CredDetailOutcome #

enum class kleidos::CredDetailOutcome : uint8_t

Outcome of one CredDetailController::update tick. The parent maps this to the vault-menu FSM transition and the repaint it calls for.

Enumerator
Stay 

Remain in the overlay (or sleep was requested in place).

Closed 

Back to the vault list without delete; parent repaints the menu.

TypeBle 

Type action: credential staged into ctx.vault.bleCredential; caller types it.

Deleted 

Credential deleted; parent reloads the list + repaints the menu.

RunClockFix 

The 2FA code was asked for while the TOTP gate refuses one: the detail closed; the parent runs CredDetailController::clockFixRequest's fix and opens the credential again when it is done.

ExportOutcome #

enum class kleidos::states::sdbackup::ExportOutcome : uint8_t

What an export attempt left on the card.

Enumerator
Written 

The envelope is on the card, sealed under the owner's passphrase.

Cancelled 

The owner backed out, or the prompt idled; nothing was written.

Failed 

The passphrase was long enough, but the card did not take the file.

HostSelectResult #

enum class kleidos::HostSelectResult : uint8_t

Outcome of one HostSelectController::update tick.

Enumerator
Stay 

Remain on the host picker (or sleep was requested in place).

BackToMenu 

B-back / debug-mock select: leave the picker for the vault list.

TypeBle 

A-long / OK hold: target host set; the caller starts the radio.

PanelRequest #

enum class kleidos::PanelRequest : uint8_t

A settings action the panel defers to the keyboard vault view.

The panel cannot enter admin mode (an FSM transition) or run the SD Data & Backup flows on its own; it raises one of these and the vault view dispatches the shared handler.

Enumerator
None 

No pending request.

EnterAdmin 

Open the WiFi-AP admin portal.

SdExport 

Encrypted vault export to SD.

SdImport 

Encrypted vault restore from SD.

SdCsv 

CSV credential import from SD.

SdKeyfile 

SD key-file 2FA management.

SdFormat 

Format the SD card.

PairHost 

Open Settings' add-host page (the view owns its radio).

PanelScreen #

enum class kleidos::PanelScreen : uint8_t

On-device sub-screen identifiers.

Enumerator
NONE 

Not active.

MainSettings 

Root: the settings group list.

SettingsGroup 

A settings group's option list (from the presenter).

SettingsStepper 

Keyboard +/- editor for a stepper-backed option.

SettingsPicker 

Single-select list for a picker-backed option.

SettingsInfo 

Read-only info panel for an info option.

SettingsBleHosts 

BLE bonded hosts list.

SettingsText 

Typed text entry for a settings field (name/SSID/PSK/NTP).

CredDetail 

The credential card: identity block + key-shortcut buttons.

CredEditName 

Edit credential name field.

CredEditUser 

Edit credential username field.

CredEditPass 

Edit credential password field.

CredAdd 

Add new credential (name -> user -> pass).

PASSGEN 

Password generator.

ConfirmDelete 

Delete confirmation.

CredMore 

The rest of the open record (URL, fields, codes, notes).

CredEdit 

Edit the open record (name, username, password, delete).

SettingsBleHostActions 

One BLE host's actions: move up / down, delete.

Count 

Sentinel: how many screens exist. Never a value.

TotpScreenResult #

enum class kleidos::TotpScreenResult : uint8_t

Outcome of one TotpScreenController::update tick.

Enumerator
Stay 

Remain on the TOTP screen (or sleep was requested in place).

BackToMenu 

B-long, or 2FA codes turned off: leave for the vault list.

TypeBle 

A-long / dial OK hold: code staged in ctx.vault.bleCredential.

RunClockFix 

The same hold (Enter on a keyboard board) while the TOTP gate refuses a code: the screen closed; run TotpScreenController::clockFix.

Back to the top

Function Documentation

attemptIsFinal() [1/2] #

bool kleidos::states::sdrestore::attemptIsFinal(kleidos::vault::backup::ImportStatus status)
constexpr

Whether a finished .kexp attempt settles the passphrase prompt.

A separate question from vaultModified, and the two answers differ on exactly one outcome. vaultModified asks what happened to the vault, which decides the relock and the wipe record. The prompt asks whether typing the secret again can produce a different answer, and only an attempt that was refused before the envelope was opened can: every other outcome — including a backup whose counts exceed this device's slots, and one whose content this firmware does not read — is what the same file produces every time it is fed to this device, so re-asking for the passphrase renders a correct secret as a wrong one and never terminates.

Parameters
NameDirectionMeaning
statusinOutcome of a .kexp restore.
Return values
ValueMeaning
trueThe prompt has its answer; render the banner.
falseAnother attempt can land somewhere else.

attemptIsFinal() [2/2] #

bool kleidos::states::sdrestore::attemptIsFinal(kleidos::vault::backup::ImportStatus status, bool opened, bool tried)
constexpr

Whether a finished .kexp attempt settles the passphrase prompt, told also whether the passphrase was tried and whether the envelope opened.

attemptIsFinal answers from the outcome alone, and one outcome cannot say it: Rejected is a passphrase that failed the first chunk, an envelope that opened under it before this device refused the restore for reasons of its own (a buffer held elsewhere, an anchor that would not commit), and a refusal that came before the passphrase was tried at all (no backup on the card, no memory, a card that stopped inside the header, a file that is not the one the question was about). Only the first is worth typing again: asking for the passphrase over the others calls a passphrase wrong that no one ever checked, or one that was right.

Parameters
NameDirectionMeaning
statusinOutcome of a .kexp restore.
openedinA chunk of the envelope authenticated under the passphrase.
triedinThe passphrase was tried against the envelope's header.
Return values
ValueMeaning
trueThe prompt has its answer; render the banner.
falseAnother attempt can land somewhere else.

bannerFor() #

Banner kleidos::states::sdrestore::bannerFor(kleidos::vault::backup::ImportStatus status)
inline

Notice for a finished .kexp restore, in the active language.

Parameters
NameDirectionMeaning
statusinOutcome of SdVault::importVaultEncrypted.
Returns
The notice to show.

buildVaultFilterMap() #

template<typename NameAt>
uint16_t kleidos::states::buildVaultFilterMap(uint16_t count, const char * filter, NameAt && nameAt, uint16_t * out, uint16_t outCap)

Build a filtered visible-row → entry-index map.

Walks the count entries in list order, fetches each name via nameAt, and appends the original index of every entry that matches filter into out (bounded by outCap). The result preserves list order and is strictly ascending, so a scroll window over it maps back to a contiguous-min/max entry span. An empty filter yields the identity mapping (every index in order).

Template Parameters
NameMeaning
NameAtCallable const char*(uint16_t) returning entry i's name.
Parameters
NameDirectionMeaning
countinNumber of source entries.
filterinQuery buffer (NUL-terminated); empty ⇒ identity.
nameAtinName accessor for a source index.
outoutDestination map (row → entry index).
outCapinCapacity of out.
Returns
Number of visible rows written to out.

createCredential() #

ui::popup::writereport::SaveOutcome kleidos::states::writeflow::createCredential(const uint8_t * key, const Credential & cred, uint16_t & slotOut)
nodiscard

Store cred into the first free slot.

The slot search and the write share one vault session, and slotOut is written only when the record committed — a caller that binds its edit id to a free slot the search merely offered goes on to render a record that is on no filesystem.

Parameters
NameDirectionMeaning
keyinVault key of the unlocked vault.
credinRecord to store.
slotOutoutReceives the slot on success; untouched otherwise.
Returns
kleidos::ui::popup::writereport::SaveOutcome::VaultFull when no slot was free.

deleteCredentialAt() #

ui::popup::writereport::DeleteOutcome kleidos::states::writeflow::deleteCredentialAt(uint16_t slot)
nodiscard

Remove the credential in slot.

Parameters
NameDirectionMeaning
slotinSlot id to remove.
Returns
kleidos::ui::popup::writereport::DeleteOutcome::Deleted only when the record went.

deleteTotpAt() #

ui::popup::writereport::DeleteOutcome kleidos::states::writeflow::deleteTotpAt(uint8_t slot)
nodiscard

Remove the TOTP entry in slot.

Parameters
NameDirectionMeaning
slotinTOTP slot id to remove.
Returns
kleidos::ui::popup::writereport::DeleteOutcome::Deleted only when the entry went.

drawEpaperVaultMenu() #

uint16_t kleidos::states::drawEpaperVaultMenu(const EpaperVaultFrame & frame, uint16_t prevScrollTop, EpaperVaultScratch scratch, AppContext & ctx)

Draw one full frame of the e-paper vault menu.

Renders header + tab strip + the active tab's list + action bar into a bracketed frame. The e-paper driver's damage diff collapses an unchanged repaint to no panel traffic, so the caller may repaint the whole frame on every state change.

Parameters
NameDirectionMeaning
frameinActive tab / selection / item count.
prevScrollTopinThe tab's scroll window top from the last frame.
scratchin, outBorrowed row buffer + shared row caches.
ctxin, outApplication context (menu model, power, clock).
Returns
The new sticky scroll-window top for the active tab.

drawValueRows() #

void kleidos::states::cred_detail::drawValueRows(ui::Canvas & canvas, const char * text, hal::display::Font font, int16_t x, int16_t top, int16_t maxW, int16_t lineH, std::size_t lines, uint16_t ink, uint8_t datum)

Draw text broken into lines rows of at most maxW at font, lineH apart from top, each at x by datum (kTopLeft: its top-left corner; kMiddleCenter: its center, within its line). The rows break at the value's seams (ui::text_wrap::wrapValue): only a value longer than every row together has its last one cut.

Parameters
NameMeaning
canvasThe canvas to draw on.
textThe value to draw.
fontThe font of every row.
xThe x each row is drawn at.
topThe top of the first row.
maxWThe widest a row may be, in pixels.
lineHThe pitch between rows, in pixels.
linesThe most rows to draw (at most kValueRowsMax).
inkThe RGB565 color of the text.
datumThe text datum each row is drawn by.

epaperHeaderStatus() #

ui::HeaderStatus kleidos::states::epaperHeaderStatus(const AppContext & ctx)

The status cluster the e-paper header draws: the battery level and the charge mark (the panel's header carries no link icon).

Parameters
NameDirectionMeaning
ctxinApplication context (the battery sample).
Returns
The status drawEpaperVaultMenu draws in the header.

importWithOwnerAnswer() #

CsvImportResult kleidos::states::sdcsv::importWithOwnerAnswer(AppContext & ctx)

Run an SD CSV import, asking about passwordless rows if there are any.

Blocks while the question is on screen. When the export carries no passwordless row nothing is asked and the import starts straight away.

Parameters
NameDirectionMeaning
ctxinUnlocked application context; its vault key drives the write.
Returns
The import tally, including how many rows were skipped for want of a password and how many got a generated one.
Note
Must be called from the task that owns the display.

leftOutDetail() #

const char * kleidos::states::sdrestore::leftOutDetail(const kleidos::vault::backup::RestoreTally & tally, char * out, size_t cap)
inline

The detail line of a restore that left entries out: how many of each.

Parameters
NameDirectionMeaning
tallyinThe restore's counts.
outoutBuffer for the line.
capinBytes of out.
Returns
out holding the counts when some entry was left out, or null when none was (the banner's own detail then stands).

noticeDetail() #

const char * kleidos::states::sdrestore::noticeDetail(kleidos::vault::backup::ImportStatus status, const kleidos::vault::backup::RestoreTally & tally, const Banner & report, char * out, size_t cap)
inline

The line under a finished restore's headline.

On every partial answer a restore that also ran out of room says how many entries it left out: a restore that dropped entries this build does not read, or one a write failed in, can ALSO have filled the device, and its own verdict outranks the left-out one, so the counts would otherwise be told on no surface. Each partial answer has a headline of its own (incomplete, entries dropped, restored until full), so the counts can take the line under it without the answers reading alike.

Parameters
NameDirectionMeaning
statusinOutcome of a .kexp restore.
tallyinIts counts.
reportinThe banner bannerFor gave status.
outoutBuffer for the counts line, kNoticeDetailBytes to hold the longest one.
capinBytes of out.
Returns
The counts in out, or report's own detail when nothing was left out.

offerVaultWipe() #

void kleidos::states::sdbackup::offerVaultWipe(AppContext & ctx)

After an export, offer to take the vault off this device.

Whoever just put their vault on a card may be moving it to another device or handing this one on, and the copy that stays behind is the one they did not ask for. So it is offered once, here, where the backup is known to exist, and declined by default: the offer resolves as "keep" on cancel, on timeout, and on any dismissal.

Accepting leads to the same destructive confirm the settings wipe uses (a sustained press, never a tap) and then to the wipe itself, which restarts the device and does not return.

Parameters
NameDirectionMeaning
ctxin, outApplication context (buttons, audio).
Note
Only ever called after ExportOutcome::Written: never offer to destroy a vault whose backup did not land.

overCapacityQuestion() #

const char * kleidos::states::sdrestore::overCapacityQuestion(const kleidos::vault::backup::RestoreTally & tally, char * out, size_t cap)
inline

The question a backup bigger than this device asks before any write: what it holds, what fits, and where the owner can choose instead.

The body of the confirm the restore raises on DoesNotFit (sd_backup_flow.cpp): how many passwords and one-time codes the backup holds, how many of them — the first, in the backup's order — this device stores, and the admin portal, where the owner picks which ones come over.

Parameters
NameDirectionMeaning
tallyinThe refused attempt's counts.
outoutBuffer for the sentence.
capinBytes of out.
Returns
out.

panelChrome() #

PanelChrome kleidos::states::panel::panelChrome(const ui::LayoutContext & layout, const char * title)
inline

The header and shelf of a drawn panel screen titled title.

Parameters
NameDirectionMeaning
layoutinResponsive context.
titleinThe header's title.
Returns
The chrome's bands.

partialVerdict() #

bool kleidos::states::sdrestore::partialVerdict(kleidos::vault::backup::ImportStatus status)
constexpr

Whether a finished restore replaced the vault with only part of the backup.

Parameters
NameDirectionMeaning
statusinOutcome of a .kexp restore.
Return values
ValueMeaning
trueOne of the three partial answers.
falseA whole restore, or one that wrote nothing.

readClockFix() #

ui::ClockFix kleidos::states::readClockFix(kleidos::totp::Gate gate, const AppContext & ctx)

The fix to offer for gate, reading the vault now when it refuses.

For a surface that offers the fix only in answer to a press (the credential detail's 2FA action): the read runs once, for that press.

Parameters
NameDirectionMeaning
gateinThe TOTP gate's verdict.
ctxinApplication context (the saved-network read).
Returns
ui::ClockFix::None for a passing gate or codes turned off (no vault read), else ui::clockFixFor for this board.

runEncryptedExport() #

ExportOutcome kleidos::states::sdbackup::runEncryptedExport(AppContext & ctx)

Ask for a passphrase, then seal the vault into the card's backup file.

The passphrase is typed on the keyboard boards and, through the on-screen keyboard, on the others. It is chosen, not generated, because whoever made the backup has to type it again on whatever device the card is carried to, and it is never derived from the PIN: an envelope travels off-device, where an attacker guesses offline, so it carries its own high-iteration KDF.

A passphrase under the envelope's floor is refused by the seal itself and the prompt stays open for another try. A passphrase the seal accepted and a write that then failed ends the prompt instead: retyping cannot make a card take a file it just refused.

Blocks while the prompt is on screen. The passphrase is zeroized by the entry UI after each attempt and never logged.

Parameters
NameDirectionMeaning
ctxin, outUnlocked application context; its session key seals the file.
Returns
What the attempt left on the card.
Note
Must be called from the task that owns the display.

runEncryptedRestore() #

RestoreResult kleidos::states::sdbackup::runEncryptedRestore(AppContext & ctx)

Ask for the passphrase, then put the card's backup back.

The envelope carries the records that were sealed, whichever device sealed them, and they replace what this device holds. The PIN does not travel: see the file comment. On anything that reached the vault this files the non-repudiation record and drops the cached credential list; the caller relocks, and the unlock asks for THIS device's secret, never the one the backup was taken under.

A wrong passphrase leaves the vault untouched and the prompt open. An attempt that authenticated ends the prompt whatever it did to the vault, because no retyping changes an envelope this device cannot hold.

A backup that holds more than this device stores is never refused for good: the first open writes nothing and the screen says how many it holds, how many fit and that the admin portal lets the choice be made there. Going on opens the envelope again under the same passphrase — kept for that one question, wiped on every way out — and takes the backup's entries in its own order until the device is full; the notice then says how many were left out.

Parameters
NameDirectionMeaning
ctxin, outApplication context; its vault session and caches are reset.
Returns
Whether a backup was found, and what the attempt did.
Note
Must be called from the task that owns the display.

saveCredentialInSlot() #

ui::popup::writereport::SaveOutcome kleidos::states::writeflow::saveCredentialInSlot(const uint8_t * key, uint16_t slot, const Credential & cred)
nodiscard

Store cred into an existing slot.

Parameters
NameDirectionMeaning
keyinVault key of the unlocked vault.
slotinSlot id to overwrite.
credinRecord to store.
Returns
kleidos::ui::popup::writereport::SaveOutcome::Saved only when the record is on flash.

show() #

void kleidos::states::sdnotice::show(i18n::StringId title, ui::popup::Severity sev, const char * detail = nullptr)

Show an SD result.

Parameters
NameDirectionMeaning
titleinWhat the action did.
sevinIts tone.
detailinThe line under the title, or null for none.

showCsv() #

void kleidos::states::sdnotice::showCsv(const CsvImportResult & result)

Show what a CSV import put in the vault: the counts, and a full vault by name, so an import that stopped short does not read as the whole file.

Parameters
NameDirectionMeaning
resultinThe import tally.

showRestore() #

void kleidos::states::sdnotice::showRestore(kleidos::vault::backup::ImportStatus status, const kleidos::vault::backup::RestoreTally & tally = {})

Show what a .kexp restore did to the vault (kleidos::states::sdrestore::bannerFor), with how many entries were left out when the device filled up before the backup ended.

Parameters
NameDirectionMeaning
statusinOutcome of the restore.
tallyinIts counts; on every partial answer the left-out ones replace the banner's detail (kleidos::states::sdrestore::noticeDetail).

threeButtonDetailGeo() #

ThreeButtonDetailGeo kleidos::states::cred_detail::threeButtonDetailGeo(const ui::LayoutContext & layout)

The three-button detail's geometry.

Parameters
NameMeaning
layoutThe active display layout.
Returns
The header height, the text column's edge and the touch rects.

threeButtonHeaderShape() #

ui::HeaderProps kleidos::states::cred_detail::threeButtonHeaderShape(const ui::LayoutContext & layout)

The three-button detail's header as far as geometry goes: its title, and on the touch-control boards the back chip.

Parameters
NameMeaning
layoutThe active display layout.
Returns
The header props, with no status cluster.

totpEpaperStepKey() #

uint64_t kleidos::states::totpEpaperStepKey(uint64_t epoch, uint16_t period)
constexpr

A key that changes exactly when an e-paper TOTP row must repaint.

It moves on at every kEpaperTotpStepSec step into a window and at every window roll, and never goes back, so a sum of keys over several rows changes whenever any one of them does.

Parameters
NameDirectionMeaning
epochinUnix time in seconds.
periodinWindow length in seconds (read through kleidos::totp::clampPeriod).
Returns
The step count since the epoch, counted per window.

totpRowNeedsRefresh() #

bool kleidos::states::totpRowNeedsRefresh(bool loaded, uint64_t cachedStep, uint64_t epoch, uint16_t period)
inline

Whether a cached row code must be re-generated for epoch.

A never-loaded row always refreshes; a loaded row refreshes only when the step index rolled past the cached one.

Parameters
NameDirectionMeaning
loadedinTrue when the row holds a previously generated code.
cachedStepinStep index the cached code was generated for.
epochinCurrent Unix time in seconds.
periodinRow window length in seconds.
Return values
ValueMeaning
trueThe cached code is stale (or absent) — regenerate.
falseThe cached code is still the current window's code.

totpSharedPeriod() #

uint16_t kleidos::states::totpSharedPeriod(std::span< const uint16_t > periods)
constexpr

The period most of periods share, the first one on a tie.

The TOTP list shows one countdown for the rows that share it and keeps a ring of their own only on the rows that do not.

Parameters
NameDirectionMeaning
periodsinThe periods of the rows on screen (each read through kleidos::totp::clampPeriod).
Returns
The shared period; kleidos::totp::kPeriod30 for an empty list.

totpStepIndex() #

uint64_t kleidos::states::totpStepIndex(uint64_t epoch, uint16_t period)
inline

RFC 6238 step index (epoch / period) of a TOTP window.

Parameters
NameDirectionMeaning
epochinUnix time in seconds.
periodinWindow length in seconds (read through kleidos::totp::clampPeriod).
Returns
The step counter the code is derived from.

totpSteppedRemaining() #

uint8_t kleidos::states::totpSteppedRemaining(uint8_t remaining)
constexpr

Seconds left in a window, floored to a whole e-paper step.

Floors rather than rounds, so a countdown that moves in steps never shows more time than is left.

Parameters
NameDirectionMeaning
remaininginSeconds left in the current window.
Returns
remaining floored to a multiple of kEpaperTotpStepSec.

vaultFilterMatches() #

bool kleidos::states::vaultFilterMatches(const char * name, const char * filter)

Case-insensitive substring test of filter against name.

ASCII-lowercases both operands on the fly (no allocation, no locale). An empty or null filter matches everything (the unfiltered list); a null name matches nothing.

Parameters
NameDirectionMeaning
nameinCandidate display name (NUL-terminated).
filterinQuery buffer (NUL-terminated); empty ⇒ match all.
Return values
ValueMeaning
truefilter occurs as a substring of name (case-insensitive).
falseNo match.

vaultHasSavedNetwork() #

bool kleidos::states::vaultHasSavedNetwork(const AppContext & ctx)

Whether the unlocked vault holds at least one saved Wi-Fi network.

Reads only the count; no network record is decrypted into the caller's memory. Mounts the vault store for the read.

Parameters
NameDirectionMeaning
ctxinApplication context (the unlocked vault's key).
Returns
True when at least one network is stored; false while the vault is locked or the store cannot be read.

vaultModified() #

bool kleidos::states::sdrestore::vaultModified(kleidos::vault::backup::ImportStatus status)
constexpr

Whether the vault on flash still holds what it held before the restore.

The load-bearing question for the user-facing report, so it is answered by naming the outcomes that DID write rather than by excluding the ones that did not: a new outcome then reads as untouched until someone decides otherwise, which is the safe direction for the callers that relock the session and file a wipe record on a true.

Parameters
NameDirectionMeaning
statusinOutcome of a .kexp restore.
Return values
ValueMeaning
trueThe vault was rewritten (fully or partly).
falseNothing was written.

vaultTabActionLabel() #

i18n::StringId kleidos::states::vaultTabActionLabel(VaultAction action)
constexpr

The label an Actions-tab row reads.

Parameters
NameDirectionMeaning
actioninThe row's action.
Returns
Its string id (the settings title for actions that are not tab rows).

vaultTabActions() #

std::span< const VaultAction > kleidos::states::vaultTabActions(bool hasLockKey)
constexpr

The Actions-tab rows of a board.

Parameters
NameDirectionMeaning
hasLockKeyinTrue when the board has a dedicated lock key.
Returns
Every row, without the trailing Lock row when hasLockKey.

Back to the top

Variable Documentation

kBrandCacheLen #

uint8_t kleidos::kBrandCacheLen
inlineconstexpr

Domain cache length per credential (bytes, NUL included).

Fitted to the only value ever stored here: the index's domain column, an InplaceString<kleidos::vault::kIndexDomainLen> of 24 characters, so 25 bytes hold it whole. The static_assert in the implementation pins the relation. Each byte here is kMaxCredentials bytes of static DRAM.

kDetailFooterReserveH #

int16_t kleidos::states::cred_detail::kDetailFooterReserveH
inlineconstexpr

Reserved footer-shelf band height used to size the content safe-area above the action bar: a fixed 26 px band, so the content geometry is the same whatever ui::drawActionBar draws in it.

kEpaperTotpStepSec #

uint16_t kleidos::states::kEpaperTotpStepSec
inlineconstexpr

Seconds between the steps of an e-paper TOTP countdown: a 1-bit panel shows the time left in whole steps instead of refreshing every second.

kNoticeDetailBytes #

size_t kleidos::states::sdrestore::kNoticeDetailBytes
inlineconstexpr

Bytes the line under a restore's headline is built in, NUL included: the most a notice's detail keeps (popup::kTransitionDetailMax).

kPanelMaxChoices #

uint8_t kleidos::kPanelMaxChoices
inlineconstexpr

Most choices the keyboard panel's picker popover holds (the longest list is the keyboard layouts).

kValueRowsMax #

int kleidos::states::cred_detail::kValueRowsMax
inlineconstexpr

Most lines one value of a credential card (the username, the host or URL, the "Also stored" sentence) takes before its last line is cut.

kVaultFilterMaxLen #

uint8_t kleidos::states::kVaultFilterMaxLen
inlineconstexpr

Maximum characters retained in the type-to-filter query buffer.

Names are at most kMaxNameLen (32) chars; a query longer than the longest name can never match, so this cap only bounds the buffer and the on-screen echo — it never hides a reachable credential.

s_credRowCache #

CredRowCache kleidos::s_credRowCache
extern

The one session row cache, stored out of line so its PLACEMENT can be decided independently of its owner.

HomeStateHandler holds this by reference. It cannot be a plain member: a section attribute applies to a whole VARIABLE, never to one member, so parking the cache in external RAM as a member would have required tagging the enclosing handler — which also owns the decrypted credential detail buffer (password + notes + embedded TOTP secret), the change-PIN wizard's new PIN and the masked text editor's WiFi passphrase. Splitting the capacity-scaled caches out keeps the external-RAM offload limited to list-surface plaintext.

Warning
SECURITY: origin domains only. Never widen this cache with password, PIN, passphrase or TOTP-secret material: the cache may sit in external RAM, which leaves the die.
See also
wipeCredRowCache, CredRowCache::reset

s_narrowMenuItems #

std::array<ui::MenuItemDesc, kMaxCredentials + kMaxTotp> kleidos::s_narrowMenuItems
extern

Backing store for NarrowVaultView::narrowMenuItems_.

Out of line, and held by reference by the view, so this ONE variable carries the external-RAM placement instead of the enclosing HomeStateHandler: a section attribute applies to a whole variable, and the handler also owns the decrypted credential detail buffer, the change-PIN wizard and the masked text editor, none of which may leave the die. The descriptors themselves hold only pointers into already list-surface storage (entry names, the domain cache) plus render flags — no string storage, no secret.

See also
s_credRowCache, KLEIDOS_EXT_RAM_BSS_DEFINE

s_wideMenuItems #

std::array<ui::MenuItemDesc, kMaxCredentials> kleidos::s_wideMenuItems
extern

Backing store for WideVaultView::menuItems_.

Same rationale, security boundary and lifetime as s_narrowMenuItems. A separate variable per layout, and only the one the board declared is linked: a narrow board never carries this array and a wide board never carries the narrow one.

Back to the top