meshtastic 0.0.38 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/meshtastic/mqtt.rb +3 -5
- data/lib/meshtastic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9dc432f90a8545cad1027f5514f0676a60d776f617db87b394436e1657693e98
|
|
4
|
+
data.tar.gz: 5a461b32da2516b164ab789f2a27653b5f46a4f7d36020ddca1ba161931162e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1094355139b2e703dda03bf60ff7034aeb94e1d7d335ba8cd73aae0d9c3bae4c64e61cfb3b8e2dcbdd8894174ab5e3f77b29fde04617fedc3f578b5e469a2678
|
|
7
|
+
data.tar.gz: d5677d5b337b4f1b8cbff41da88eafaeab8377f3235085f6ba2df384b7c19dd24cbece877d1d6c39f4cf3c4b9d6674f93ed6cb783bc62bd739e12379f3a8a552
|
data/lib/meshtastic/mqtt.rb
CHANGED
|
@@ -59,6 +59,7 @@ module Meshtastic
|
|
|
59
59
|
root_topic = opts[:root_topic] ||= 'msh'
|
|
60
60
|
region = opts[:region] ||= 'US'
|
|
61
61
|
channel = opts[:channel] ||= '2/e/LongFast/#'
|
|
62
|
+
# TODO: Support Array of PSKs and attempt each until decrypted
|
|
62
63
|
psk = opts[:psk] ||= 'AQ=='
|
|
63
64
|
qos = opts[:qos] ||= 0
|
|
64
65
|
json = opts[:json] ||= false
|
|
@@ -74,7 +75,7 @@ module Meshtastic
|
|
|
74
75
|
# Our AES key is 128 or 256 bits, shared as part of the 'Channel' specification.
|
|
75
76
|
|
|
76
77
|
# Actual pre-shared key for LongFast channel
|
|
77
|
-
psk = '1PG7OiApB1nwvP+rz05pAQ==' if
|
|
78
|
+
psk = '1PG7OiApB1nwvP+rz05pAQ==' if psk == 'AQ=='
|
|
78
79
|
padded_psk = psk.ljust(psk.length + ((4 - (psk.length % 4)) % 4), '=')
|
|
79
80
|
replaced_psk = padded_psk.gsub('-', '+').gsub('_', '/')
|
|
80
81
|
psk = replaced_psk
|
|
@@ -124,9 +125,6 @@ module Meshtastic
|
|
|
124
125
|
|
|
125
126
|
decrypted = cipher.update(encrypted_message) + cipher.final
|
|
126
127
|
message[:decrypted] = decrypted
|
|
127
|
-
# decoded_packet = Meshtastic::ServiceEnvelope.decode(decrypted)
|
|
128
|
-
# puts "Decoded Decrypted Packet: #{decoded_packet.display.to_h}"
|
|
129
|
-
# Vvv Decode the decrypted message vvV
|
|
130
128
|
end
|
|
131
129
|
|
|
132
130
|
if message[:decoded]
|
|
@@ -228,7 +226,7 @@ module Meshtastic
|
|
|
228
226
|
JSON::GeneratorError,
|
|
229
227
|
ArgumentError => e
|
|
230
228
|
|
|
231
|
-
message[:decrypted] = e.message if
|
|
229
|
+
message[:decrypted] = e.message if e.message.include?('key must be')
|
|
232
230
|
decoded_payload_hash[:packet] = message
|
|
233
231
|
unless block_given?
|
|
234
232
|
message[:stdout] = 'inspect'
|
data/lib/meshtastic/version.rb
CHANGED