diff --git a/meshtastic/admin.proto b/meshtastic/admin.proto index 12fe0c74..1c637c9f 100644 --- a/meshtastic/admin.proto +++ b/meshtastic/admin.proto @@ -58,6 +58,11 @@ message AdminMessage { * TODO: REPLACE */ BLUETOOTH_CONFIG = 6; + + /* + * TODO: REPLACE + */ + SECURITY_CONFIG = 7; } /* diff --git a/meshtastic/config.options b/meshtastic/config.options index 22dcc88a..704d1411 100644 --- a/meshtastic/config.options +++ b/meshtastic/config.options @@ -15,3 +15,7 @@ *LoRaConfig.channel_num int_size:16 *PowerConfig.device_battery_ina_address int_size:8 + +*SecurityConfig.public_key max_size:32 +*SecurityConfig.private_key max_size:32 +*SecurityConfig.admin_key max_size:32 diff --git a/meshtastic/config.proto b/meshtastic/config.proto index d3756b5c..98c0e66e 100644 --- a/meshtastic/config.proto +++ b/meshtastic/config.proto @@ -135,14 +135,16 @@ message Config { /* * Disabling this will disable the SerialConsole by not initilizing the StreamAPI + * Moved to SecurityConfig */ - bool serial_enabled = 2; + bool serial_enabled = 2[deprecated = true]; /* * By default we turn off logging as soon as an API client connects (to keep shared serial link quiet). * Set this to true to leave the debug log outputting even when API is active. + * Moved to SecurityConfig */ - bool debug_log_enabled = 3; + bool debug_log_enabled = 3[deprecated = true]; /* * For boards without a hard wired button, this is the pin number that will be used @@ -175,8 +177,9 @@ message Config { /* * If true, device is considered to be "managed" by a mesh administrator * Clients should then limit available configuration and administrative options inside the user interface + * Moved to SecurityConfig */ - bool is_managed = 9; + bool is_managed = 9[deprecated = true]; /* * Disables the triple-press of user button to enable or disable GPS @@ -825,8 +828,9 @@ message Config { /* * Very Long Range - Slow + * Deprecated in 2.5: Works only with txco and is unusably slow */ - VERY_LONG_SLOW = 2; + VERY_LONG_SLOW = 2 [deprecated = true]; /* * Medium Range - Slow @@ -852,6 +856,13 @@ message Config { * Long Range - Moderately Fast */ LONG_MODERATE = 7; + + /* + * Short Range - Turbo + * This is the fastest preset and the only one with 500kHz bandwidth. + * It is not legal to use in all regions due to this wider bandwidth. + */ + SHORT_TURBO = 8; } /* @@ -1006,8 +1017,66 @@ message Config { /* * Enables device (serial style logs) over Bluetooth + * Moved to SecurityConfig */ - bool device_logging_enabled = 4; + bool device_logging_enabled = 4[deprecated = true]; + } + + message SecurityConfig { + + /* + * The public key of the user's device. + * Sent out to other nodes on the mesh to allow them to compute a shared secret key. + */ + bytes public_key = 1; + + /* + * The private key of the device. + * Used to create a shared key with a remote device. + */ + bytes private_key = 2; + + /* + * The public key authorized to send admin messages to this node. + */ + bytes admin_key = 3; + + /* + * If true, device is considered to be "managed" by a mesh administrator via admin messages + * Device is managed by a mesh administrator. + */ + bool is_managed = 4; + + /* + * Serial Console over the Stream API." + */ + bool serial_enabled = 5; + + /* + * By default we turn off logging as soon as an API client connects (to keep shared serial link quiet). + * Output live debug logging over serial. + */ + bool debug_log_api_enabled = 6; + + /* + * Enables device (serial style logs) over Bluetooth + */ + bool bluetooth_logging_enabled = 7; + + /* + * Allow incoming device control over the insecure legacy admin channel. + */ + bool admin_channel_enabled = 8; + + /* + * If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe + */ + bool pki_uplink_enabled = 9; + + /* + * If true, messages seen on the internet will be forwarded to the local mesh. + */ + bool pki_downlink_enabled = 10; } /* @@ -1021,5 +1090,6 @@ message Config { DisplayConfig display = 5; LoRaConfig lora = 6; BluetoothConfig bluetooth = 7; + SecurityConfig security = 8; } } diff --git a/meshtastic/localonly.proto b/meshtastic/localonly.proto index 9694d7b4..bcb27964 100644 --- a/meshtastic/localonly.proto +++ b/meshtastic/localonly.proto @@ -58,6 +58,11 @@ message LocalConfig { * NodeDB.cpp in the device code. */ uint32 version = 8; + + /* + * The part of the config that is specific to Security settings + */ + Config.SecurityConfig security = 9; } message LocalModuleConfig { diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 7075e2da..9730a6e8 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -3,6 +3,7 @@ *macaddr max_size:6 fixed_length:true # macaddrs *id max_size:16 # node id strings +*public_key max_size:32 # public key *User.long_name max_size:40 *User.short_name max_size:5 @@ -45,6 +46,8 @@ *FileInfo.file_name max_size:228 +*ClientNotification.message max_size:400 + # MyMessage.name max_size:40 # or fixed_length or fixed_count, or max_count diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index c8bd2eff..f5799d1c 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -23,17 +23,17 @@ message Position { * The new preferred location encoding, multiply by 1e-7 to get degrees * in floating point */ - sfixed32 latitude_i = 1; + optional sfixed32 latitude_i = 1; /* * TODO: REPLACE */ - sfixed32 longitude_i = 2; + optional sfixed32 longitude_i = 2; /* * In meters above MSL (but see issue #359) */ - int32 altitude = 3; + optional int32 altitude = 3; /* * This is usually not sent over the mesh (to save space), but it is sent @@ -122,12 +122,12 @@ message Position { /* * HAE altitude in meters - can be used instead of MSL altitude */ - sint32 altitude_hae = 9; + optional sint32 altitude_hae = 9; /* * Geoidal separation in meters */ - sint32 altitude_geoidal_separation = 10; + optional sint32 altitude_geoidal_separation = 10; /* * Horizontal, Vertical and Position Dilution of Precision, in 1/100 units @@ -163,12 +163,12 @@ message Position { * - "yaw" indicates a relative rotation about the vertical axis * TODO: REMOVE/INTEGRATE */ - uint32 ground_speed = 15; + optional uint32 ground_speed = 15; /* * TODO: REPLACE */ - uint32 ground_track = 16; + optional uint32 ground_track = 16; /* * GPS fix quality (from NMEA GxGGA statement or similar) @@ -665,6 +665,12 @@ message User { * Indicates that the user's role in the mesh */ Config.DeviceConfig.Role role = 7; + + /* + * The public key of the user's device. + * This is sent out to other nodes on the mesh to allow them to compute a shared secret key. + */ + bytes public_key = 8; } /* @@ -837,12 +843,12 @@ message Waypoint { /* * latitude_i */ - sfixed32 latitude_i = 2; + optional sfixed32 latitude_i = 2; /* * longitude_i */ - sfixed32 longitude_i = 3; + optional sfixed32 longitude_i = 3; /* * Time the waypoint is to expire (epoch) @@ -1105,6 +1111,16 @@ message MeshPacket { * When receiving a packet, the difference between hop_start and hop_limit gives how many hops it traveled. */ uint32 hop_start = 15; + + /* + * Records the public key the packet was encrypted with, if applicable. + */ + bytes public_key = 16; + + /* + * Indicates whether the packet was en/decrypted using PKI + */ + bool pki_encrypted = 17; } /* @@ -1508,9 +1524,41 @@ message FromRadio { * File system manifest messages */ FileInfo fileInfo = 15; + + /* + * Notification message to the client + */ + ClientNotification clientNotification = 16; } } +/* + * A notification message from the device to the client + * To be used for important messages that should to be displayed to the user + * in the form of push notifications or validation messages when saving + * invalid configuration. + */ +message ClientNotification { + /* + * The id of the packet we're notifying in response to + */ + optional uint32 reply_id = 1; + + /* + * Seconds since 1970 - or 0 for unknown/unset + */ + fixed32 time = 2; + + /* + * The level type of notification + */ + LogRecord.Level level = 3; + /* + * The message body of the notification + */ + string message = 4; +} + /* * Individual File info for the device */ diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 38793736..02814159 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -153,6 +153,7 @@ message ModuleConfig { * Works as a sort of status heartbeat for peace of mind */ uint32 state_broadcast_secs = 3; + /* * Send ASCII bell with alert message * Useful for triggering ext. notification on bell diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index 8ffbeb2e..001c4576 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -1,413 +1,413 @@ -syntax = "proto3"; - -package meshtastic; - -option csharp_namespace = "Meshtastic.Protobufs"; -option go_package = "github.com/meshtastic/go/generated"; -option java_outer_classname = "TelemetryProtos"; -option java_package = "com.geeksville.mesh"; -option swift_prefix = ""; - -/* - * Key native device metrics such as battery level - */ -message DeviceMetrics { - /* - * 0-100 (>100 means powered) - */ - uint32 battery_level = 1; - - /* - * Voltage measured - */ - float voltage = 2; - - /* - * Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). - */ - float channel_utilization = 3; - - /* - * Percent of airtime for transmission used within the last hour. - */ - float air_util_tx = 4; - - /* - * How long the device has been running since the last reboot (in seconds) - */ - uint32 uptime_seconds = 5; -} - -/* - * Weather station or other environmental metrics - */ -message EnvironmentMetrics { - /* - * Temperature measured - */ - float temperature = 1; - - /* - * Relative humidity percent measured - */ - float relative_humidity = 2; - - /* - * Barometric pressure in hPA measured - */ - float barometric_pressure = 3; - - /* - * Gas resistance in MOhm measured - */ - float gas_resistance = 4; - - /* - * Voltage measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) - */ - float voltage = 5; - - /* - * Current measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) - */ - float current = 6; - - /* - * relative scale IAQ value as measured by Bosch BME680 . value 0-500. - * Belongs to Air Quality but is not particle but VOC measurement. Other VOC values can also be put in here. - */ - uint32 iaq = 7; - - /* - * RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. - */ - float distance = 8; - - /* - * VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. - */ - float lux = 9; - - /* - * VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. - */ - float white_lux = 10; - - /* - * Infrared lux - */ - float ir_lux = 11; - - /* - * Ultraviolet lux - */ - float uv_lux = 12; - - /* - * Wind direction in degrees - * 0 degrees = North, 90 = East, etc... - */ - uint32 wind_direction = 13; - - /* - * Wind speed in m/s - */ - float wind_speed = 14; - - /* - * Weight in KG - */ - float weight = 15; - - /* - * Wind gust in m/s - */ - float wind_gust = 16; - - /* - * Wind lull in m/s - */ - float wind_lull = 17; -} - -/* - * Power Metrics (voltage / current / etc) - */ -message PowerMetrics { - /* - * Voltage (Ch1) - */ - float ch1_voltage = 1; - - /* - * Current (Ch1) - */ - float ch1_current = 2; - - /* - * Voltage (Ch2) - */ - float ch2_voltage = 3; - - /* - * Current (Ch2) - */ - float ch2_current = 4; - - /* - * Voltage (Ch3) - */ - float ch3_voltage = 5; - - /* - * Current (Ch3) - */ - float ch3_current = 6; -} - -/* - * Air quality metrics - */ -message AirQualityMetrics { - /* - * Concentration Units Standard PM1.0 - */ - uint32 pm10_standard = 1; - - /* - * Concentration Units Standard PM2.5 - */ - uint32 pm25_standard = 2; - - /* - * Concentration Units Standard PM10.0 - */ - uint32 pm100_standard = 3; - - /* - * Concentration Units Environmental PM1.0 - */ - uint32 pm10_environmental = 4; - - /* - * Concentration Units Environmental PM2.5 - */ - uint32 pm25_environmental = 5; - - /* - * Concentration Units Environmental PM10.0 - */ - uint32 pm100_environmental = 6; - - /* - * 0.3um Particle Count - */ - uint32 particles_03um = 7; - - /* - * 0.5um Particle Count - */ - uint32 particles_05um = 8; - - /* - * 1.0um Particle Count - */ - uint32 particles_10um = 9; - - /* - * 2.5um Particle Count - */ - uint32 particles_25um = 10; - - /* - * 5.0um Particle Count - */ - uint32 particles_50um = 11; - - /* - * 10.0um Particle Count - */ - uint32 particles_100um = 12; -} - -/* - * Types of Measurements the telemetry module is equipped to handle - */ -message Telemetry { - /* - * Seconds since 1970 - or 0 for unknown/unset - */ - fixed32 time = 1; - - oneof variant { - /* - * Key native device metrics such as battery level - */ - DeviceMetrics device_metrics = 2; - - /* - * Weather station or other environmental metrics - */ - EnvironmentMetrics environment_metrics = 3; - - /* - * Air quality metrics - */ - AirQualityMetrics air_quality_metrics = 4; - - /* - * Power Metrics - */ - PowerMetrics power_metrics = 5; - } -} - -/* - * Supported I2C Sensors for telemetry in Meshtastic - */ -enum TelemetrySensorType { - /* - * No external telemetry sensor explicitly set - */ - SENSOR_UNSET = 0; - - /* - * High accuracy temperature, pressure, humidity - */ - BME280 = 1; - - /* - * High accuracy temperature, pressure, humidity, and air resistance - */ - BME680 = 2; - - /* - * Very high accuracy temperature - */ - MCP9808 = 3; - - /* - * Moderate accuracy current and voltage - */ - INA260 = 4; - - /* - * Moderate accuracy current and voltage - */ - INA219 = 5; - - /* - * High accuracy temperature and pressure - */ - BMP280 = 6; - - /* - * High accuracy temperature and humidity - */ - SHTC3 = 7; - - /* - * High accuracy pressure - */ - LPS22 = 8; - - /* - * 3-Axis magnetic sensor - */ - QMC6310 = 9; - - /* - * 6-Axis inertial measurement sensor - */ - QMI8658 = 10; - - /* - * 3-Axis magnetic sensor - */ - QMC5883L = 11; - - /* - * High accuracy temperature and humidity - */ - SHT31 = 12; - - /* - * PM2.5 air quality sensor - */ - PMSA003I = 13; - - /* - * INA3221 3 Channel Voltage / Current Sensor - */ - INA3221 = 14; - - /* - * BMP085/BMP180 High accuracy temperature and pressure (older Version of BMP280) - */ - BMP085 = 15; - - /* - * RCWL-9620 Doppler Radar Distance Sensor, used for water level detection - */ - RCWL9620 = 16; - - /* - * Sensirion High accuracy temperature and humidity - */ - SHT4X = 17; - - /* - * VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. - */ - VEML7700 = 18; - - /* - * MLX90632 non-contact IR temperature sensor. - */ - MLX90632 = 19; - - /* - * TI OPT3001 Ambient Light Sensor - */ - OPT3001 = 20; - - /* - * Lite On LTR-390UV-01 UV Light Sensor - */ - LTR390UV = 21; - - /* - * AMS TSL25911FN RGB Light Sensor - */ - TSL25911FN = 22; - - /* - * AHT10 Integrated temperature and humidity sensor - */ - AHT10 = 23; - - /* - * DFRobot Lark Weather station (temperature, humidity, pressure, wind speed and direction) - */ - DFROBOT_LARK = 24; - - /* - * NAU7802 Scale Chip or compatible - */ - NAU7802 = 25; -} - -/* - * NAU7802 Telemetry configuration, for saving to flash - */ -message Nau7802Config { - /* - * The offset setting for the NAU7802 - */ - int32 zeroOffset = 1; - - /* - * The calibration factor for the NAU7802 - */ - float calibrationFactor = 2; -} +syntax = "proto3"; + +package meshtastic; + +option csharp_namespace = "Meshtastic.Protobufs"; +option go_package = "github.com/meshtastic/go/generated"; +option java_outer_classname = "TelemetryProtos"; +option java_package = "com.geeksville.mesh"; +option swift_prefix = ""; + +/* + * Key native device metrics such as battery level + */ +message DeviceMetrics { + /* + * 0-100 (>100 means powered) + */ + optional uint32 battery_level = 1; + + /* + * Voltage measured + */ + optional float voltage = 2; + + /* + * Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). + */ + optional float channel_utilization = 3; + + /* + * Percent of airtime for transmission used within the last hour. + */ + optional float air_util_tx = 4; + + /* + * How long the device has been running since the last reboot (in seconds) + */ + optional uint32 uptime_seconds = 5; +} + +/* + * Weather station or other environmental metrics + */ +message EnvironmentMetrics { + /* + * Temperature measured + */ + optional float temperature = 1; + + /* + * Relative humidity percent measured + */ + optional float relative_humidity = 2; + + /* + * Barometric pressure in hPA measured + */ + optional float barometric_pressure = 3; + + /* + * Gas resistance in MOhm measured + */ + optional float gas_resistance = 4; + + /* + * Voltage measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) + */ + optional float voltage = 5; + + /* + * Current measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) + */ + optional float current = 6; + + /* + * relative scale IAQ value as measured by Bosch BME680 . value 0-500. + * Belongs to Air Quality but is not particle but VOC measurement. Other VOC values can also be put in here. + */ + optional uint32 iaq = 7; + + /* + * RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. + */ + optional float distance = 8; + + /* + * VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. + */ + optional float lux = 9; + + /* + * VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. + */ + optional float white_lux = 10; + + /* + * Infrared lux + */ + optional float ir_lux = 11; + + /* + * Ultraviolet lux + */ + optional float uv_lux = 12; + + /* + * Wind direction in degrees + * 0 degrees = North, 90 = East, etc... + */ + optional uint32 wind_direction = 13; + + /* + * Wind speed in m/s + */ + optional float wind_speed = 14; + + /* + * Weight in KG + */ + optional float weight = 15; + + /* + * Wind gust in m/s + */ + optional float wind_gust = 16; + + /* + * Wind lull in m/s + */ + optional float wind_lull = 17; +} + +/* + * Power Metrics (voltage / current / etc) + */ +message PowerMetrics { + /* + * Voltage (Ch1) + */ + optional float ch1_voltage = 1; + + /* + * Current (Ch1) + */ + optional float ch1_current = 2; + + /* + * Voltage (Ch2) + */ + optional float ch2_voltage = 3; + + /* + * Current (Ch2) + */ + optional float ch2_current = 4; + + /* + * Voltage (Ch3) + */ + optional float ch3_voltage = 5; + + /* + * Current (Ch3) + */ + optional float ch3_current = 6; +} + +/* + * Air quality metrics + */ +message AirQualityMetrics { + /* + * Concentration Units Standard PM1.0 + */ + optional uint32 pm10_standard = 1; + + /* + * Concentration Units Standard PM2.5 + */ + optional uint32 pm25_standard = 2; + + /* + * Concentration Units Standard PM10.0 + */ + optional uint32 pm100_standard = 3; + + /* + * Concentration Units Environmental PM1.0 + */ + optional uint32 pm10_environmental = 4; + + /* + * Concentration Units Environmental PM2.5 + */ + optional uint32 pm25_environmental = 5; + + /* + * Concentration Units Environmental PM10.0 + */ + optional uint32 pm100_environmental = 6; + + /* + * 0.3um Particle Count + */ + optional uint32 particles_03um = 7; + + /* + * 0.5um Particle Count + */ + optional uint32 particles_05um = 8; + + /* + * 1.0um Particle Count + */ + optional uint32 particles_10um = 9; + + /* + * 2.5um Particle Count + */ + optional uint32 particles_25um = 10; + + /* + * 5.0um Particle Count + */ + optional uint32 particles_50um = 11; + + /* + * 10.0um Particle Count + */ + optional uint32 particles_100um = 12; +} + +/* + * Types of Measurements the telemetry module is equipped to handle + */ +message Telemetry { + /* + * Seconds since 1970 - or 0 for unknown/unset + */ + fixed32 time = 1; + + oneof variant { + /* + * Key native device metrics such as battery level + */ + DeviceMetrics device_metrics = 2; + + /* + * Weather station or other environmental metrics + */ + EnvironmentMetrics environment_metrics = 3; + + /* + * Air quality metrics + */ + AirQualityMetrics air_quality_metrics = 4; + + /* + * Power Metrics + */ + PowerMetrics power_metrics = 5; + } +} + +/* + * Supported I2C Sensors for telemetry in Meshtastic + */ +enum TelemetrySensorType { + /* + * No external telemetry sensor explicitly set + */ + SENSOR_UNSET = 0; + + /* + * High accuracy temperature, pressure, humidity + */ + BME280 = 1; + + /* + * High accuracy temperature, pressure, humidity, and air resistance + */ + BME680 = 2; + + /* + * Very high accuracy temperature + */ + MCP9808 = 3; + + /* + * Moderate accuracy current and voltage + */ + INA260 = 4; + + /* + * Moderate accuracy current and voltage + */ + INA219 = 5; + + /* + * High accuracy temperature and pressure + */ + BMP280 = 6; + + /* + * High accuracy temperature and humidity + */ + SHTC3 = 7; + + /* + * High accuracy pressure + */ + LPS22 = 8; + + /* + * 3-Axis magnetic sensor + */ + QMC6310 = 9; + + /* + * 6-Axis inertial measurement sensor + */ + QMI8658 = 10; + + /* + * 3-Axis magnetic sensor + */ + QMC5883L = 11; + + /* + * High accuracy temperature and humidity + */ + SHT31 = 12; + + /* + * PM2.5 air quality sensor + */ + PMSA003I = 13; + + /* + * INA3221 3 Channel Voltage / Current Sensor + */ + INA3221 = 14; + + /* + * BMP085/BMP180 High accuracy temperature and pressure (older Version of BMP280) + */ + BMP085 = 15; + + /* + * RCWL-9620 Doppler Radar Distance Sensor, used for water level detection + */ + RCWL9620 = 16; + + /* + * Sensirion High accuracy temperature and humidity + */ + SHT4X = 17; + + /* + * VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. + */ + VEML7700 = 18; + + /* + * MLX90632 non-contact IR temperature sensor. + */ + MLX90632 = 19; + + /* + * TI OPT3001 Ambient Light Sensor + */ + OPT3001 = 20; + + /* + * Lite On LTR-390UV-01 UV Light Sensor + */ + LTR390UV = 21; + + /* + * AMS TSL25911FN RGB Light Sensor + */ + TSL25911FN = 22; + + /* + * AHT10 Integrated temperature and humidity sensor + */ + AHT10 = 23; + + /* + * DFRobot Lark Weather station (temperature, humidity, pressure, wind speed and direction) + */ + DFROBOT_LARK = 24; + + /* + * NAU7802 Scale Chip or compatible + */ + NAU7802 = 25; +} + +/* + * NAU7802 Telemetry configuration, for saving to flash + */ +message Nau7802Config { + /* + * The offset setting for the NAU7802 + */ + int32 zeroOffset = 1; + + /* + * The calibration factor for the NAU7802 + */ + float calibrationFactor = 2; +}