anthonykirby / lora-packet

LoRa radio packet decoder
MIT License
261 stars 83 forks source link

Decrypt Packet #1

Closed addingama closed 8 years ago

addingama commented 8 years ago

Hi @anthonykirby ,

I really need your help.

I've subscribed to lora mqtt topic from node and get the json.

{"devEUI":"0102030405060708","fPort":1,"gatewayCount":1,"rssi":-74,"data":"APyLyjXKDQ=="}

I already have appSKey and nwkSKey.

But I don't know how to use your library to decrypt the data.

In your documentation, you wrote this

// decode a packet
var packet = lora_packet.fromWire(new Buffer('40F17DBE4900020001954378762B11FF0D', 'hex'));

Is the string in Buffer construction should be replaced with data from my JSON?

I really appreciate your help.

Thanks

anthonykirby commented 8 years ago

Hi dashracer, lora-packet is designed to decode wire-format (really radio-format, I suppose) data. I think that the data you've got, received via MQTT, is some way downstream of this, and lora-packet isn't the library that you are looking for. Your "data" element contains what looks like Base-64 encoded data, so I guess that all you need to do is Base64 decoding. In any case, it's too small to be a raw LoRa packet (see the tests). good luck, Anthony