# Best practices to limit application payloads

**URL:** <https://www.thethingsnetwork.org/forum/t/best-practices-to-limit-application-payloads/1302>\
**Category:** Application Development\
**Created:** [February 21, 2016, 4:13pm UTC](https://www.thethingsnetwork.org/forum/t/best-practices-to-limit-application-payloads/1302 "2016-02-21T16:13:39Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [June 24, 2016, 11:26am UTC](https://www.thethingsnetwork.org/forum/t/best-practices-to-limit-application-payloads/1302/3 "2016-06-24T11:26:39Z")

</div>

> [@sdellava](#):
>
> the effect of encoding payload in a complex way so the only one that can use the data is the specific application

By design, given [LoRaWAN security](https://staging.thethingsnetwork.org/wiki/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](https://staging.thethingsnetwork.org/) and [command line tools](http://staging.thethingsnetwork.org/wiki/Backend/ttnctl/QuickStart) make security easy by handling the security keys for you. Next, TTN also allows you to [define decoding functions](https://github.com/TheThingsNetwork/examples/blob/master/workshops/TheThingsUno/README.md#get-your-data):

```javascript
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](http://staging.thethingsnetwork.org/wiki/Backend/ttnctl/ttnctl_applications_authorize). 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](https://www.thethingsnetwork.org/forum/t/best-practices-when-sending-gps-location-data/1242/14).)

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/best-practices-to-limit-application-payloads/1302)._
