Skip to content

Golden packet examples and test vectors

Vectors are produced by node scripts/generate-test-vectors.mjs using the reference wire parsers in lib/mesh-wire.mjs, Node crypto AES-256-CCM, and an independent AES-ECB CCM construction for cross-check. Committed ciphertext/MIC/PDU hex lives in tests/fixtures/golden-vectors.json. Tests consume those fixture values; they do not treat a re-encrypt of the same helper as the expected result.

Related: Packet layout, Channels & security, Base profile.

Generator

bash
node scripts/generate-test-vectors.mjs

Outputs structured JSON under tests/fixtures/golden-vectors.json.

How to read a vector

ColumnMeaning
Prefix fieldsverFlags, channelHash, sessionId, optional blocks
Nonce12-byte srcId || sessionId || messageId || fragmentWord
AADBase (16/20) + region + fragment; ttlRaw zero-masked at offset 0x04
innerBodyLenAES-CCM plaintext length (cipherLen)
Final PDUFull Mesh PDU (≤ 255 bytes)

Default-community PSK in these vectors is SHA256("LowMesh/v2/defaultCommunityPsk32"):

3DAC4E5626960D351DDC986C452CE1C7C62F189FF9732B8C17325D4D8DC50150

Vector catalog

#CaseStatus
1Minimal CCM-4 frame without dstIdComplete (ciphertext + 4-byte MIC)
2CCM-4 frame with dstIdComplete
3CCM-8 frame (MIC_MODE=01)Complete (8-byte MIC)
4Region block (HAS_REGION)Complete
5Fragmented PAYLOAD_BODY_V2 (totalCount=3)Complete; header fragmentIndex aligned
6Same messageId, different fragment → different nonce/ciphertextAsserted
7Same messageId, different sessionId → different nonce/ciphertextAsserted
8AAD ttlRaw zero-maskAAD byte at index 4 = 0x00
9Relay inserts routing block / decrements TTL; inner tail still authenticates; second relay appendsComplete
10Wrong key rejectionNegative test
11Modified authenticated header rejectionNegative test
12Modified ciphertext rejectionNegative test
13Modified MIC rejectionNegative test
14Reserved MIC_MODE (10/11)Parser drop
15ACK_BASIC full fixed 17-byte bodyComplete
16DM HKDF + CCM encryptionComplete

Vector 1 (excerpt)

FieldHex
Prefix0082000004D4C3B2A104030201010001
NonceD4C3B2A10403020101000000
AAD0082000000D4C3B2A104030201010001
Ciphertext4CBA1F27EFB1
MIC7AAC71F3
PDU0082000004D4C3B2A1040302010100014CBA1F27EFB17AAC71F3

Automated tests

bash
npm test

tests/mesh-wire.test.mjs covers 16/20-byte base parse/serialize, nonce uniqueness, PAYLOAD_BODY_V2 limits and header alignment, routing-growth budget, first/second relay breadcrumb insert, USB :LLLL framing, DM HKDF, ACK_BASIC SNR Q4, nodeId32 derivation/collision, and decryption of committed golden PDUs.

LowMeshOS — always open-source mesh protocol documentation