From 0e3bffdb5c0745b45fd6068f152c319a274aebc5 Mon Sep 17 00:00:00 2001 From: Brett Adams Date: Sun, 2 Aug 2026 21:57:42 +1000 Subject: [PATCH] Remove vendored protobuf sources; @teslemetry/tesla-protocol is sole source The library already imported all protobuf types from @teslemetry/tesla-protocol; protobuf/*.proto and createPb2.sh were leftover, unreferenced vendored copies. --- AGENTS.md | 2 +- createPb2.sh | 7 - protobuf/car_server.proto | 443 ------------------------------- protobuf/common.proto | 56 ---- protobuf/errors.proto | 22 -- protobuf/keys.proto | 16 -- protobuf/signatures.proto | 84 ------ protobuf/universal_message.proto | 95 ------- protobuf/vcsec.proto | 290 -------------------- protobuf/vehicle.proto | 23 -- 10 files changed, 1 insertion(+), 1037 deletions(-) delete mode 100755 createPb2.sh delete mode 100644 protobuf/car_server.proto delete mode 100644 protobuf/common.proto delete mode 100644 protobuf/errors.proto delete mode 100644 protobuf/keys.proto delete mode 100644 protobuf/signatures.proto delete mode 100644 protobuf/universal_message.proto delete mode 100644 protobuf/vcsec.proto delete mode 100644 protobuf/vehicle.proto diff --git a/AGENTS.md b/AGENTS.md index 12e095c..52f147d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,7 +3,7 @@ This file is the project's committed home for project-intrinsic agent knowledge: build, test, release, architecture, and sharp-edge notes that should travel with the code. - Add durable project-specific notes here as they are discovered through real work. -- Tesla protobuf types (`RoutableMessage`, `vcsec`, `car_server`, `signatures`, `keys`, ...) come from the published `@teslemetry/tesla-protocol` package (subpaths like `@teslemetry/tesla-protocol/command/signatures`), not a bundled `src/pb2`. It is ts-proto generated: plain-object messages with `Type.create(partial)` / `Type.encode(msg).finish()` / `Type.decode(bytes)`, not the old `google-protobuf` `.setX()`/`.serializeBinary()` style. +- Tesla protobuf types (`RoutableMessage`, `vcsec`, `car_server`, `signatures`, `keys`, ...) come from the published `@teslemetry/tesla-protocol` package (subpaths like `@teslemetry/tesla-protocol/command/signatures`), not a bundled `src/pb2`. It is ts-proto generated: plain-object messages with `Type.create(partial)` / `Type.encode(msg).finish()` / `Type.decode(bytes)`, not the old `google-protobuf` `.setX()`/`.serializeBinary()` style. There is no vendored `protobuf/*.proto` or generator script in this repo anymore - `@teslemetry/tesla-protocol` is the sole source of these types. - `tsconfig.json` must keep `"module": "NodeNext"` / `"moduleResolution": "NodeNext"`. Dependencies like `@teslemetry/tesla-protocol` gate access behind a package.json `exports` map with per-subpath types; classic/ESNext resolution can't see those subpaths and every scoped-package import (even `@types/node` internals) fails to resolve. - `pnpm install` (which runs `tsc` via the `prepare` script) is the build gate; run `npx tsc --noEmit` to typecheck without emitting. `pnpm test` runs the vitest suite under `test/` - `tsconfig.json`'s `include` only covers `src/**.ts`, so test files never ship in `dist` and don't need to satisfy the library's own module settings beyond what vitest's esbuild transform requires. - The signed-command layer is split the same way as `python-tesla-fleet-api`: `src/commands.ts` (`Commands`, abstract) builds and HMAC-signs every vehicle command into a `RoutableMessage` and dispatches it through one abstract seam, `_send`; `src/vehiclesigned.ts` (`VehicleSigned`, concrete) fills that seam over the cloud `/signed_command` HTTP endpoint. A future BLE transport (Story 3) is meant to be another concrete subclass of `Commands`, not a change to it. `src/signing/session.ts` holds the per-domain (VCSEC/Infotainment) handshake + HMAC session state; `src/signing/crypto.ts` holds the raw ECDH/SHA-1 key derivation; `src/signing/errors.ts` holds the fault-error taxonomy that drives `Commands`' bounded WAIT/epoch-fault retry. Only HMAC-personalized signing is implemented - AES-GCM personalized signing is BLE-only and was left out of this story. Every command a signing-required vehicle would reject on the plaintext endpoint must be overridden in `Commands` so it is signed rather than silently inherited unsigned from `VehicleSpecific`: `take_drivenote` (`takeDrivenoteAction`) and `upcoming_calendar_entries` (`uiSetUpcomingCalendarEntries`) are signed Infotainment actions here, matching `python-tesla-fleet-api`. `test/helpers/fakevehicle.ts` is a from-scratch reimplementation of the vehicle side of the protocol (independent HMAC verification, not just a mock) used to round-trip-test the client against a second implementation of the same wire format. diff --git a/createPb2.sh b/createPb2.sh deleted file mode 100755 index ba00823..0000000 --- a/createPb2.sh +++ /dev/null @@ -1,7 +0,0 @@ -protoc \ - --plugin="protoc-gen-ts=./node_modules/.bin/protoc-gen-ts" \ - --js_out="import_style=commonjs,binary:src/pb2" \ - --ts_out="src/pb2" \ - --ts_opt="esModuleInterop=true" \ - -I=protobuf \ - protobuf/*.proto diff --git a/protobuf/car_server.proto b/protobuf/car_server.proto deleted file mode 100644 index aae3686..0000000 --- a/protobuf/car_server.proto +++ /dev/null @@ -1,443 +0,0 @@ -syntax = "proto3"; - -package CarServer; - -option java_package = "com.tesla.generated.carserver.server"; -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/carserver"; - -import "vehicle.proto"; -import "signatures.proto"; -import "common.proto"; -import "google/protobuf/timestamp.proto"; - -message Action { - reserved 3 to 5; - oneof action_msg { - VehicleAction vehicleAction = 2; - } -} - -message VehicleAction { - reserved 11; - reserved 60; - reserved 76; - oneof vehicle_action_msg { - ChargingSetLimitAction chargingSetLimitAction = 5; - ChargingStartStopAction chargingStartStopAction = 6; - DrivingClearSpeedLimitPinAction drivingClearSpeedLimitPinAction = 7; - DrivingSetSpeedLimitAction drivingSetSpeedLimitAction = 8; - DrivingSpeedLimitAction drivingSpeedLimitAction = 9; - HvacAutoAction hvacAutoAction = 10; - HvacSetPreconditioningMaxAction hvacSetPreconditioningMaxAction = 12; - HvacSteeringWheelHeaterAction hvacSteeringWheelHeaterAction = 13; - HvacTemperatureAdjustmentAction hvacTemperatureAdjustmentAction = 14; - MediaPlayAction mediaPlayAction = 15; - MediaUpdateVolume mediaUpdateVolume = 16; - MediaNextFavorite mediaNextFavorite = 17; - MediaPreviousFavorite mediaPreviousFavorite = 18; - MediaNextTrack mediaNextTrack = 19; - MediaPreviousTrack mediaPreviousTrack = 20; - GetNearbyChargingSites getNearbyChargingSites = 23; - VehicleControlCancelSoftwareUpdateAction vehicleControlCancelSoftwareUpdateAction = 25; - VehicleControlFlashLightsAction vehicleControlFlashLightsAction = 26; - VehicleControlHonkHornAction vehicleControlHonkHornAction = 27; - VehicleControlResetValetPinAction vehicleControlResetValetPinAction = 28; - VehicleControlScheduleSoftwareUpdateAction vehicleControlScheduleSoftwareUpdateAction = 29; - VehicleControlSetSentryModeAction vehicleControlSetSentryModeAction = 30; - VehicleControlSetValetModeAction vehicleControlSetValetModeAction = 31; - VehicleControlSunroofOpenCloseAction vehicleControlSunroofOpenCloseAction = 32; - VehicleControlTriggerHomelinkAction vehicleControlTriggerHomelinkAction = 33; - VehicleControlWindowAction vehicleControlWindowAction = 34; - HvacBioweaponModeAction hvacBioweaponModeAction = 35; - HvacSeatHeaterActions hvacSeatHeaterActions = 36; - ScheduledChargingAction scheduledChargingAction = 41; - ScheduledDepartureAction scheduledDepartureAction = 42; - SetChargingAmpsAction setChargingAmpsAction = 43; - HvacClimateKeeperAction hvacClimateKeeperAction = 44; - Ping ping = 46; - AutoSeatClimateAction autoSeatClimateAction = 48; - HvacSeatCoolerActions hvacSeatCoolerActions = 49; - SetCabinOverheatProtectionAction setCabinOverheatProtectionAction = 50; - SetVehicleNameAction setVehicleNameAction = 54; - ChargePortDoorClose chargePortDoorClose = 61; - ChargePortDoorOpen chargePortDoorOpen = 62; - VehicleState.GuestMode guestModeAction = 65; - SetCopTempAction setCopTempAction = 66; - EraseUserDataAction eraseUserDataAction = 72; - VehicleControlSetPinToDriveAction vehicleControlSetPinToDriveAction = 77; - VehicleControlResetPinToDriveAction vehicleControlResetPinToDriveAction = 78; - ChargeSchedule addChargeScheduleAction = 97; - RemoveChargeScheduleAction removeChargeScheduleAction = 98; - PreconditionSchedule addPreconditionScheduleAction = 99; - RemovePreconditionScheduleAction removePreconditionScheduleAction = 100; - BatchRemovePreconditionSchedulesAction batchRemovePreconditionSchedulesAction = 107; - BatchRemoveChargeSchedulesAction batchRemoveChargeSchedulesAction = 108; - } -} - -message EraseUserDataAction { - string reason = 1; -} - -message Response { - ActionStatus actionStatus = 1; - oneof response_msg { - Signatures.SessionInfo getSessionInfoResponse = 3; - NearbyChargingSites getNearbyChargingSites = 5; - Ping ping = 9; - } -} - -message ActionStatus { - OperationStatus_E result = 1; - ResultReason result_reason = 2; -} - -enum OperationStatus_E -{ - OPERATIONSTATUS_OK = 0; - OPERATIONSTATUS_ERROR = 1; -} - -message ResultReason { - oneof reason { - string plain_text = 1; - } -} - -message EncryptedData { - int32 field_number = 1; - bytes ciphertext = 2; - - bytes tag = 3; -} - -message ChargingSetLimitAction { - int32 percent = 1; -} - -message ChargingStartStopAction { - oneof charging_action { - Void unknown = 1; - Void start = 2; - Void start_standard = 3; - Void start_max_range = 4; - Void stop = 5; - } -} - -message DrivingClearSpeedLimitPinAction { - string pin = 1; -} - -message DrivingSetSpeedLimitAction { - double limit_mph = 1; -} - -message DrivingSpeedLimitAction { - bool activate = 1; - string pin = 2; -} - -message HvacAutoAction { - bool power_on = 1; - bool manual_override = 2; -} - -message HvacSeatHeaterActions { - message HvacSeatHeaterAction { - oneof seat_heater_level { - Void SEAT_HEATER_UNKNOWN = 1; - Void SEAT_HEATER_OFF = 2; - Void SEAT_HEATER_LOW = 3; - Void SEAT_HEATER_MED = 4; - Void SEAT_HEATER_HIGH = 5; - } - oneof seat_position { - Void CAR_SEAT_UNKNOWN = 6; - Void CAR_SEAT_FRONT_LEFT = 7; - Void CAR_SEAT_FRONT_RIGHT = 8; - Void CAR_SEAT_REAR_LEFT = 9; - Void CAR_SEAT_REAR_LEFT_BACK = 10; - Void CAR_SEAT_REAR_CENTER = 11; - Void CAR_SEAT_REAR_RIGHT = 12; - Void CAR_SEAT_REAR_RIGHT_BACK = 13; - Void CAR_SEAT_THIRD_ROW_LEFT = 14; - Void CAR_SEAT_THIRD_ROW_RIGHT = 15; - } - } - - repeated HvacSeatHeaterAction hvacSeatHeaterAction = 1; -} - -message HvacSeatCoolerActions { - enum HvacSeatCoolerLevel_E { - HvacSeatCoolerLevel_Unknown = 0; - HvacSeatCoolerLevel_Off = 1; - HvacSeatCoolerLevel_Low = 2; - HvacSeatCoolerLevel_Med = 3; - HvacSeatCoolerLevel_High = 4; - } - enum HvacSeatCoolerPosition_E { - HvacSeatCoolerPosition_Unknown = 0; - HvacSeatCoolerPosition_FrontLeft = 1; - HvacSeatCoolerPosition_FrontRight = 2; - } - message HvacSeatCoolerAction { - HvacSeatCoolerLevel_E seat_cooler_level = 1; - HvacSeatCoolerPosition_E seat_position = 2; - } - repeated HvacSeatCoolerAction hvacSeatCoolerAction = 1; -} - -message HvacSetPreconditioningMaxAction { - bool on = 1; - bool manual_override = 2; - enum ManualOverrideMode_E { - DogMode = 0; - Soc = 1; - Doors = 2; - } - repeated ManualOverrideMode_E manual_override_mode = 3; -} - -message HvacSteeringWheelHeaterAction { - bool power_on = 1; -} - -message HvacTemperatureAdjustmentAction { - message Temperature { - oneof type { - Void TEMP_UNKNOWN = 1; - Void TEMP_MIN = 2; - Void TEMP_MAX = 3; - } - } - message HvacTemperatureZone { - oneof type { - Void TEMP_ZONE_UNKNOWN = 1; - Void TEMP_ZONE_FRONT_LEFT = 2; - Void TEMP_ZONE_FRONT_RIGHT = 3; - Void TEMP_ZONE_REAR = 4; - } - } - float delta_celsius = 1; - sint32 delta_percent = 2; - float absolute_celsius = 3; - Temperature level = 5; - repeated HvacTemperatureZone hvac_temperature_zone = 4; - float driver_temp_celsius = 6; - float passenger_temp_celsius = 7; -} - -message GetNearbyChargingSites { - bool include_meta_data = 1; - int32 radius = 2; - int32 count = 3; -} - -message NearbyChargingSites { - google.protobuf.Timestamp timestamp = 1; - repeated Superchargers superchargers = 3; - int64 congestion_sync_time_utc_secs = 4; -} - -message Superchargers { - int64 id = 1; - string amenities = 2; - int32 available_stalls = 3; - string billing_info = 4; - string billing_time = 5; - string city = 6; - string country = 7; - float distance_miles = 8; - string district = 9; - LatLong location = 10; - string name = 11; - string postal_code = 12; - bool site_closed = 13; - string state = 14; - string street_address = 15; - int32 total_stalls = 16; - bool within_range = 17; - int32 max_power_kw = 18; - int32 out_of_order_stalls_number = 19; - string out_of_order_stalls_names = 20; -} - -message MediaPlayAction { -} - -message MediaUpdateVolume{ - reserved 2; - oneof media_volume { - sint32 volume_delta = 1; - float volume_absolute_float = 3; - } -} - -message MediaNextFavorite { -} - -message MediaPreviousFavorite{ -} - -message MediaNextTrack { -} - -message MediaPreviousTrack{ -} - -message VehicleControlCancelSoftwareUpdateAction { -} - -message VehicleControlFlashLightsAction { -} - -message VehicleControlHonkHornAction { -} - -message VehicleControlResetValetPinAction { -} - -message VehicleControlScheduleSoftwareUpdateAction { - int32 offset_sec = 1; -} - -message VehicleControlSetSentryModeAction { - bool on = 1; -} - -message VehicleControlSetValetModeAction { - bool on = 1; - string password = 2; -} - -message VehicleControlSunroofOpenCloseAction { - oneof sunroof_level { - int32 absolute_level = 1; - sint32 delta_level = 2; - } - - oneof action { - Void vent = 3; - Void close = 4; - Void open = 5; - } -} - -message VehicleControlTriggerHomelinkAction { - LatLong location = 1; - string token = 2; -} - -message VehicleControlWindowAction { - reserved 1; // Location not required for vehicles that support this protocol. - oneof action { - Void unknown = 2; - Void vent = 3; - Void close = 4; - } -} - -message HvacBioweaponModeAction { - bool on = 1; - bool manual_override = 2; -} - -message AutoSeatClimateAction { - enum AutoSeatPosition_E { - AutoSeatPosition_Unknown = 0; - AutoSeatPosition_FrontLeft = 1; - AutoSeatPosition_FrontRight = 2; - } - message CarSeat { - bool on = 1; - AutoSeatPosition_E seat_position = 2; - } - repeated CarSeat carseat = 1; -} - -message Ping { - int32 ping_id = 1; - google.protobuf.Timestamp local_timestamp = 2; - google.protobuf.Timestamp last_remote_timestamp = 3; -} - -message ScheduledChargingAction { - bool enabled = 1; - int32 charging_time = 2; -} - -message ScheduledDepartureAction { - bool enabled = 1; - int32 departure_time = 2; - PreconditioningTimes preconditioning_times = 3; - OffPeakChargingTimes off_peak_charging_times = 4; - int32 off_peak_hours_end_time = 5; -} - -message HvacClimateKeeperAction { - enum ClimateKeeperAction_E - { - ClimateKeeperAction_Off = 0; - ClimateKeeperAction_On = 1; - ClimateKeeperAction_Dog = 2; - ClimateKeeperAction_Camp = 3; - } - - ClimateKeeperAction_E ClimateKeeperAction = 1; - bool manual_override = 2; -} - - -message SetChargingAmpsAction { - int32 charging_amps = 1; -} - -message RemoveChargeScheduleAction { - uint64 id = 1; // datetime in epoch time -} - -message BatchRemoveChargeSchedulesAction { - bool home = 1; - bool work = 2; - bool other = 3; // Delete non-home and non-work charge schedules -} - -message BatchRemovePreconditionSchedulesAction { - bool home = 1; - bool work = 2; - bool other = 3; // Delete non-home and non-work precondition schedules -} - -message RemovePreconditionScheduleAction { - uint64 id = 1; // datetime in epoch time -} - -message SetCabinOverheatProtectionAction { - bool on = 1; - bool fan_only = 2; -} - -message SetVehicleNameAction { - string vehicleName = 1; -} - -message ChargePortDoorClose { -} - -message ChargePortDoorOpen { -} - -message SetCopTempAction { - ClimateState.CopActivationTemp copActivationTemp = 1; -} - -message VehicleControlSetPinToDriveAction { - bool on = 1; - string password = 2; -} - -message VehicleControlResetPinToDriveAction { -} diff --git a/protobuf/common.proto b/protobuf/common.proto deleted file mode 100644 index b51ea05..0000000 --- a/protobuf/common.proto +++ /dev/null @@ -1,56 +0,0 @@ -syntax = "proto3"; - -package CarServer; - -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/carserver"; -option java_package = "com.tesla.generated.carserver.common"; - -enum Invalid { - INVALID = 0; -} - -message Void {} - -message LatLong { - float latitude = 1; - float longitude = 2; -} - -message PreconditioningTimes { - oneof times { - Void all_week = 1; - Void weekdays = 2; - } -} - -message OffPeakChargingTimes { - oneof times { - Void all_week = 1; - Void weekdays = 2; - } -} - -message ChargeSchedule { - uint64 id = 1; // datetime in epoch time - string name = 2; - int32 days_of_week = 3; - bool start_enabled = 4; - int32 start_time = 5; // 24h in minutes - bool end_enabled = 6; - int32 end_time = 7; // 24h in minutes - bool one_time = 8; - bool enabled = 9; - float latitude = 10; - float longitude = 11; -} - -message PreconditionSchedule { - uint64 id = 1; // datetime in epoch time - string name = 2; - int32 days_of_week = 3; - int32 precondition_time = 4; // 24h in minutes - bool one_time = 5; - bool enabled = 6; - float latitude = 7; - float longitude = 8; -} diff --git a/protobuf/errors.proto b/protobuf/errors.proto deleted file mode 100644 index 238996b..0000000 --- a/protobuf/errors.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; - -package Errors; - -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/errors"; -option java_package = "com.tesla.generated.errors"; - -enum GenericError_E -{ - GENERICERROR_NONE = 0; - GENERICERROR_UNKNOWN = 1; - GENERICERROR_CLOSURES_OPEN = 2; - GENERICERROR_ALREADY_ON = 3; - GENERICERROR_DISABLED_FOR_USER_COMMAND = 4; - GENERICERROR_VEHICLE_NOT_IN_PARK = 5; - GENERICERROR_UNAUTHORIZED = 6; - GENERICERROR_NOT_ALLOWED_OVER_TRANSPORT = 7; -} - -message NominalError { - GenericError_E genericError = 1; -} diff --git a/protobuf/keys.proto b/protobuf/keys.proto deleted file mode 100644 index 76103d4..0000000 --- a/protobuf/keys.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package Keys; -option java_package = "com.tesla.generated.keys"; -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/keys"; - -enum Role -{ - ROLE_NONE = 0; - ROLE_SERVICE = 1; - ROLE_OWNER = 2; - ROLE_DRIVER = 3; - ROLE_FM = 4; - ROLE_VEHICLE_MONITOR = 5; - ROLE_CHARGING_MANAGER = 6; -} diff --git a/protobuf/signatures.proto b/protobuf/signatures.proto deleted file mode 100644 index b22a591..0000000 --- a/protobuf/signatures.proto +++ /dev/null @@ -1,84 +0,0 @@ -syntax = "proto3"; - -package Signatures; - -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/signatures"; -option java_package = "com.tesla.generated.signatures"; - -enum Tag -{ - TAG_SIGNATURE_TYPE = 0; - TAG_DOMAIN = 1; - TAG_PERSONALIZATION = 2; - TAG_EPOCH = 3; - TAG_EXPIRES_AT = 4; - TAG_COUNTER = 5; - TAG_CHALLENGE = 6; - TAG_FLAGS = 7; - TAG_END = 255; -} - -enum SignatureType -{ - SIGNATURE_TYPE_AES_GCM = 0; - SIGNATURE_TYPE_AES_GCM_PERSONALIZED = 5; - SIGNATURE_TYPE_HMAC = 6; - reserved 7; - SIGNATURE_TYPE_HMAC_PERSONALIZED = 8; -} - -message KeyIdentity { - reserved 2; - oneof identity_type { - bytes public_key = 1; - uint32 handle = 3; - } -} - -message AES_GCM_Personalized_Signature_Data { - bytes epoch = 1; - bytes nonce = 2; - uint32 counter = 3; - fixed32 expires_at = 4; - bytes tag = 5; -} - -message HMAC_Signature_Data { - bytes tag = 1; -} - -message HMAC_Personalized_Signature_Data { - bytes epoch = 1; - uint32 counter = 2; - fixed32 expires_at = 3; - bytes tag = 4; -} - -message SignatureData { - reserved 7; - KeyIdentity signer_identity = 1; - oneof sig_type { - AES_GCM_Personalized_Signature_Data AES_GCM_Personalized_data = 5; - HMAC_Signature_Data session_info_tag = 6; - HMAC_Personalized_Signature_Data HMAC_Personalized_data = 8; - } -} - -message GetSessionInfoRequest { - KeyIdentity key_identity = 1; -} - -enum Session_Info_Status { - SESSION_INFO_STATUS_OK = 0; - SESSION_INFO_STATUS_KEY_NOT_ON_WHITELIST = 1; -} - - -message SessionInfo { - uint32 counter = 1; - bytes publicKey = 2; - bytes epoch = 3; - fixed32 clock_time = 4; - Session_Info_Status status = 5; - uint32 handle = 6; -} diff --git a/protobuf/universal_message.proto b/protobuf/universal_message.proto deleted file mode 100644 index 4b46739..0000000 --- a/protobuf/universal_message.proto +++ /dev/null @@ -1,95 +0,0 @@ -syntax = "proto3"; - -package UniversalMessage; - -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/universalmessage"; -option java_package = "com.tesla.generated.universalmessage"; - -import "signatures.proto"; - -enum Domain { - DOMAIN_BROADCAST = 0; - DOMAIN_VEHICLE_SECURITY = 2; - DOMAIN_INFOTAINMENT = 3; -} - -message Destination { - oneof sub_destination{ - Domain domain = 1; - bytes routing_address = 2; - } -} - -enum OperationStatus_E -{ - OPERATIONSTATUS_OK = 0; - OPERATIONSTATUS_WAIT = 1; - OPERATIONSTATUS_ERROR = 2; -} - -enum MessageFault_E -{ - MESSAGEFAULT_ERROR_NONE = 0; // Request succeeded. - MESSAGEFAULT_ERROR_BUSY = 1; // Required vehicle subsystem is busy. Try again. - MESSAGEFAULT_ERROR_TIMEOUT = 2; // Vehicle subsystem did not respond. Try again. - MESSAGEFAULT_ERROR_UNKNOWN_KEY_ID = 3; // Vehicle did not recognize the key used to authorize command. Make sure your key is paired with the vehicle. - MESSAGEFAULT_ERROR_INACTIVE_KEY = 4; // Key used to authorize command has been disabled. - MESSAGEFAULT_ERROR_INVALID_SIGNATURE = 5; // Command signature/MAC is incorrect. Use included session info to update session and try again. - MESSAGEFAULT_ERROR_INVALID_TOKEN_OR_COUNTER = 6; // Command anti-replay counter has been used before. Use included session info to update session and try again. - MESSAGEFAULT_ERROR_INSUFFICIENT_PRIVILEGES = 7; // User is not authorized to execute command. This can be because of the role or because of vehicle state. - MESSAGEFAULT_ERROR_INVALID_DOMAINS = 8; // Command was malformed or addressed to an unrecognized vehicle system. May indicate client error or older vehicle firmware. - MESSAGEFAULT_ERROR_INVALID_COMMAND = 9; // Unrecognized command. May indicate client error or unsupported vehicle firmware. - MESSAGEFAULT_ERROR_DECODING = 10; // Could not parse command. Indicates client error. - MESSAGEFAULT_ERROR_INTERNAL = 11; // Internal vehicle error. Try again. Most commonly encountered when the vehicle has not finished booting. - MESSAGEFAULT_ERROR_WRONG_PERSONALIZATION = 12; // Command sent to wrong VIN. - MESSAGEFAULT_ERROR_BAD_PARAMETER = 13; // Command was malformed or used a deprecated parameter. - MESSAGEFAULT_ERROR_KEYCHAIN_IS_FULL = 14; // Vehicle's keychain is full. You must delete a key before you can add another. - MESSAGEFAULT_ERROR_INCORRECT_EPOCH = 15; // Session ID mismatch. Use included session info to update session and try again. - MESSAGEFAULT_ERROR_IV_INCORRECT_LENGTH = 16; // Initialization Value length is incorrect (AES-GCM must use 12-byte IVs). Indicates a client programming error. - MESSAGEFAULT_ERROR_TIME_EXPIRED = 17; // Command expired. Use included session info to determine if clocks have desynchronized and try again. - MESSAGEFAULT_ERROR_NOT_PROVISIONED_WITH_IDENTITY = 18; // Vehicle has not been provisioned with a VIN and may require service. - MESSAGEFAULT_ERROR_COULD_NOT_HASH_METADATA = 19; // Internal vehicle error. - MESSAGEFAULT_ERROR_TIME_TO_LIVE_TOO_LONG = 20; // Vehicle rejected command because its expiration time was too far in the future. This is a security precaution. - MESSAGEFAULT_ERROR_REMOTE_ACCESS_DISABLED = 21; // The vehicle owner has disabled Mobile access. - MESSAGEFAULT_ERROR_REMOTE_SERVICE_ACCESS_DISABLED = 22; // The command was authorized with a Service key, but the vehicle has not been configured to permit remote service commands. - MESSAGEFAULT_ERROR_COMMAND_REQUIRES_ACCOUNT_CREDENTIALS = 23; // The command requires proof of Tesla account credentials but was not sent over a channel that provides this proof. Resend the command using Fleet API. -} - -message MessageStatus -{ - OperationStatus_E operation_status = 1; - MessageFault_E signed_message_fault = 2; -} - -message SessionInfoRequest -{ - bytes public_key = 1; - bytes challenge = 2; -} - -enum Flags { - FLAG_USER_COMMAND = 0; -} - -message RoutableMessage { - reserved 1 to 5; - reserved 16 to 40; - reserved 11; - Destination to_destination = 6; - Destination from_destination = 7; - - oneof payload { - bytes protobuf_message_as_bytes = 10; - SessionInfoRequest session_info_request = 14; - bytes session_info = 15; - } - - oneof sub_sigData { - Signatures.SignatureData signature_data = 13; - } - - MessageStatus signedMessageStatus = 12; - bytes request_uuid = 50; - bytes uuid = 51; - uint32 flags = 52; -} diff --git a/protobuf/vcsec.proto b/protobuf/vcsec.proto deleted file mode 100644 index df24473..0000000 --- a/protobuf/vcsec.proto +++ /dev/null @@ -1,290 +0,0 @@ -syntax = "proto3"; - -package VCSEC; -option java_package = "com.tesla.generated.vcsec"; -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/vcsec"; - -import "keys.proto"; -import "errors.proto"; - -enum SignatureType -{ - SIGNATURE_TYPE_NONE = 0; - SIGNATURE_TYPE_PRESENT_KEY = 2; -} - -message SignedMessage { - bytes protobufMessageAsBytes = 2; - SignatureType signatureType = 3; -} - -message ToVCSECMessage { - SignedMessage signedMessage = 1; -} - -message KeyIdentifier { - bytes publicKeySHA1 = 1; -} - -enum KeyFormFactor -{ - KEY_FORM_FACTOR_UNKNOWN = 0; - KEY_FORM_FACTOR_NFC_CARD = 1; - KEY_FORM_FACTOR_IOS_DEVICE = 6; - KEY_FORM_FACTOR_ANDROID_DEVICE = 7; - KEY_FORM_FACTOR_CLOUD_KEY = 9; -} - -message KeyMetadata -{ - KeyFormFactor keyFormFactor = 1; -} - -message PublicKey { - bytes PublicKeyRaw = 1; -} - -enum InformationRequestType { - INFORMATION_REQUEST_TYPE_GET_STATUS = 0; - INFORMATION_REQUEST_TYPE_GET_WHITELIST_INFO = 5; - INFORMATION_REQUEST_TYPE_GET_WHITELIST_ENTRY_INFO = 6; -} - -message WhitelistInfo { - uint32 numberOfEntries = 1; - repeated KeyIdentifier whitelistEntries = 2; - uint32 slotMask = 3; -} - -message WhitelistEntryInfo { - KeyIdentifier keyId = 1; - PublicKey publicKey = 2; - KeyMetadata metadataForKey = 4; - uint32 slot = 6; - Keys.Role keyRole = 7; -} - -message InformationRequest { - InformationRequestType informationRequestType = 1; - oneof key { - KeyIdentifier keyId = 2; - bytes publicKey = 3; - uint32 slot = 4; - } -} - -enum RKEAction_E { - RKE_ACTION_UNLOCK = 0; - RKE_ACTION_LOCK = 1; - RKE_ACTION_REMOTE_DRIVE = 20; - RKE_ACTION_AUTO_SECURE_VEHICLE = 29; - RKE_ACTION_WAKE_VEHICLE = 30; -} - -enum ClosureMoveType_E{ - - CLOSURE_MOVE_TYPE_NONE = 0; - CLOSURE_MOVE_TYPE_MOVE = 1; - CLOSURE_MOVE_TYPE_STOP = 2; - CLOSURE_MOVE_TYPE_OPEN = 3; - CLOSURE_MOVE_TYPE_CLOSE = 4; -} - -message ClosureMoveRequest { - ClosureMoveType_E frontDriverDoor = 1; - ClosureMoveType_E frontPassengerDoor = 2; - ClosureMoveType_E rearDriverDoor = 3; - ClosureMoveType_E rearPassengerDoor = 4; - ClosureMoveType_E rearTrunk = 5; - ClosureMoveType_E frontTrunk = 6; - ClosureMoveType_E chargePort = 7; - ClosureMoveType_E tonneau = 8; -} - -message PermissionChange { - PublicKey key = 1; - uint32 secondsToBeActive = 3; - Keys.Role keyRole = 4; -} - -message ReplaceKey { - oneof keyToReplace - { - PublicKey publicKeyToReplace = 1; - uint32 slotToReplace = 2; - } - PublicKey keyToAdd = 3; - Keys.Role keyRole = 4; - bool impermanent = 5; -} - -message WhitelistOperation { - oneof sub_message { - PublicKey addPublicKeyToWhitelist = 1; - PublicKey removePublicKeyFromWhitelist = 2; - PermissionChange addPermissionsToPublicKey = 3; - PermissionChange removePermissionsFromPublicKey = 4; - PermissionChange addKeyToWhitelistAndAddPermissions = 5; - PermissionChange updateKeyAndPermissions = 7; - PermissionChange addImpermanentKey = 8; - PermissionChange addImpermanentKeyAndRemoveExisting = 9; - bool removeAllImpermanentKeys = 16; - - ReplaceKey replaceKey = 17; - } - KeyMetadata metadataForKey = 6; -} - -enum OperationStatus_E -{ - OPERATIONSTATUS_OK = 0; - OPERATIONSTATUS_WAIT = 1; - OPERATIONSTATUS_ERROR = 2; -} - -enum SignedMessage_information_E -{ - SIGNEDMESSAGE_INFORMATION_NONE = 0; - SIGNEDMESSAGE_INFORMATION_FAULT_UNKNOWN = 1; - SIGNEDMESSAGE_INFORMATION_FAULT_NOT_ON_WHITELIST = 2; - SIGNEDMESSAGE_INFORMATION_FAULT_IV_SMALLER_THAN_EXPECTED = 3; - SIGNEDMESSAGE_INFORMATION_FAULT_INVALID_TOKEN = 4; - SIGNEDMESSAGE_INFORMATION_FAULT_TOKEN_AND_COUNTER_INVALID = 5; - SIGNEDMESSAGE_INFORMATION_FAULT_AES_DECRYPT_AUTH = 6; - SIGNEDMESSAGE_INFORMATION_FAULT_ECDSA_INPUT = 7; - SIGNEDMESSAGE_INFORMATION_FAULT_ECDSA_SIGNATURE = 8; - SIGNEDMESSAGE_INFORMATION_FAULT_LOCAL_ENTITY_START = 9; - SIGNEDMESSAGE_INFORMATION_FAULT_LOCAL_ENTITY_RESULT = 10; - SIGNEDMESSAGE_INFORMATION_FAULT_COULD_NOT_RETRIEVE_KEY = 11; - SIGNEDMESSAGE_INFORMATION_FAULT_COULD_NOT_RETRIEVE_TOKEN = 12; - SIGNEDMESSAGE_INFORMATION_FAULT_SIGNATURE_TOO_SHORT = 13; - SIGNEDMESSAGE_INFORMATION_FAULT_TOKEN_IS_INCORRECT_LENGTH = 14; - SIGNEDMESSAGE_INFORMATION_FAULT_INCORRECT_EPOCH = 15; - SIGNEDMESSAGE_INFORMATION_FAULT_IV_INCORRECT_LENGTH = 16; - SIGNEDMESSAGE_INFORMATION_FAULT_TIME_EXPIRED = 17; - SIGNEDMESSAGE_INFORMATION_FAULT_NOT_PROVISIONED_WITH_IDENTITY = 18; - SIGNEDMESSAGE_INFORMATION_FAULT_COULD_NOT_HASH_METADATA = 19; -} - -enum WhitelistOperation_information_E -{ - WHITELISTOPERATION_INFORMATION_NONE = 0; - WHITELISTOPERATION_INFORMATION_UNDOCUMENTED_ERROR = 1; - WHITELISTOPERATION_INFORMATION_NO_PERMISSION_TO_REMOVE_ONESELF = 2; - WHITELISTOPERATION_INFORMATION_KEYFOB_SLOTS_FULL = 3; - WHITELISTOPERATION_INFORMATION_WHITELIST_FULL = 4; - WHITELISTOPERATION_INFORMATION_NO_PERMISSION_TO_ADD = 5; - WHITELISTOPERATION_INFORMATION_INVALID_PUBLIC_KEY = 6; - WHITELISTOPERATION_INFORMATION_NO_PERMISSION_TO_REMOVE = 7; - WHITELISTOPERATION_INFORMATION_NO_PERMISSION_TO_CHANGE_PERMISSIONS = 8; - WHITELISTOPERATION_INFORMATION_ATTEMPTING_TO_ELEVATE_OTHER_ABOVE_ONESELF = 9; - WHITELISTOPERATION_INFORMATION_ATTEMPTING_TO_DEMOTE_SUPERIOR_TO_ONESELF = 10; - WHITELISTOPERATION_INFORMATION_ATTEMPTING_TO_REMOVE_OWN_PERMISSIONS = 11; - WHITELISTOPERATION_INFORMATION_PUBLIC_KEY_NOT_ON_WHITELIST = 12; - WHITELISTOPERATION_INFORMATION_ATTEMPTING_TO_ADD_KEY_THAT_IS_ALREADY_ON_THE_WHITELIST = 13; - WHITELISTOPERATION_INFORMATION_NOT_ALLOWED_TO_ADD_UNLESS_ON_READER = 14; - WHITELISTOPERATION_INFORMATION_FM_MODIFYING_OUTSIDE_OF_F_MODE = 15; - WHITELISTOPERATION_INFORMATION_FM_ATTEMPTING_TO_ADD_PERMANENT_KEY = 16; - WHITELISTOPERATION_INFORMATION_FM_ATTEMPTING_TO_REMOVE_PERMANENT_KEY = 17; - WHITELISTOPERATION_INFORMATION_KEYCHAIN_WHILE_FS_FULL = 18; - WHITELISTOPERATION_INFORMATION_ATTEMPTING_TO_ADD_KEY_WITHOUT_ROLE = 19; - WHITELISTOPERATION_INFORMATION_ATTEMPTING_TO_ADD_KEY_WITH_SERVICE_ROLE = 20; - WHITELISTOPERATION_INFORMATION_NON_SERVICE_KEY_ATTEMPTING_TO_ADD_SERVICE_TECH = 21; - WHITELISTOPERATION_INFORMATION_SERVICE_KEY_ATTEMPTING_TO_ADD_SERVICE_TECH_OUTSIDE_SERVICE_MODE = 22; -} - -message WhitelistOperation_status -{ - WhitelistOperation_information_E whitelistOperationInformation = 1; - KeyIdentifier signerOfOperation = 2; - OperationStatus_E operationStatus = 3; -} - -message SignedMessage_status -{ - uint32 counter = 1; - SignedMessage_information_E signedMessageInformation = 2; -} - -message CommandStatus -{ - OperationStatus_E operationStatus = 1; - oneof sub_message { - SignedMessage_status signedMessageStatus = 2; - WhitelistOperation_status whitelistOperationStatus = 3; - } -} - -message UnsignedMessage { - reserved 6,7,10,12,13; - oneof sub_message { - InformationRequest InformationRequest = 1; - RKEAction_E RKEAction = 2; - ClosureMoveRequest closureMoveRequest = 4; - WhitelistOperation WhitelistOperation = 16; - } -} - -enum ClosureState_E { - CLOSURESTATE_CLOSED = 0; - CLOSURESTATE_OPEN = 1; - CLOSURESTATE_AJAR = 2; - CLOSURESTATE_UNKNOWN = 3; - CLOSURESTATE_FAILED_UNLATCH = 4; - CLOSURESTATE_OPENING = 5; - CLOSURESTATE_CLOSING = 6; -} - -enum VehicleLockState_E { - VEHICLELOCKSTATE_UNLOCKED = 0; - VEHICLELOCKSTATE_LOCKED = 1; - VEHICLELOCKSTATE_INTERNAL_LOCKED = 2; - VEHICLELOCKSTATE_SELECTIVE_UNLOCKED = 3; -} - -message ClosureStatuses -{ - ClosureState_E frontDriverDoor = 1; - ClosureState_E frontPassengerDoor = 2; - ClosureState_E rearDriverDoor = 3; - ClosureState_E rearPassengerDoor = 4; - ClosureState_E rearTrunk = 5; - ClosureState_E frontTrunk = 6; - ClosureState_E chargePort = 7; - ClosureState_E tonneau = 8; -} - -enum VehicleSleepStatus_E { - VEHICLE_SLEEP_STATUS_UNKNOWN = 0; - VEHICLE_SLEEP_STATUS_AWAKE = 1; - VEHICLE_SLEEP_STATUS_ASLEEP = 2; -} - -message DetailedClosureStatus { - uint32 tonneauPercentOpen = 1; -} - -enum UserPresence_E { - VEHICLE_USER_PRESENCE_UNKNOWN = 0; - VEHICLE_USER_PRESENCE_NOT_PRESENT = 1; - VEHICLE_USER_PRESENCE_PRESENT = 2; -} - -message VehicleStatus { - ClosureStatuses closureStatuses = 1; - VehicleLockState_E vehicleLockState = 2; - VehicleSleepStatus_E vehicleSleepStatus = 3; - UserPresence_E userPresence = 4; - DetailedClosureStatus detailedClosureStatus = 5; -} - -message FromVCSECMessage { - reserved 6 to 10; - oneof sub_message { - VehicleStatus vehicleStatus = 1; - CommandStatus commandStatus = 4; - WhitelistInfo whitelistInfo = 16; - WhitelistEntryInfo whitelistEntryInfo = 17; - Errors.NominalError nominalError = 46; - } -} diff --git a/protobuf/vehicle.proto b/protobuf/vehicle.proto deleted file mode 100644 index dfdf326..0000000 --- a/protobuf/vehicle.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -package CarServer; - -option go_package = "github.com/teslamotors/vehicle-command/pkg/protocol/protobuf/carserver"; -option java_package = "com.tesla.generated.carserver.vehicle"; -option java_outer_classname = "Vehicle"; - -message VehicleState { - message GuestMode { - bool GuestModeActive = 1; - } - GuestMode guestMode = 74; -} - -message ClimateState { - enum CopActivationTemp { - CopActivationTempUnspecified = 0; - CopActivationTempLow = 1; - CopActivationTempMedium = 2; - CopActivationTempHigh = 3; - } -}