From 727edc4ee32cdb7b54696fe8b2d366553d166127 Mon Sep 17 00:00:00 2001 From: you Date: Tue, 24 Mar 2026 01:32:58 +0000 Subject: [PATCH] fix: encrypted payload field sizes match firmware source (Mesh.cpp) Per firmware: PAYLOAD_VER_1 uses dest(1) + src(1) + MAC(2), not 6+6+4. Confirmed from Mesh.cpp lines 129-130: uint8_t dest_hash = payload[i++] and MeshCore.h: CIPHER_MAC_SIZE = 2. Changed: decodeEncryptedPayload (REQ/RESPONSE/TXT_MSG), decodeAck, decodeAnonReq (dest 1B + pubkey 32B + MAC 2B), decodePath (1+1+2). Updated test min-length assertions. --- public/index.html | 50 +++++++++++++++++++++++------------------------ test-decoder.js | 4 ++-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/public/index.html b/public/index.html index 2b46828..d469946 100644 --- a/public/index.html +++ b/public/index.html @@ -22,9 +22,9 @@ - - - + + + @@ -81,27 +81,27 @@
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-decoder.js b/test-decoder.js index 2d5a6f0..adc74cc 100644 --- a/test-decoder.js +++ b/test-decoder.js @@ -233,7 +233,7 @@ test('ACK decode', () => { }); test('ACK too short', () => { - const hex = '0D00' + '00'.repeat(10); + const hex = '0D00' + '00'.repeat(3); const p = decodePacket(hex); assert(p.payload.error); }); @@ -282,7 +282,7 @@ test('PATH decode', () => { }); test('PATH too short', () => { - const hex = '2100' + '00'.repeat(8); + const hex = '2100' + '00'.repeat(1); const p = decodePacket(hex); assert(p.payload.error); });