* Allow key verification to work for unknown nodes. * trunk * More reliable admin key decryption * Add admin key fallback tests * Actually check haveRemoteKey * Logging cleanup * Address review feedback - Persist the committed key + manually-verified flag in commitVerifiedRemoteNode via saveToDisk(SEGMENT_NODEDATABASE), replacing the "todo: initiate save" - Guard the CryptoEngine pending-key slot with a dedicated internal lock; the Router reads it while already holding the non-recursive cryptLock, so the accessors cannot reuse that lock - Draw the security number from the hardware RNG (CryptRNG fallback) under cryptLock instead of random(); on nRF52 the entropy fill toggles the same CC310 the BLE task's packet crypto uses - Return true after fully handling the hash2 response (restores develop behavior; consistent with the hash1 branch) - Take uint32_t in the number-picker callbacks so 8-digit hex nodenums can't truncate through int - Trim over-long comments flagged by review * feat(tests): add deterministic tests for admin session-key behavior --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
28 lines
1015 B
C++
28 lines
1015 B
C++
#pragma once
|
|
// The one class AdminModule.h befriends (test seam): exposes the protected/private handlers to the
|
|
// native suites and defers persistence so setters exercise in-RAM logic without disk/reboot effects.
|
|
#include "MeshTypes.h" // packetPool
|
|
#include "modules/AdminModule.h"
|
|
|
|
class AdminModuleTestShim : public AdminModule
|
|
{
|
|
public:
|
|
using AdminModule::checkPassKey; // session-key gate seam (see test_admin_session_repro)
|
|
using AdminModule::handleReceivedProtobuf;
|
|
using AdminModule::handleSetConfig;
|
|
using AdminModule::handleSetModuleConfig;
|
|
using AdminModule::setPassKey;
|
|
|
|
// With an "open edit transaction" saveChanges() is a pure no-op: no reloadConfig/saveToDisk/reboot.
|
|
void deferSaves() { hasOpenEditTransaction = true; }
|
|
|
|
// Setters may allocate an error reply from packetPool; drain it each iteration or the pool leaks.
|
|
void drainReply()
|
|
{
|
|
if (myReply) {
|
|
packetPool.release(myReply);
|
|
myReply = nullptr;
|
|
}
|
|
}
|
|
};
|