Repeater, room server, sensor, companion: build flag LOCKED_NODE for a node that keeps its secrets from whoever holds it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
64a103c673
commit
175c99dcdf
3 files changed
+26
No files matched your search
@@ -1070,6 +1070,16 @@ void MyMesh::startInterface(BaseSerialInterface &serial) {
|
||||
}
|
||||
|
||||
void MyMesh::handleCmdFrame(size_t len) {
|
||||
#ifdef LOCKED_NODE
|
||||
// CUSTOM (TeTeHacko): a locked companion serves only paired BLE. USB, a UART
|
||||
// and WiFi/TCP get the device info (so an app sees what it talks to) and
|
||||
// nothing else: no contacts, channels, messages or settings for whoever holds
|
||||
// the board or sits on the LAN. docs/locked-bootloader.md, point 4.
|
||||
if (!_serial->isConnectionSecure() && cmd_frame[0] != CMD_DEVICE_QUERY) {
|
||||
writeDisabledFrame();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (cmd_frame[0] == CMD_DEVICE_QUERY && len >= 2) { // sent when app establishes connection
|
||||
app_target_ver = cmd_frame[1]; // which version of protocol does app understand
|
||||
|
||||
@@ -2492,6 +2502,11 @@ void MyMesh::checkCLIRescueCmd() {
|
||||
cli_command[len - 1] = 0; // replace newline with C string null terminator
|
||||
|
||||
reply_buf[0] = 0;
|
||||
#ifdef LOCKED_NODE
|
||||
if (memcmp(cli_command, "set pin ", 8) == 0) { // CUSTOM (TeTeHacko): a known PIN = pair and read it all
|
||||
Serial.println(" Error: locked build");
|
||||
} else
|
||||
#endif
|
||||
if (handleCommand(cli_command, 0, reply_buf)) {
|
||||
// command was handled, print reply output
|
||||
Serial.print(" "); Serial.print(reply_buf); Serial.println();
|
||||
|
||||
Reference in new issue
Block a user