Best practices to limit application payloads

By design, given LoRaWAN security, a single specific application is the only one that can decrypt the data. You need an application to process the data from the network server; you cannot just make applications connect to some node or gateway.

First, TTN’s dashboard and command line tools make security easy by handling the security keys for you. Next, TTN also allows you to define decoding functions:

function Decoder (bytes, port) {
  // Sign-extend to 32 bits to support negative values, by shifting 24 bits
  // (too far) to the left, followed by a sign-propagating right shift: 
  var data = bytes[2]<<24>>16 | bytes[1];
  return {
    temperature: data / 100
  };
}

And finally, you can grant others access to the data. And presto: MQTT serves an additional readable fields to whomever you grant access, even though the node sends it in a binary format:

{
  "temperature": 21.5
}

(Full example and full MQTT response in Best practices when sending GPS location data.)