mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-14 09:02:14 +00:00
Admin session key debugging messages
This commit is contained in:
parent
273beef148
commit
ab9268cba9
@ -4,6 +4,7 @@
|
|||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
|
#include "meshUtils.h"
|
||||||
#include <FSCommon.h>
|
#include <FSCommon.h>
|
||||||
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH
|
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH
|
||||||
#include "BleOta.h"
|
#include "BleOta.h"
|
||||||
@ -968,13 +969,16 @@ void AdminModule::setPassKey(meshtastic_AdminMessage *res)
|
|||||||
}
|
}
|
||||||
memcpy(res->session_passkey.bytes, session_passkey, 8);
|
memcpy(res->session_passkey.bytes, session_passkey, 8);
|
||||||
res->session_passkey.size = 8;
|
res->session_passkey.size = 8;
|
||||||
|
printBytes("Setting admin key to ", res->session_passkey.bytes, 8);
|
||||||
// if halfway to session_expire, regenerate session_passkey, reset the timeout
|
// if halfway to session_expire, regenerate session_passkey, reset the timeout
|
||||||
// set the key in the packet
|
// set the key in the packet
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AdminModule::checkPassKey(meshtastic_AdminMessage *res)
|
bool AdminModule::checkPassKey(meshtastic_AdminMessage *res)
|
||||||
{ // check that the key in the packet is still valid
|
{ // check that the key in the packet is still valid
|
||||||
return (session_time + 300 < millis() / 1000 && res->session_passkey.size == 8 &&
|
printBytes("Incoming session key: ", res->session_passkey.bytes, 8);
|
||||||
|
printBytes("Expected session key: ", session_passkey, 8);
|
||||||
|
return (session_time + 300 > millis() / 1000 && res->session_passkey.size == 8 &&
|
||||||
memcmp(res->session_passkey.bytes, session_passkey, 8) == 0);
|
memcmp(res->session_passkey.bytes, session_passkey, 8) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user