manuelbl/ttn-esp32

`join(const char *devEui, const char *appEui, const char *appKey)` writes keys to NVS.

Closed this issue · 0 comments

Hi,
first of all: thank you for providing this library, it seems to be the most comprehensively documented and up-to-date LMIC library for ESP32.

While porting it to C for use in my projects, I've found a mismatch between documentation an implementation:

The in-code documentation of the function join(const char *devEui, const char *appEui, const char *appKey) explicitly states that the keys are not written into the NVS. However, this function calls TTNProvisioning::decodeKeys() which in turn calls TTNProvisioning::decode(). There, TTNProvisioning::saveKeys() is invoked, writing the keys to NVS. This also leads to the keys being written twice to NVS when calling TheThingsNetwork::provision().

Fixing this issue involves removing the call to TTNProvisioning::saveKeys() in TTNProvisioning::decodeKeys() and adapting the TTNProvisioning::processLine() function, which seems to expect that the decoding functions are automatically saving the keys.