meshtastic 0.0.38 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac577c0153e4ad5a0113ad1e2329a1225787406d712974c45b98d438e51c17e3
4
- data.tar.gz: e0364940c63d6a242c031170a6258bcabcf93354554d1d84c624d04d624afd02
3
+ metadata.gz: 9dc432f90a8545cad1027f5514f0676a60d776f617db87b394436e1657693e98
4
+ data.tar.gz: 5a461b32da2516b164ab789f2a27653b5f46a4f7d36020ddca1ba161931162e0
5
5
  SHA512:
6
- metadata.gz: b520548467c045ecacd7aa41ffd2e0b08cd0bccaa777a5f6a93af8b7c3335e5c003b452e984f3b5b617403579b1a8bae31b914f7ae04d8c9f4d0bb9889979b92
7
- data.tar.gz: a5a22a3c7909cf349fd250a5ef289a7d210b284b0eb7bae7d045b2e68a184cd8798497bcade3f86f7d3ecf645edb33385465042ccdb0db5a5977ae07117f883e
6
+ metadata.gz: 1094355139b2e703dda03bf60ff7034aeb94e1d7d335ba8cd73aae0d9c3bae4c64e61cfb3b8e2dcbdd8894174ab5e3f77b29fde04617fedc3f578b5e469a2678
7
+ data.tar.gz: d5677d5b337b4f1b8cbff41da88eafaeab8377f3235085f6ba2df384b7c19dd24cbece877d1d6c39f4cf3c4b9d6674f93ed6cb783bc62bd739e12379f3a8a552
@@ -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 channel.include?('LongFast')
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 ArgumentError
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'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.38'
4
+ VERSION = '0.0.40'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meshtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.