How solokeys/solo1 works
Project Type and Purpose
• This is a firmware-centric embedded/security project implementing the FIDO2 (CTAP2) and U2F (CTAP1) protocols for a USB/NFC security key (SoloKey).
• It also includes a host-side simulation application for development (Linux/Mac/Windows), build scripts, tooling, and documentation.
Key Components in the File Structure
• crypto/ → Collection of cryptographic primitives (AES-GCM, SHA-256, ECC, etc.)
• fido2/ → Core CTAP1/CTAP2 protocol implementation (APDU parsing, CTAPHID, extensions, storage)
• targets/stm32l432/→ STM32L432-specific hardware layer: startup code, HAL, USB/NFC drivers, bootloader, linker scripts
• pc/ → Host-side application (“solo” simulator) sending/receiving USB HID over UDP
• tools/ → Utility scripts (certificate generation, log conversion, USB-to-UDP shim, test helpers)
• udev/ → Linux udev rules for real hardware
• metadata/ → JSON metadata statements for FIDO2 authenticators
• builds/ → Output directory for compiled .hex files
• Dockerfile/Makefile/mkdocs.yml → Build automation, CI/CD, documentation site configuration
Architectural Patterns and Relationships
• Layered Architecture:
• Hardware Abstraction Layer (HAL) in targets/stm32l432/lib calls into peripheral drivers (USB, RNG, Flash, NFC).
• Core Protocol Layer in fido2/ implements CTAP1/2 state machines, APDU/CBOR parsing, and storage API.
• Crypto Layer in crypto/ provides primitives to the protocol layer.
• Bootloader/Application split in targets: bootloader handles firmware signing/upgrade, application runs CTAP code.
• Platform Switch: same fido2/ + crypto/ code compiles for STM32 target or PC host (pc/main.c).
• Toolchain/Build Pipeline: Makefiles orchestrate builds for embedded and host, Docker container isolates ARM toolchain, solo1 CLI scripts handle flashing.
• External Integration: python-fido2 test suite communicates over UDP (when in host mode) or USB HID (when on real hardware).