Kleidos API Search

In development. It changes without notice.

Overview

Kleidos is firmware that turns an ESP32 board into a hardware password manager. It keeps the owner's logins, one-time-code secrets and saved Wi-Fi networks in an encrypted vault on the board, opens the vault with a secret entered on the board itself, and types a login into a computer or phone paired with it, as a Bluetooth keyboard. It sends keystrokes and never receives them.

The same source builds for nine boards: Core2 v1.3, CoreInk, CoreS3 SE, LILYGO T-Deck, M5Cardputer ADV, M5StickC Plus 1.1, M5StickC Plus2, M5StickC Plus SE and M5StickS3 (The boards). The secret is a PIN or a passphrase, by board. Between uses a board sleeps or switches its supply off; which of the two depends on the board.

This is the reference of the firmware's own code, for people who want to read how it works or change it. It is not a library: nothing here is stable. It is written by Doxygen from the comments in the sources and holds no source code.

Where to read

How the parts fit together, and when each screen ends

What each board has

How a login is stored and sealed

How a secret is entered, and what a wrong one costs

What a factory reset and a vault wipe erase

Pairing with a computer or phone, and typing into it

One-time codes, and the clock they need

The Wi-Fi portal, and firmware updates

Screens, settings, and buttons, keys and touch

What a board is made of, for adding one

How all of this is tested, on a computer, on the boards and with a meter, is in How it is tested.

By module

The parts of the firmware as the topics divide it, each with what it covers. The Topics page has the parts inside each.

Entry Point & State Dispatch

The start of the firmware: the boot, in order, and the loop that runs the active state.

Application States

The states of the application, what moves it from one to the next, and the handler that runs each.

Vault Storage

The encrypted vault: how logins, one-time-code secrets and saved networks are stored, listed, changed, backed up and re-keyed.

Cryptography

From a PIN or passphrase to the keys that seal the vault, the secret bound to the chip, the seal of a backup and the password generator.

Security

The lockout after wrong secrets, which lasts through a sleep or a cut in power, the log of security events, and the rule for a new secret.

Change of Owner & Resets

What a factory reset, a vault wipe and a settings reset erase, one sequence for every way of asking for each.

One-Time Codes

Time-based one-time codes (RFC 6238): making one from the secret in the vault, and the gate that refuses when the clock cannot be trusted.

Clock & Time Zone

The wall clock and how far it is trusted, what set it last, and the time zones with their daylight-saving rules.

BLE HID Keyboard

The board as a Bluetooth keyboard: advertising, pairing, the bonded hosts, and typing.

Wi-Fi Admin Portal

The web pages the board serves to one browser over its own Wi-Fi: to edit the vault, back it up, change settings and install an update.

Network Services

The time from the network, the Wi-Fi session that fetches it, the portal's network name, and the request for the portal after a restart.

Update Policy

What a boot decides after an update: to keep the new firmware, to refuse it, or to say that the board went back to the previous one.

User Interface

Everything the screen shows: drawing, components, the unlock entry (PIN or passphrase), popups and notices, brand logos and the on-screen keyboard.

Settings Model

The options a device has, once for every surface that shows them: their groups, their values and the words for each.

Internationalization

The interface's text by name, in English, Spanish, French, German and Italian.

Brand Lookup & Logo Atlas

From the address or the name in a login to the service's logo.

Build Configuration

What the board being built has, as constants.

Hardware Abstraction Layer

What the application calls instead of a chip: display, input, power and battery, motion, sound, SD card, clock and GPS.

Device Drivers

One driver for each chip: panels, power chips, motion sensors, clock, touch, keyboards, trackball, audio and GPS.

Platform Abstraction

The facades over ESP-IDF and FreeRTOS that the firmware calls.

Utilities

Text, lists and queues that never use the heap, a checksum, and a wipe the compiler cannot drop.

JSON Reader, Writer and Binder

JSON read in pieces, written to a sink and bound to a record by a table, with no allocation.

Diagnostics

What a board reports of itself: the log's queue, memory and tasks, the time spent drawing, and an estimate of what it draws.

Serial Debug Console

The serial console of a debug build, which drives a board from a cable. No other image holds it.

QA Host Firmware

The firmware of a test host: a board that plays the computer, over Bluetooth or on the portal's Wi-Fi.

Security properties

  • Every record and file of the vault is encrypted with AES-256-CBC and authenticated with HMAC-SHA256, and the tag is checked before anything is decrypted. The keys come from a random vault key, which the secret unwraps through PBKDF2-SHA256 (Cryptography, Keys, Metadata & Rotation).
  • A secret or a tag is compared in constant time, and key material is wiped with calls the compiler cannot drop (Cryptography, Utilities).
  • No login goes into a log line, a Bluetooth advertisement or an answer the portal gives without its session token (Logging, Wi-Fi Admin Portal).
  • From the fourth wrong secret in a row the board waits 30 s between tries, from the seventh 300 s, and the tenth is a factory reset (Security, Change of Owner & Resets).
  • Bluetooth is shut down before Wi-Fi starts and before the board sleeps (BLE HID Keyboard, Application States).
  • A hardened build adds Secure Boot v2, flash encryption and a key bound to the chip, and burns the chip's fuses on its first boot, once and for good. An open build has none of the three and leaves the chip's debug port open (Build Configuration, Cryptography).

The threats behind this list, and what each is answered with, are at kleidos.dev/security.

Power

A figure is stated here only when a bench meter measured it, and only for the board it was measured on. There is one: the LILYGO T-Deck draws 3.925 ± 0.046 mA (95 %, k = 2) at 4.113 V in its production sleep. A board not measured states none. Every measurement, with how it was taken, is at kleidos.dev/measurements.

Finding a name

To find Look in
A part of the firmware Topics
A class or a record Classes
A member of a class Names
A namespace Namespaces
A function, a value or a type of a namespace Names in a namespace
A macro, or a name outside every namespace File-level names

The search at the top of every page finds any of these by its name, and the lists above are plain pages that need no script (Search).

Private members, helpers local to one source and generated tables have no page, and neither does what is compiled only in a debug build (Serial Debug Console) or into the test host (QA Host Firmware). A topic lists the headers of its part, by their path in the sources.

More