fix beacon: init Ed25519 identity for valid advert signature

This commit is contained in:
UA1ZBE
2026-07-22 13:39:33 +03:00
parent 62cf8fc3f4
commit d487b84926
2 changed files with 16 additions and 0 deletions

View File

@@ -351,6 +351,21 @@ void setup() {
fast_rng.begin(radio_driver.getRngSeed()); fast_rng.begin(radio_driver.getRngSeed());
{
File f = InternalFS.open(IDENTITY_FILE, FILE_O_READ);
if (f) {
uint8_t buf[PUB_KEY_SIZE + PRV_KEY_SIZE];
if (f.read(buf, sizeof(buf)) == sizeof(buf)) the_mesh.self_id.readFrom(buf, sizeof(buf));
f.close();
} else {
the_mesh.self_id = mesh::LocalIdentity(&fast_rng);
uint8_t buf[PUB_KEY_SIZE + PRV_KEY_SIZE];
the_mesh.self_id.writeTo(buf, sizeof(buf));
f = InternalFS.open(IDENTITY_FILE, FILE_O_WRITE);
if (f) { f.write(buf, sizeof(buf)); f.close(); }
}
}
the_mesh.setup_channel(); the_mesh.setup_channel();
the_mesh.begin(); the_mesh.begin();

View File

@@ -116,6 +116,7 @@
#define CONFIG_FILE "/security.cfg" #define CONFIG_FILE "/security.cfg"
#define CHANNEL_FILE "/channel.cfg" #define CHANNEL_FILE "/channel.cfg"
#define NAME_FILE "/name.cfg" #define NAME_FILE "/name.cfg"
#define IDENTITY_FILE "/identity.dat"
#define WDT_TIMEOUT_MS 10000 #define WDT_TIMEOUT_MS 10000
#include <RadioLib.h> #include <RadioLib.h>