fix: remove hardcoded keys and load them from NVS + script + key reset
This commit is contained in:
parent
7a07bb2522
commit
20fa0bc034
7 changed files with 31 additions and 36 deletions
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
RTC_DATA_ATTR uint8_t LWsession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE];
|
||||
|
||||
LoRaTransmitter::LoRaTransmitter(
|
||||
uint64_t joinEUI,
|
||||
uint64_t devEUI,
|
||||
uint8_t* nwkKey,
|
||||
uint8_t* appKey
|
||||
)
|
||||
: _joinEUI(joinEUI),
|
||||
_devEUI(devEUI),
|
||||
_radio(new Module(LORA_NSS, LORA_DIO0, LORA_RST, LORA_DIO1)),
|
||||
LoRaTransmitter::LoRaTransmitter()
|
||||
: _radio(new Module(LORA_NSS, LORA_DIO0, LORA_RST, LORA_DIO1)),
|
||||
_node(&_radio, &EU868)
|
||||
{
|
||||
memcpy(_nwkKey, nwkKey, 16);
|
||||
memcpy(_appKey, appKey, 16);
|
||||
_prefs.begin("lorawan", true);
|
||||
|
||||
_joinEUI = _prefs.getULong64("join_eui", 0);
|
||||
_devEUI = _prefs.getULong64("dev_eui", 0);
|
||||
_prefs.getBytes("nwk_key", _nwkKey, 16);
|
||||
_prefs.getBytes("app_key", _appKey, 16);
|
||||
|
||||
_prefs.end();
|
||||
|
||||
memset(_noncesBuffer, 0, RADIOLIB_LORAWAN_NONCES_BUF_SIZE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,7 @@
|
|||
|
||||
class LoRaTransmitter : public ITransmitter {
|
||||
public:
|
||||
LoRaTransmitter(
|
||||
uint64_t joinEUI,
|
||||
uint64_t devEUI,
|
||||
uint8_t* nwkKey,
|
||||
uint8_t* appKey
|
||||
);
|
||||
LoRaTransmitter();
|
||||
|
||||
TransmitError init() override;
|
||||
TransmitError join() override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue