Repository navigation
Conversation
…racts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XkZEiWM4SEVB1xBTaoykRa
The trust anchor of the secure channel (contracts#44, phase 1): - core-interface: the device's X25519 identity, made once from the board's random source and restored at boot, reported with its key ID in SystemState over BLE; the client key registry, filled by EnrollClientKeyCommand from a validated phone over BLE only, dropped with the phone's bond, kept when its validation ends, persisted like the validations. ListPairedPhones reports remote_key_enrolled and the label. - ESP: identity and client keys in the access range of the flash, the identity made once the BLE controller (and so the true RNG) is up. - PC: device_identity_file and client_keys_file under [hardware.pc]. Closes #118 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XkZEiWM4SEVB1xBTaoykRa
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Michaël · project thread
What and why
Closes #118. Phase 1 of OpenCarControls/contracts#44: the device's identity key and the registry of client keys enrolled over BLE. Nothing uses the keys yet; the secure channel (#119) does. Needs OpenCarControls/contracts#50; the submodule bump is its own commit and points at that PR's branch until it merges (I'll re-pin to
mainthen).Device identity (
core-interface/src/identity.rs)restore_device_identity(stored), which returns the bytes to persist when it made a new one.ClearPairedPhones. I did not add a "factory reset" that rotates it: erasing the flash does, and phones pair again then anyway.SystemState.device_identitywith the access state, BLE only.BleConnector::new, since the RNG is only a true random source while the radio runs. PC:[hardware.pc] device_identity_file.Client key registry (
core-interface/src/client_keys.rs)EnrollClientKeyCommandhandled in the dispatcher: BLE only (MQTT drops system commands), validated phone only (REJECTED_NOT_VALIDATED), answered with the device identity. Hub kind, bad key length, all-zero key, label > 32 bytes, and a key already enrolled by another client are refused (FAILED).ble:ID; re-enrolling replaces it. Dropped with the bond:forget_phone_validation(removal, pairing again),clear_paired_phones, andprune_phone_validationsat boot (bond reset). Kept when the validation ends (another car approved).encode_client_keys/client_keys_to_store/restore_client_keys). ESP: access range key 3, its buffer raised to 768 bytes for 8 phones; a failed write rewrites every item of the range, identity first. PC:client_keys_file.ListPairedPhonesfillsremote_key_enrolledandremote_key_label.client_for_key()is the lookup for the channel.Docs:
docs/ble.md(Device identity, Client keys, Persistence),docs/architecture.md,docs/testing.md,config.toml.example.How it was tested
cargo xtask test: all host suites pass, including the newcore-interface/tests/client_keys.rs(17 tests: identity made once, restored, absent without a random source, kept across clearing phones, key ID vs. the contract vectors; enrollment refused for bonded-not-validated phones and over MQTT, replaced on re-enroll, refusals, removed with the bond / pairing again / clear / prune, kept when the validation ends, store round-trip and malformed input).cargo xtask build --board pcandcargo xtask clippy --board pcpass;cargo test -p board-esppasses.core-interface(withx25519-dalekandblake2) builds forriscv32imc-unknown-none-elf(the C3).+esptoolchain here), soboard-espwithhardware(the store and transport changes) is only checked by CI. Not tested on hardware, and I couldn't measure the flash cost on the C3/S3. A client key surviving a restart on the PC was only checked through the encoding tests, not end to end.Checklist
cargo fmt --all -- --check,cargo xtask clippy(pc) andcargo xtask testpass; ESP clippy/build left to CIconfig.toml, credentials, build artifacts or.binfiles committedSafety
Generated by Claude Code