How to decrypt payload FRMPayload on app-server

Hello.
I installed the server, app-server and so on and subscribed to MQTT with Node.red. I can see all fields but “data” field is encrypted, like this:

{“applicationID”:“1”,“applicationName”:“test_ds18b20”,“deviceName”:“arduino_uno”,“devEUI”:“1234567890123456”,“rxInfo”:[{“mac”:“aa755a0048050130”,“rssi”:-57,“loRaSNR”:10,“name”:“raspberry_pi”,“latitude”:48.466860686785175,“longitude”:1.019478797912605,“altitude”:0}],“txInfo”:{“frequency”:868100000,“dataRate”:{“modulation”:“LORA”,“bandwidth”:125,“spreadFactor”:7},“adr”:true,“codeRate”:“4/5”},“fCnt”:9,“fPort”:1,“data”:“Z29vZGJ5ZQ==”,“object”:{}}

I cant decrypt this on Node.red side.
On app-server i found this setting “Payload codec”.
and it gives me some choices: Caayenne LPP - didnt work and gives me same encrypted data, and Custom JavaScript codec functions:


but i dont know what i must change on this function. Should i paste here my fPort number? If yes what about bytes, where i must get it?

Basically i want to recieve in node.red something like this (data with object):

“fCnt”: 10, // frame-counter
“fPort”: 5, // FPort
“data”: “…”, // base64 encoded payload (decrypted)
“object”: { // decoded object (when application coded has been configured)
“temperatureSensor”: {“1”: 25},
“humiditySensor”: {“1”: 32}
}
}
as mentioned here - https://docs.loraserver.io/lora-app-server/integrate/data/
Also i saw this - lorawan package - github.com/brocaar/lorawan - Go Packages but i dont know what to do exactley, should i just paste code from this link to Custom JavaScript codec functions in app-server or what?
Can @brocaar please guide me how to do this and if possible with some examples
Thanks alot

3 posts were merged into an existing topic: Receiving device data / FRMPayload