Repository navigation
Conversation
…racts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XkZEiWM4SEVB1xBTaoykRa
Each install makes an X25519 client key, kept in flutter_secure_storage. Over Bluetooth, once the device reports the phone validated, the app enrolls the key with EnrollClientKey and pins the device identity per vehicle. A different identity is never pinned silently: the dashboard shows a banner to trust it or unpair. The paired phones screen shows which phones have remote access set up. Closes #128 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XkZEiWM4SEVB1xBTaoykRa
Adds a builder for [secure_channel] in transport.toml, so the key ID length and the client label limit are imported instead of copied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XkZEiWM4SEVB1xBTaoykRa
6 of 7 tasks
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 #128. Phase 1 of OpenCarControls/contracts#44: the app gets its own client key and enrolls it with the device over Bluetooth once the phone is validated, and pins the device's identity per vehicle. Nothing uses the keys for a connection yet; the Dart secure channel session (#129) does. Needs OpenCarControls/contracts#50 (the submodule bump is its own commit and points at that PR's branch until it merges) and the firmware side, OpenCarControls/firmware#124.
lib/secure/client_key.dart): one X25519 key pair per install, made on first use, kept influtter_secure_storage(Android Keystore), never inSharedPreferences. New dependencies:cryptography(pure Dart X25519/BLAKE2s/ChaCha20-Poly1305, also used by Secure channel session in the app #129),flutter_secure_storage, anddevice_info_plusfor the label.lib/secure/device_identity.dart): only a 32-byte key whose key ID matches it is accepted. Pinned inPairedVehicleConfig(devicePublicKey,deviceKeyId), with the client key the device last accepted (enrolledClientKey), so unpairing forgets them.clientKeyEnrollmentProvider): on each Bluetooth connection (and the debug HTTP transport), once the device reports the phone validated, it lists the paired phones and sendsEnrollClientKey(kind phone, label = phone maker and model cut to 32 UTF-8 bytes) when the device doesn't list this phone with a key, no identity is pinned, or the device last accepted another key. It pins the identity from the answer. A failure waits for the next connection.SecureChannelConstantsBuildergenerateslib/secure/secure_channel_constants.g.dartfrom[secure_channel]intransport.toml, so the key ID length and label limit are imported, not copied.code-generation.md,architecture.md(new "Secure channel keys" section and providers),ble.md,ui.md(banner order),ui-screens.md.How it was tested
test/client_key_enrollment_test.dart: key made once and kept, unreadable stored key replaced, identity validation, UTF-8 label cut, enrollment after validation (and pinned identity persisted), nothing while only bonded, no re-enrollment when already enrolled, re-enrollment when the device lost the key, a different device key flagged and then trusted, a different identity in the system state, unpair forgets the identity.dart format,flutter analyze --fatal-infosand the fullflutter testpass.flutter testneededthermion_dart's native download skipped (blocked in my sandbox); that workaround is not committed.Checklist
feat:,fix:,docs:,chore:); CI validates itdart format,flutter analyze --fatal-infosandflutter testpassdocs/or README) updated if behaviour changedconfig.tomlor credentials committed; generated files not hand-editedSafety
It adds one system command sent over Bluetooth (
EnrollClientKey), only after the device reports the phone validated; the device checks validation itself too. Bonding,source_device_idand vehicle commands are unchanged. The private key never leaves the phone.https://claude.ai/code/session_01XkZEiWM4SEVB1xBTaoykRa
Generated by Claude Code