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.
This commit is contained in:
you
2026-03-24 01:32:58 +00:00
parent a955d4b6a7
commit 727edc4ee3
2 changed files with 27 additions and 27 deletions
+2 -2
View File
@@ -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);
});