From fcd22ef2674649262dd62e0b5d3eaf1a871bcd00 Mon Sep 17 00:00:00 2001 From: Paul Soucy Date: Sun, 2 Oct 2022 20:17:49 -0400 Subject: [PATCH 1/4] add secure_packet_v1 for secure concentrators --- src/service/poc_lora.proto | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/service/poc_lora.proto b/src/service/poc_lora.proto index eea65e25..ed1d7db2 100644 --- a/src/service/poc_lora.proto +++ b/src/service/poc_lora.proto @@ -26,6 +26,56 @@ enum invalid_reason { invalid_frequency = 13; } +message secure_packet_v1 { + // frequency in Hz + uint64 freq = 1; + + data_rate datarate = 2; + + // Signal to Noise radio (0.01dB) + int32 snr = 3; + + // Received Signal Strength Indicator (1 dBm) + int32 rssi = 4; + + // Internal timestamp of "RX finished" event + uint32 tmst = 5; + + // Globally Unique identifier of Concentrator Card + bytes card_id = 6; + + optional wgs84_position pos = 7; + + // time of beacon was received by concentrator (can be used for TDOA) + optional gps_time time = 8; + + // signature of the RX pkt signed by Secure Concentrator Card + bytes signature = 9; +} + +message wgs84_position { + // (deg) 1e-7 scale + int32 latitude = 1; + + // (deg) 1e-7 scale + int32 longitude = 2; + + // Height above ellipsoid (mm) + int32 height = 3; + + // Horizontal accuracy estimate (mm) + uint32 hacc = 4; + + // Vertical accuracy estimate (mm) + optional uint32 vacc = 5; +} + +// Duration since the GPS epoc (0h 6-Jan-1980) +message gps_time { + uint64 sec = 2; + uint32 nano = 3; +} + // beacon report as submitted by gateway to ingestor message lora_beacon_report_req_v1 { bytes pub_key = 2; @@ -58,6 +108,7 @@ message lora_witness_report_req_v1 { uint64 frequency = 8; data_rate datarate = 10; bytes signature = 11; + optional secure_packet_v1 secure_pkt = 12; } // response returned to gateway submitting witness report to ingestor From 6289fd6121cdb11f311b21d7df843fed783694fb Mon Sep 17 00:00:00 2001 From: Paul Soucy Date: Wed, 10 May 2023 23:15:04 -0400 Subject: [PATCH 2/4] refractor --- src/gps.proto | 26 +++++++++++++++++++++ src/packet.proto | 33 ++++++++++++++++++++++++++ src/service/poc_lora.proto | 47 +++++--------------------------------- 3 files changed, 65 insertions(+), 41 deletions(-) create mode 100644 src/gps.proto diff --git a/src/gps.proto b/src/gps.proto new file mode 100644 index 00000000..38ae9371 --- /dev/null +++ b/src/gps.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package helium; + +message wgs84_position { + // (deg) 1e-7 scale + sint32 latitude = 1; + + // (deg) 1e-7 scale + sint32 longitude = 2; + + // Height above ellipsoid (mm) + int32 height = 3; + + // Horizontal accuracy estimate (mm) + uint32 hacc = 4; + + // Vertical accuracy estimate (mm) + optional uint32 vacc = 5; +} + +// Duration since the GPS epoc (0h 6-Jan-1980) +message gps_time { + uint64 sec = 2; + uint32 nano = 3; +} diff --git a/src/packet.proto b/src/packet.proto index 3de054d0..db507ede 100644 --- a/src/packet.proto +++ b/src/packet.proto @@ -2,6 +2,9 @@ syntax = "proto3"; package helium; +import "data_rate.proto"; +import "gps.proto"; + message eui { uint64 deveui = 1; uint64 appeui = 2; @@ -36,3 +39,33 @@ message packet { routing_information routing = 9; window rx2_window = 10; } + +message secure_packet_v1 { + // frequency in Hz + uint64 freq = 1; + + data_rate datarate = 2; + + // Signal to Noise radio (0.01dB) + int32 snr = 3; + + // Received Signal Strength Indicator (1 dBm) + sint32 rssi = 4; + + // Internal timestamp of "RX finished" event + uint32 tmst = 5; + + // Globally Unique identifier of Concentrator Card + bytes card_id = 6; + + // time of beacon was received by concentrator (can be used for TDOA) + optional gps_time time = 7; + + optional wgs84_position pos = 8; + + // packet payload + bytes data = 9; + + // signature of the RX pkt signed by Secure Concentrator Card + bytes sc_signature = 10; +} diff --git a/src/service/poc_lora.proto b/src/service/poc_lora.proto index c933e786..55c0dfcb 100644 --- a/src/service/poc_lora.proto +++ b/src/service/poc_lora.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package helium.poc_lora; import "data_rate.proto"; +import "gps.proto"; enum verification_status { valid = 0; @@ -40,53 +41,17 @@ enum invalid_reason { } message secure_packet_v1 { - // frequency in Hz - uint64 freq = 1; - - data_rate datarate = 2; - - // Signal to Noise radio (0.01dB) - int32 snr = 3; - - // Received Signal Strength Indicator (1 dBm) - int32 rssi = 4; - - // Internal timestamp of "RX finished" event - uint32 tmst = 5; // Globally Unique identifier of Concentrator Card - bytes card_id = 6; - - optional wgs84_position pos = 7; + bytes card_id = 1; // time of beacon was received by concentrator (can be used for TDOA) - optional gps_time time = 8; + optional gps_time time = 2; - // signature of the RX pkt signed by Secure Concentrator Card - bytes signature = 9; -} + optional wgs84_position pos = 3; -message wgs84_position { - // (deg) 1e-7 scale - int32 latitude = 1; - - // (deg) 1e-7 scale - int32 longitude = 2; - - // Height above ellipsoid (mm) - int32 height = 3; - - // Horizontal accuracy estimate (mm) - uint32 hacc = 4; - - // Vertical accuracy estimate (mm) - optional uint32 vacc = 5; -} - -// Duration since the GPS epoc (0h 6-Jan-1980) -message gps_time { - uint64 sec = 2; - uint32 nano = 3; + // signature of the RX pkt signed by Secure Concentrator Card + bytes sc_signature = 4; } // beacon report as submitted by gateway to ingestor From 4b6a852301cbe12a0c2765f8f44133fd43d5887e Mon Sep 17 00:00:00 2001 From: Paul Soucy Date: Thu, 11 May 2023 23:43:17 -0400 Subject: [PATCH 3/4] wip --- src/lib.rs | 2 +- src/service/poc_lora.proto | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d626b784..bff494f9 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,7 @@ pub use prost::{DecodeError, EncodeError, Message}; pub mod services { use crate::{ BlockchainRegionParamsV1, BlockchainTokenTypeV1, BlockchainTxn, DataRate, EntropyReportV1, - GatewayStakingMode, MapperAttach, Region, RoutingAddress, + GatewayStakingMode, MapperAttach, Region, RoutingAddress, GpsTime, Wgs84Position, }; pub mod iot_config { diff --git a/src/service/poc_lora.proto b/src/service/poc_lora.proto index 55c0dfcb..066876ea 100644 --- a/src/service/poc_lora.proto +++ b/src/service/poc_lora.proto @@ -46,9 +46,9 @@ message secure_packet_v1 { bytes card_id = 1; // time of beacon was received by concentrator (can be used for TDOA) - optional gps_time time = 2; + gps_time time = 2; - optional wgs84_position pos = 3; + wgs84_position pos = 3; // signature of the RX pkt signed by Secure Concentrator Card bytes sc_signature = 4; @@ -90,7 +90,9 @@ message lora_witness_report_req_v1 { uint64 frequency = 8; data_rate datarate = 10; bytes signature = 11; - optional secure_packet_v1 secure_pkt = 12; + + // optional extra info used for secure concentrators + secure_packet_v1 secure_pkt = 12; } // response returned to gateway submitting witness report to ingestor From 18ec2e364c0c51190e337e1df73201c349f30ad0 Mon Sep 17 00:00:00 2001 From: Paul Soucy Date: Sat, 3 Jun 2023 21:49:53 -0400 Subject: [PATCH 4/4] wip --- src/gps.proto | 7 +++---- src/packet.proto | 6 +++--- src/service/packet_router.proto | 34 +++++++++++++++++++++++++++++++++ src/service/poc_lora.proto | 3 +-- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/gps.proto b/src/gps.proto index 38ae9371..a6c1cce7 100644 --- a/src/gps.proto +++ b/src/gps.proto @@ -19,8 +19,7 @@ message wgs84_position { optional uint32 vacc = 5; } -// Duration since the GPS epoc (0h 6-Jan-1980) message gps_time { - uint64 sec = 2; - uint32 nano = 3; -} + // time of beacon was received by concentrator (nanoseconds since GPS Epoch) (can be used for TDOA) + uint64 gps_time = 1; +} \ No newline at end of file diff --git a/src/packet.proto b/src/packet.proto index db507ede..57d23ee9 100644 --- a/src/packet.proto +++ b/src/packet.proto @@ -58,10 +58,10 @@ message secure_packet_v1 { // Globally Unique identifier of Concentrator Card bytes card_id = 6; - // time of beacon was received by concentrator (can be used for TDOA) - optional gps_time time = 7; + // time of beacon was received by concentrator (nanoseconds since GPS Epoch) (can be used for TDOA) + gps_time gps_time = 7; - optional wgs84_position pos = 8; + wgs84_position pos = 8; // packet payload bytes data = 9; diff --git a/src/service/packet_router.proto b/src/service/packet_router.proto index 5962b91c..617cae09 100644 --- a/src/service/packet_router.proto +++ b/src/service/packet_router.proto @@ -38,6 +38,40 @@ message packet_router_packet_up_v1 { bytes signature = 10; } +message packet_router_packet_up_v2 { + // frequency in Hz + uint64 freq = 1; + + data_rate datarate = 2; + + // Signal to Noise radio (0.01dB) + sint32 snr = 3; + + // Received Signal Strength Indicator (1 dBm) + sint32 rssi = 4; + + // Internal timestamp of "RX finished" event + uint32 tmst = 5; + + // Globally Unique identifier of Concentrator Card + bytes card_id = 6; + + // time of beacon was received by concentrator (nanoseconds since GPS Epoch) (can be used for TDOA) + gps_time gps_time = 7; + + wgs84_position pos = 8; + + // packet payload + bytes data = 9; + + // signature of the RX pkt signed by Secure Concentrator Card + bytes sc_signature = 10; + + // signature from the gateway + bytes gw_signature = 11; + +} + message packet_router_register_v1 { uint64 timestamp = 1; bytes gateway = 2; diff --git a/src/service/poc_lora.proto b/src/service/poc_lora.proto index 066876ea..a168b176 100644 --- a/src/service/poc_lora.proto +++ b/src/service/poc_lora.proto @@ -45,8 +45,7 @@ message secure_packet_v1 { // Globally Unique identifier of Concentrator Card bytes card_id = 1; - // time of beacon was received by concentrator (can be used for TDOA) - gps_time time = 2; + gps_time gps_time = 2; wgs84_position pos = 3;