meshcoredecoder 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl

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.
cli.py CHANGED
@@ -991,12 +991,8 @@ def decode_command(args):
991
991
 
992
992
  # Decode packet
993
993
  if args.verify:
994
- # Use async verification
995
- import asyncio
996
- loop = asyncio.get_event_loop()
997
- packet = loop.run_until_complete(
998
- MeshCoreDecoder.decode_with_verification(clean_hex, options)
999
- )
994
+ # Use verification
995
+ packet = MeshCoreDecoder.decode_with_verification(clean_hex, options)
1000
996
  else:
1001
997
  packet = MeshCoreDecoder.decode(clean_hex, options)
1002
998
 
@@ -1005,11 +1001,7 @@ def decode_command(args):
1005
1001
  if args.structure:
1006
1002
  # Get structure as well
1007
1003
  if args.verify:
1008
- import asyncio
1009
- loop = asyncio.get_event_loop()
1010
- structure = loop.run_until_complete(
1011
- MeshCoreDecoder.analyze_structure_with_verification(clean_hex, options)
1012
- )
1004
+ structure = MeshCoreDecoder.analyze_structure_with_verification(clean_hex, options)
1013
1005
  else:
1014
1006
  structure = MeshCoreDecoder.analyze_structure(clean_hex, options)
1015
1007
  # Use to_dict() for proper serialization
@@ -1029,11 +1021,7 @@ def decode_command(args):
1029
1021
  print(f'\n{bold("=== Packet Structure ===")}')
1030
1022
 
1031
1023
  if args.verify:
1032
- import asyncio
1033
- loop = asyncio.get_event_loop()
1034
- structure = loop.run_until_complete(
1035
- MeshCoreDecoder.analyze_structure_with_verification(clean_hex, options)
1036
- )
1024
+ structure = MeshCoreDecoder.analyze_structure_with_verification(clean_hex, options)
1037
1025
  else:
1038
1026
  structure = MeshCoreDecoder.analyze_structure(clean_hex, options)
1039
1027
 
index.py CHANGED
@@ -6,7 +6,7 @@ MIT License
6
6
  Main entry point for the MeshCore decoder Python port
7
7
  """
8
8
 
9
- __version__ = "0.2.0"
9
+ __version__ = "0.2.2"
10
10
 
11
11
  # Main decoder
12
12
  from src.decoder.packet_decoder import MeshCorePacketDecoder
@@ -5,4 +5,4 @@ from .decoder.packet_decoder import MeshCorePacketDecoder
5
5
  MeshCoreDecoder = MeshCorePacketDecoder
6
6
 
7
7
  __all__ = ['MeshCoreDecoder', 'MeshCorePacketDecoder']
8
- __version__ = "0.2.0"
8
+ __version__ = "0.2.2"
@@ -27,7 +27,7 @@ class Ed25519SignatureVerifier:
27
27
  """Ed25519 signature verification for MeshCore advertisement packets"""
28
28
 
29
29
  @staticmethod
30
- async def verify_advertisement_signature(
30
+ def verify_advertisement_signature(
31
31
  public_key_hex: str,
32
32
  signature_hex: str,
33
33
  timestamp: int,
@@ -35,9 +35,9 @@ class MeshCorePacketDecoder:
35
35
  return result['packet']
36
36
 
37
37
  @staticmethod
38
- async def decode_with_verification(hex_data: str, options: Optional[DecryptionOptions] = None) -> DecodedPacket:
38
+ def decode_with_verification(hex_data: str, options: Optional[DecryptionOptions] = None) -> DecodedPacket:
39
39
  """Decode a raw packet from hex string with signature verification for advertisements"""
40
- result = await MeshCorePacketDecoder._parse_internal_async(hex_data, False, options)
40
+ result = MeshCorePacketDecoder._parse_internal_with_verification(hex_data, False, options)
41
41
  return result['packet']
42
42
 
43
43
  @staticmethod
@@ -47,9 +47,9 @@ class MeshCorePacketDecoder:
47
47
  return result['structure']
48
48
 
49
49
  @staticmethod
50
- async def analyze_structure_with_verification(hex_data: str, options: Optional[DecryptionOptions] = None) -> PacketStructure:
50
+ def analyze_structure_with_verification(hex_data: str, options: Optional[DecryptionOptions] = None) -> PacketStructure:
51
51
  """Analyze packet structure with signature verification for advertisements"""
52
- result = await MeshCorePacketDecoder._parse_internal_async(hex_data, True, options)
52
+ result = MeshCorePacketDecoder._parse_internal_with_verification(hex_data, True, options)
53
53
  return result['structure']
54
54
 
55
55
  @staticmethod
@@ -368,7 +368,7 @@ class MeshCorePacketDecoder:
368
368
  return {'packet': error_packet, 'structure': error_structure}
369
369
 
370
370
  @staticmethod
371
- async def _parse_internal_async(hex_data: str, include_structure: bool, options: Optional[DecryptionOptions]) -> Dict[str, Any]:
371
+ def _parse_internal_with_verification(hex_data: str, include_structure: bool, options: Optional[DecryptionOptions]) -> Dict[str, Any]:
372
372
  """Internal unified parsing method with signature verification for advertisements"""
373
373
  # First do the regular parsing
374
374
  result = MeshCorePacketDecoder._parse_internal(hex_data, include_structure, options)
@@ -396,7 +396,7 @@ class MeshCorePacketDecoder:
396
396
  payload_bytes = bytes_data[offset:]
397
397
 
398
398
  # Decode with verification
399
- verified_advert = await AdvertPayloadDecoder.decode_with_verification(
399
+ verified_advert = AdvertPayloadDecoder.decode_with_verification(
400
400
  payload_bytes,
401
401
  {'include_segments': include_structure, 'segment_offset': 0}
402
402
  )
@@ -252,12 +252,12 @@ class AdvertPayloadDecoder:
252
252
  return sanitized if sanitized else None
253
253
 
254
254
  @staticmethod
255
- async def decode_with_verification(
255
+ def decode_with_verification(
256
256
  payload: bytes,
257
257
  options: Optional[Dict[str, Any]] = None
258
258
  ) -> Optional[AdvertPayload]:
259
259
  """Decode advertisement payload with signature verification"""
260
- from src.crypto.ed25519_verifier import Ed25519SignatureVerifier
260
+ from ...crypto.ed25519_verifier import Ed25519SignatureVerifier
261
261
 
262
262
  if options is None:
263
263
  options = {}
@@ -274,7 +274,7 @@ class AdvertPayloadDecoder:
274
274
  app_data_bytes = payload[app_data_start:]
275
275
  app_data_hex = bytes_to_hex(app_data_bytes)
276
276
 
277
- signature_valid = await Ed25519SignatureVerifier.verify_advertisement_signature(
277
+ signature_valid = Ed25519SignatureVerifier.verify_advertisement_signature(
278
278
  advert.public_key,
279
279
  advert.signature,
280
280
  advert.timestamp,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcoredecoder
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Complete Python implementation of the MeshCore Packet Decoder
5
5
  Home-page: https://github.com/chrisdavis2110/meshcore-decoder-py
6
6
  Author: Chris Davis
@@ -190,19 +190,15 @@ The library automatically:
190
190
  ### With Signature Verification
191
191
 
192
192
  ```python
193
- import asyncio
194
193
  from meshcoredecoder import MeshCoreDecoder
195
194
 
196
- # Async verification for Ed25519 signatures
197
- async def verify_packet():
198
- packet = await MeshCoreDecoder.decode_with_verification(hex_data)
195
+ # Verify Ed25519 signatures
196
+ packet = MeshCoreDecoder.decode_with_verification(hex_data)
199
197
 
200
- if packet.payload.get('decoded'):
201
- advert = packet.payload['decoded']
202
- if hasattr(advert, 'signature_valid'):
203
- print(f"Signature Valid: {advert.signature_valid}")
204
-
205
- asyncio.run(verify_packet())
198
+ if packet.payload.get('decoded'):
199
+ advert = packet.payload['decoded']
200
+ if hasattr(advert, 'signature_valid'):
201
+ print(f"Signature Valid: {advert.signature_valid}")
206
202
  ```
207
203
 
208
204
  ## Trace Packets and SNR Analysis
@@ -1,15 +1,15 @@
1
- cli.py,sha256=eyz_PzMTqrDH9heDt9fyLJ_g5m3TG3BZqeVPZQKI74k,51851
2
- index.py,sha256=qRuEr_hM1iakaN5TAyKOjsaB-fSloQOTwtJSZYUWm80,2448
3
- meshcoredecoder/__init__.py,sha256=_eF0csssjbB8AvP8lb5EBGN7roiorYR8Pde1LiDxo84,275
1
+ cli.py,sha256=bJXnvtgbn_en1KqD6mPtSvGEvpgwVVllISo9952pVmc,51403
2
+ index.py,sha256=RSXENgfhiZLdH8dJqOVvn8KZR_7Rk4kWTlMBbukf97E,2448
3
+ meshcoredecoder/__init__.py,sha256=TRQyFtXhpq_KRy8Zh4IZj55vYypmL1KbmeBUH1rldaU,275
4
4
  meshcoredecoder/crypto/__init__.py,sha256=00r884_WImNp5YOYfSKYtUaIj6gZdyJV0--xC_Y71Ok,236
5
5
  meshcoredecoder/crypto/channel_crypto.py,sha256=sNQq-CRr6zVGFOFO0Q7z5kVm7lYHY9fJsBjlSdssjTY,57242
6
- meshcoredecoder/crypto/ed25519_verifier.py,sha256=gndPYcoqnJ35mRdeAHSOzQuEKABd50XeKIWTOK1mKlY,5063
6
+ meshcoredecoder/crypto/ed25519_verifier.py,sha256=9DAx0gqnf9I7fPxfKU4G1y0GbJK1stCtTKpCX4foL5k,5057
7
7
  meshcoredecoder/crypto/key_manager.py,sha256=FXABZBd1B0kQwpyg7EX-pZDqxh5KVKnlB7A1FE3NQeU,5034
8
8
  meshcoredecoder/decoder/__init__.py,sha256=P_E5CQS1eXoVy59A1mAV9TD5XCS6FpQpc4RizhOZVrw,654
9
- meshcoredecoder/decoder/packet_decoder.py,sha256=nHrdej--PbaIqxVx2AMpxxIeQdeniW8z_3_UnXsxzM4,24351
9
+ meshcoredecoder/decoder/packet_decoder.py,sha256=eNiOQdfUWU1Sb0mbo94Ox2CFMxz01XLwCm1mjtBdNwY,24351
10
10
  meshcoredecoder/decoder/payload_decoders/__init__.py,sha256=DGuu2SfDuAEg8hu9V6iWcxyXOUoen816SqcdZgVzHmU,778
11
11
  meshcoredecoder/decoder/payload_decoders/ack.py,sha256=W6JgF6ylf-Y5IWW33P-_EHTz5GEYY_-ng_aUxvDdHac,3299
12
- meshcoredecoder/decoder/payload_decoders/advert.py,sha256=v8I-HZtgsiB2pVJdI1KdnezhbNUkYg7o0FEkYCJbdUQ,12640
12
+ meshcoredecoder/decoder/payload_decoders/advert.py,sha256=OiOvjD2Db6d5GPA0Og2j7BQReGWLhiv6OcoyOtzZWOg,12627
13
13
  meshcoredecoder/decoder/payload_decoders/anon_request.py,sha256=IhoQLnC7_7MDbdZLtFjcBBbAbQ-EC9k6JFfirhct3wg,7839
14
14
  meshcoredecoder/decoder/payload_decoders/group_data.py,sha256=llDm6lXDYqM_3udSz7lOtKCfHR39hUa5zivyfs21B_U,5435
15
15
  meshcoredecoder/decoder/payload_decoders/group_text.py,sha256=BhdF1ZYrMS_UH7-xRxeNHU1WvgNf2Buk9SxpDN0YYcQ,5526
@@ -27,9 +27,9 @@ meshcoredecoder/utils/__init__.py,sha256=0_EpRPd97R2Cead_BTG9SDS6vVZV268u3XBkA-s
27
27
  meshcoredecoder/utils/auth_token.py,sha256=gVVgHH_Am1k-cZxPbrTHCafvqdWSqlg9Dw-RRYaRI8Y,6973
28
28
  meshcoredecoder/utils/enum_names.py,sha256=6cSkbxexW8PT4MkwvWUA-oHQCvELUN2o3alIbp8bkP0,1936
29
29
  meshcoredecoder/utils/hex.py,sha256=IjDuoeIAr7swv9Fa1NKstZTotTwmtufdi_psCjqVU5k,1136
30
- meshcoredecoder-0.2.0.dist-info/licenses/LICENSE,sha256=W4bNA8wxOTF7Wmcmi5UwjrrKnjT_Qua52Z5wQLPLfKM,1130
31
- meshcoredecoder-0.2.0.dist-info/METADATA,sha256=Dus_QMf-Pw0SS1VeM3teDpZplmrMGL0KyFqxQhO7asE,30785
32
- meshcoredecoder-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- meshcoredecoder-0.2.0.dist-info/entry_points.txt,sha256=P8cgSHWETiDCc2jRCB95PuVyJDDeSq0gH-ufYVlqWDY,45
34
- meshcoredecoder-0.2.0.dist-info/top_level.txt,sha256=Rj9ZjVG2I6CEgpgF8I_QqUDp-vTQEdYm2KD93mIGkJM,26
35
- meshcoredecoder-0.2.0.dist-info/RECORD,,
30
+ meshcoredecoder-0.2.2.dist-info/licenses/LICENSE,sha256=W4bNA8wxOTF7Wmcmi5UwjrrKnjT_Qua52Z5wQLPLfKM,1130
31
+ meshcoredecoder-0.2.2.dist-info/METADATA,sha256=DxrnPrLbXVm4Gly-j5cJjMuQkPgTeA_E-xjcK8y_p3I,30671
32
+ meshcoredecoder-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ meshcoredecoder-0.2.2.dist-info/entry_points.txt,sha256=P8cgSHWETiDCc2jRCB95PuVyJDDeSq0gH-ufYVlqWDY,45
34
+ meshcoredecoder-0.2.2.dist-info/top_level.txt,sha256=Rj9ZjVG2I6CEgpgF8I_QqUDp-vTQEdYm2KD93mIGkJM,26
35
+ meshcoredecoder-0.2.2.dist-info/RECORD,,