This Arduino stack allows you to save the session keys (and network id, upload counter):
I’m basing a node on this library for use with an ESP32 TTGO LoRa board where the session keys and some counters are stored in (simulated) EEPROM here. In the EV_JOINED callback, I’m saving them:
Upon startup, I check my EEPROM structure for a previously saved session, and restore it using either LMIC_SetSession(…), or do a JOIN using LMIC_StartJoining():