Skip to content

Wire Packet Formats

faragher edited this page Oct 2, 2024 · 11 revisions

Announce

Headers as typical.

Data:

Field Size Content
Public Key 32 Identity's public encryption key
Signing Key 32 Identity's public signing key
Name Hash 10 Full hash of expanded name
Random Hash 10 Random Hash [5 bytes] + time[5 bytes]
Ratchet 32 Ed25519 Ratchet Hash
Signature 64 Ed25519 signature of signed data
Application Data Varies: 0 - 285 String or msgpack data

Public Key

x25519 public key for encryption/decryption and creation of shared secrets.

Signing Key

Ed25519 public key used for signing, including the Announce

Name Hash

SHA 256 hash of full name, truncated to 10 bytes. Full name consists of the app_name and aspect(s), separated by a period. Example: lxmf.delivery . This is the raw bytes without any string terminator or similar additional bytes.

Random Hash

5 bytes random, 5 time. Further clarification required.

Ratchet

Section incomplete.

Signature

Signed data consists of the destination hash, public keys, name hash, random hash, and (if applicable) app_data. Signed using Ed25519 signing key.

Application Data

Legacy Application Data for Peers and Nodes is a string with the friendly name. Modern Announces use a msgpacked array that contains the name as an array of bytes and the ticket cost, if any.

Field Type Use
0 Array Friendly name
1 Byte Ticket value

Application Data for Propagation Nodes is a msgpacked list.

Field Type Use
0 Bool Enable/disable peer (?)
1 Int32 Timestamp
2 Int16 Max transfer size, kB

Notes

Maximum specified Application Data length on wire is 465 bytes. With a type 1 header, absolute maximum is 481 bytes before violating MDU. An announce, using a type 2 header and with 148 bytes of fixed data, limits the Application Data in an announce to 317 bytes; it is good practice to keep this data as small as possible due to transmission to all stations, including LoRa and RF equipped nodes. Given the limited memory on MCUs, this may be application limited.

The destination hash can be determined by concatenating the Name Hash and Identity Hash (which, in turn, is the SHA hash of the x25519 + Ed25519 public keys, truncated to 16 bits). This allows for full verification of the Name and Destination hashes.