From be47032155cd7a52259886b186332c614bf2be6c Mon Sep 17 00:00:00 2001 From: Satakun Utama Date: Sun, 30 Nov 2025 15:23:20 +0700 Subject: [PATCH] Initial commit --- .gitignore | 5 ++ .vscode/extensions.json | 10 ++++ include/README | 37 +++++++++++++ lib/README | 46 ++++++++++++++++ platformio.ini | 16 ++++++ src/FileUtils.h | 21 ++++++++ src/HttpApi.h | 71 ++++++++++++++++++++++++ src/HttpData.h | 60 +++++++++++++++++++++ src/WiFiUtils.h | 117 ++++++++++++++++++++++++++++++++++++++++ src/cert.h | 95 ++++++++++++++++++++++++++++++++ src/main.cpp | 69 ++++++++++++++++++++++++ src/private_key.h | 108 +++++++++++++++++++++++++++++++++++++ test/README | 11 ++++ 13 files changed, 666 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 include/README create mode 100644 lib/README create mode 100644 platformio.ini create mode 100644 src/FileUtils.h create mode 100644 src/HttpApi.h create mode 100644 src/HttpData.h create mode 100644 src/WiFiUtils.h create mode 100644 src/cert.h create mode 100644 src/main.cpp create mode 100644 src/private_key.h create mode 100644 test/README diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/include/README b/include/README new file mode 100644 index 0000000..49819c0 --- /dev/null +++ b/include/README @@ -0,0 +1,37 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the convention is to give header files names that end with `.h'. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/lib/README b/lib/README new file mode 100644 index 0000000..9379397 --- /dev/null +++ b/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into the executable file. + +The source code of each library should be placed in a separate directory +("lib/your_library_name/[Code]"). + +For example, see the structure of the following example libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +Example contents of `src/main.c` using Foo and Bar: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +The PlatformIO Library Dependency Finder will find automatically dependent +libraries by scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..f7a08f4 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,16 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:nodemcu-32s] +platform = espressif32 +board = nodemcu-32s +framework = arduino +board_build.filesystem = littlefs +lib_deps = fhessel/esp32_https_server@^1.0.0 diff --git a/src/FileUtils.h b/src/FileUtils.h new file mode 100644 index 0000000..4c2e10b --- /dev/null +++ b/src/FileUtils.h @@ -0,0 +1,21 @@ +#include + +void writeFile(const char *path, String message) +{ + File file = LittleFS.open(path, "w"); + if (!file) + { + Serial.println("Failed to open file for writing"); + } + + if (file.print(message)) + { + Serial.printf("File %s written.\n", path); + } + else + { + Serial.printf("Writing to file %s failed\n", path); + } + delay(1000); + file.close(); +} diff --git a/src/HttpApi.h b/src/HttpApi.h new file mode 100644 index 0000000..fb1221b --- /dev/null +++ b/src/HttpApi.h @@ -0,0 +1,71 @@ +#include + +using namespace httpsserver; + +std::string sessionToken; + +bool checkHeader(HTTPRequest *req) +{ + auto auth = req->getHeader("Authorization"); + + std::string bearer = "Bearer "; + bearer.append(sessionToken); + + return auth == bearer; +} + +void restart(HTTPRequest *req, HTTPResponse *res) +{ + if (!checkHeader(req)) + { + res->setStatusCode(403); + return; + } + + res->setStatusCode(200); + ESP.restart(); +} + +void logs(HTTPRequest *req, HTTPResponse *res) +{ + if (!checkHeader(req)) + { + res->setStatusCode(403); + return; + } + + res->setHeader("Content-Type", "application/json"); + res->println("[]"); +} + +uint32_t getRandom() +{ + return *(volatile uint32_t *)0x3FF20E44; +} + +const char *charSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +const uint8_t tokenLength = 16; + +std::string getToken() +{ + Serial.println(sizeof(charSet)); + std::string token; + token.reserve(tokenLength); + + for (uint8_t i = 0; i < tokenLength; i++) + { + token.push_back(charSet[random(0, sizeof(charSet) - 1)]); + } + + sessionToken = token; + return sessionToken; +} + +void setupApi(HTTPSServer *server) +{ + ResourceNode *restartNode = new ResourceNode("/api/restart", "GET", restart); + ResourceNode *logsNode = new ResourceNode("/api/logs", "GET", logs); + + server->registerNode(restartNode); + server->registerNode(logsNode); +} diff --git a/src/HttpData.h b/src/HttpData.h new file mode 100644 index 0000000..d76dea5 --- /dev/null +++ b/src/HttpData.h @@ -0,0 +1,60 @@ +#include + +const char *server_cert PROGMEM = R"EOF( +-----BEGIN CERTIFICATE----- +MIIEJzCCAw+gAwIBAgIUFdkVCFw9RTqLgFY3gH1ok1qWYhowDQYJKoZIhvcNAQEL +BQAwgZkxCzAJBgNVBAYTAlRIMRIwEAYDVQQIDAlOb25nLUtoYWkxFzAVBgNVBAoM +DlRyYXNoYmluIEdhbWVzMRQwEgYDVQQLDAtJb1QgRGV2aWNlczEaMBgGA1UEAwwR +bGl0ZWF1dGggTG9jYWwgQ0ExKzApBgkqhkiG9w0BCQEWHGxpbmVzb2Zjb2Rlc0Bk +YWlsaXRhdGlvbi54eXowHhcNMjUxMTA5MDgxNzUxWhcNMjYxMTA5MDgxNzUxWjCB +ljELMAkGA1UEBhMCVEgxEjAQBgNVBAgMCU5vbmctS2hhaTEXMBUGA1UECgwOVHJh +c2hiaW4gR2FtZXMxFDASBgNVBAsMC0lvVCBEZXZpY2VzMRcwFQYDVQQDDA5saXRl +YXV0aC5sb2NhbDErMCkGCSqGSIb3DQEJARYcbGluZXNvZmNvZGVzQGRhaWxpdGF0 +aW9uLnh5ejCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN+nuEe+u475 +6WOzrNL/4sdjwxTlRfIQ2yTrhQE3iVvryzzt8agleyB3+B9/PlNw68t8pg7PCmPI +RhDbrP1qFfU1rYsOuS0NWzABB35hJG1NbHxvUnu5K3EEibIA4pSRn3l0EMOe6oeX +8IdRg0Wl2iXckDGBXzPWxWQAPkzB3toLIG8jGtjoyJ0lzPkxdpXBo3TZZuZnIXU3 +B86Ejhk0iFcoO9Jz3BQKsvA1NtG9aicEsJTHu2lkqSNDK6JlEYRfH12C8ANNwTBf +yLLmmE1VmvzorzJOrw/NCRVMAvM7CiiHPQHrgpB563ijCxG+TOh0rQTkosSxMG+t +XPpk/sw1vZECAwEAAaNoMGYwHwYDVR0jBBgwFoAUGIiWaK06C0piayKrZ8nGLZ6S +/3QwCQYDVR0TBAIwADAZBgNVHREEEjAQgg5saXRlYXV0aC5sb2NhbDAdBgNVHQ4E +FgQU78QuM1qvnifVMfFpz27jzPRS4DUwDQYJKoZIhvcNAQELBQADggEBADJKAZXm +i/P2U/BFZh66etw4siM3uVXtIuoL4+wSVNZgb2yOpLGk0FRWvuuIJ4SxMtlsva5/ ++5p3O/y3tMAcylVj+kn6h7V5/6/RhNYb8BbmIDMViBxkPqEu7CPnfrtVSwcIXJ44 +P35t6dFuc1W21JL3yNf2EkB32DAt+smjHDKV6izmTovGcbkeTMf/TUJv7J4bnp52 +UhRZob0cQbb1HdDmZ6HTauJxzixKxUk043s1Sq8j+pvMVaqDVfapoqqPxSv+ml/j +Vu/h/ewarRvnSjFloPFSgyeQjwS3TpA08ppdIuAcF589q5fW+IoG8jmFSetZnr55 +z0xONgWPCvoS4aA= +-----END CERTIFICATE----- +)EOF"; + +const char *server_private_key PROGMEM = R"EOF( +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDfp7hHvruO+elj +s6zS/+LHY8MU5UXyENsk64UBN4lb68s87fGoJXsgd/gffz5TcOvLfKYOzwpjyEYQ +26z9ahX1Na2LDrktDVswAQd+YSRtTWx8b1J7uStxBImyAOKUkZ95dBDDnuqHl/CH +UYNFpdol3JAxgV8z1sVkAD5Mwd7aCyBvIxrY6MidJcz5MXaVwaN02WbmZyF1NwfO +hI4ZNIhXKDvSc9wUCrLwNTbRvWonBLCUx7tpZKkjQyuiZRGEXx9dgvADTcEwX8iy +5phNVZr86K8yTq8PzQkVTALzOwoohz0B64KQeet4owsRvkzodK0E5KLEsTBvrVz6 +ZP7MNb2RAgMBAAECggEAE0i4FjGPJPcN5VuY53GKSXRj3fGd3A8RgievhmkWNh+I +3NZMW5ntuaE2eurDAjlOj3NOMyEtbWiXh/0U9521yniIH+ETXNvVtLgmAALau/Ts +yXbkx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/7N/9ppGaxC6P7Np+yQTv6uwYNyGtWOhKORUcPR +JkzV1/dXVBSKdgGu4B3w3g== +-----END PRIVATE KEY----- +)EOF"; diff --git a/src/WiFiUtils.h b/src/WiFiUtils.h new file mode 100644 index 0000000..2a92a5c --- /dev/null +++ b/src/WiFiUtils.h @@ -0,0 +1,117 @@ +#include +#include +#include + +const char *wifiInfo = "/wifi.conf"; + +const char *getStatusMessage(wl_status_t status) +{ + switch (status) + { + case WL_NO_SHIELD: + return "No Arduino Shield"; + case WL_IDLE_STATUS: + return "Idle"; + case WL_NO_SSID_AVAIL: + return "No SSID available"; + case WL_SCAN_COMPLETED: + return "Scan completed"; + case WL_CONNECTED: + return "Connected"; + case WL_CONNECT_FAILED: + return "Connection failed"; + case WL_CONNECTION_LOST: + return "Connection lost"; + case WL_DISCONNECTED: + return "Disconnected"; + } + + return ""; +} + +void wifiSmartConfig() +{ + WiFi.beginSmartConfig(); + + // Wait for SmartConfig packet from mobile + Serial.println("Waiting for SmartConfig."); + while (!WiFi.smartConfigDone()) + { + delay(500); + Serial.print("."); + } + + Serial.println(""); + Serial.println("SmartConfig received."); + + // Wait for WiFi to connect to AP + Serial.println("Waiting for Wi-Fi"); + while (WiFi.status() != WL_CONNECTED) + { + delay(500); + Serial.print("."); + } + + Serial.println("Wi-Fi Connected."); + + Serial.print("IP Address: "); + Serial.println(WiFi.localIP()); + + Serial.println("Saving network information to LittleFS..."); + + String ssid = WiFi.SSID(); + String content = String(ssid); + String pass = WiFi.psk(); + + content.concat("\n"); + content.concat(pass); + + writeFile("/wifi.conf", content); +} + +/// @brief Try saved WiFi credentials +/// @return Returns true if connected +bool trySavedWiFi() +{ + File file = LittleFS.open(wifiInfo, "r"); + + if (!file) + { + return false; + } + + String ssid = file.readStringUntil('\n'); + String pass = file.readString(); + file.close(); + + Serial.println("Saved SSID:"); + Serial.println(ssid); + Serial.println("Saved PSK:"); + Serial.println(pass); + + Serial.println("Trying to connect to saved Wi-Fi... (Waiting for 6 seconds)"); + + WiFi.begin(ssid, pass); + + delay(6000); + auto status = WiFi.status(); + Serial.printf("Wi-Fi Status: %d (%s)\n", status, getStatusMessage(status)); + + return WiFi.status() == WL_CONNECTED; +} + +void initWiFi() +{ + // Init WiFi as Station, start SmartConfig + WiFi.mode(WIFI_STA); + delay(500); + + if (trySavedWiFi()) + { + Serial.print("IP Address: "); + Serial.println(WiFi.localIP()); + return; + } + + wifiSmartConfig(); +} diff --git a/src/cert.h b/src/cert.h new file mode 100644 index 0000000..14ef784 --- /dev/null +++ b/src/cert.h @@ -0,0 +1,95 @@ +#ifndef CERT_H_ +#define CERT_H_ +unsigned char projectCert_der[] = { + 0x30, 0x82, 0x04, 0x27, 0x30, 0x82, 0x03, 0x0f, 0xa0, 0x03, 0x02, 0x01, + 0x02, 0x02, 0x14, 0x15, 0xd9, 0x15, 0x08, 0x5c, 0x3d, 0x45, 0x3a, 0x8b, + 0x80, 0x56, 0x37, 0x80, 0x7d, 0x68, 0x93, 0x5a, 0x96, 0x62, 0x1a, 0x30, + 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, + 0x05, 0x00, 0x30, 0x81, 0x99, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, + 0x04, 0x06, 0x13, 0x02, 0x54, 0x48, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, + 0x55, 0x04, 0x08, 0x0c, 0x09, 0x4e, 0x6f, 0x6e, 0x67, 0x2d, 0x4b, 0x68, + 0x61, 0x69, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, + 0x0e, 0x54, 0x72, 0x61, 0x73, 0x68, 0x62, 0x69, 0x6e, 0x20, 0x47, 0x61, + 0x6d, 0x65, 0x73, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, + 0x0c, 0x0b, 0x49, 0x6f, 0x54, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x11, + 0x6c, 0x69, 0x74, 0x65, 0x61, 0x75, 0x74, 0x68, 0x20, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x20, 0x43, 0x41, 0x31, 0x2b, 0x30, 0x29, 0x06, 0x09, 0x2a, + 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x1c, 0x6c, 0x69, + 0x6e, 0x65, 0x73, 0x6f, 0x66, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x40, 0x64, + 0x61, 0x69, 0x6c, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, + 0x79, 0x7a, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x35, 0x31, 0x31, 0x30, 0x39, + 0x30, 0x38, 0x31, 0x37, 0x35, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x36, 0x31, + 0x31, 0x30, 0x39, 0x30, 0x38, 0x31, 0x37, 0x35, 0x31, 0x5a, 0x30, 0x81, + 0x96, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, + 0x54, 0x48, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, + 0x09, 0x4e, 0x6f, 0x6e, 0x67, 0x2d, 0x4b, 0x68, 0x61, 0x69, 0x31, 0x17, + 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0e, 0x54, 0x72, 0x61, + 0x73, 0x68, 0x62, 0x69, 0x6e, 0x20, 0x47, 0x61, 0x6d, 0x65, 0x73, 0x31, + 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0b, 0x49, 0x6f, + 0x54, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x31, 0x17, 0x30, + 0x15, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0e, 0x6c, 0x69, 0x74, 0x65, + 0x61, 0x75, 0x74, 0x68, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x31, 0x2b, + 0x30, 0x29, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, + 0x01, 0x16, 0x1c, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x6f, 0x66, 0x63, 0x6f, + 0x64, 0x65, 0x73, 0x40, 0x64, 0x61, 0x69, 0x6c, 0x69, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x7a, 0x30, 0x82, 0x01, 0x22, 0x30, + 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, + 0x82, 0x01, 0x01, 0x00, 0xdf, 0xa7, 0xb8, 0x47, 0xbe, 0xbb, 0x8e, 0xf9, + 0xe9, 0x63, 0xb3, 0xac, 0xd2, 0xff, 0xe2, 0xc7, 0x63, 0xc3, 0x14, 0xe5, + 0x45, 0xf2, 0x10, 0xdb, 0x24, 0xeb, 0x85, 0x01, 0x37, 0x89, 0x5b, 0xeb, + 0xcb, 0x3c, 0xed, 0xf1, 0xa8, 0x25, 0x7b, 0x20, 0x77, 0xf8, 0x1f, 0x7f, + 0x3e, 0x53, 0x70, 0xeb, 0xcb, 0x7c, 0xa6, 0x0e, 0xcf, 0x0a, 0x63, 0xc8, + 0x46, 0x10, 0xdb, 0xac, 0xfd, 0x6a, 0x15, 0xf5, 0x35, 0xad, 0x8b, 0x0e, + 0xb9, 0x2d, 0x0d, 0x5b, 0x30, 0x01, 0x07, 0x7e, 0x61, 0x24, 0x6d, 0x4d, + 0x6c, 0x7c, 0x6f, 0x52, 0x7b, 0xb9, 0x2b, 0x71, 0x04, 0x89, 0xb2, 0x00, + 0xe2, 0x94, 0x91, 0x9f, 0x79, 0x74, 0x10, 0xc3, 0x9e, 0xea, 0x87, 0x97, + 0xf0, 0x87, 0x51, 0x83, 0x45, 0xa5, 0xda, 0x25, 0xdc, 0x90, 0x31, 0x81, + 0x5f, 0x33, 0xd6, 0xc5, 0x64, 0x00, 0x3e, 0x4c, 0xc1, 0xde, 0xda, 0x0b, + 0x20, 0x6f, 0x23, 0x1a, 0xd8, 0xe8, 0xc8, 0x9d, 0x25, 0xcc, 0xf9, 0x31, + 0x76, 0x95, 0xc1, 0xa3, 0x74, 0xd9, 0x66, 0xe6, 0x67, 0x21, 0x75, 0x37, + 0x07, 0xce, 0x84, 0x8e, 0x19, 0x34, 0x88, 0x57, 0x28, 0x3b, 0xd2, 0x73, + 0xdc, 0x14, 0x0a, 0xb2, 0xf0, 0x35, 0x36, 0xd1, 0xbd, 0x6a, 0x27, 0x04, + 0xb0, 0x94, 0xc7, 0xbb, 0x69, 0x64, 0xa9, 0x23, 0x43, 0x2b, 0xa2, 0x65, + 0x11, 0x84, 0x5f, 0x1f, 0x5d, 0x82, 0xf0, 0x03, 0x4d, 0xc1, 0x30, 0x5f, + 0xc8, 0xb2, 0xe6, 0x98, 0x4d, 0x55, 0x9a, 0xfc, 0xe8, 0xaf, 0x32, 0x4e, + 0xaf, 0x0f, 0xcd, 0x09, 0x15, 0x4c, 0x02, 0xf3, 0x3b, 0x0a, 0x28, 0x87, + 0x3d, 0x01, 0xeb, 0x82, 0x90, 0x79, 0xeb, 0x78, 0xa3, 0x0b, 0x11, 0xbe, + 0x4c, 0xe8, 0x74, 0xad, 0x04, 0xe4, 0xa2, 0xc4, 0xb1, 0x30, 0x6f, 0xad, + 0x5c, 0xfa, 0x64, 0xfe, 0xcc, 0x35, 0xbd, 0x91, 0x02, 0x03, 0x01, 0x00, + 0x01, 0xa3, 0x68, 0x30, 0x66, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, + 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x18, 0x88, 0x96, 0x68, 0xad, 0x3a, + 0x0b, 0x4a, 0x62, 0x6b, 0x22, 0xab, 0x67, 0xc9, 0xc6, 0x2d, 0x9e, 0x92, + 0xff, 0x74, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, + 0x00, 0x30, 0x19, 0x06, 0x03, 0x55, 0x1d, 0x11, 0x04, 0x12, 0x30, 0x10, + 0x82, 0x0e, 0x6c, 0x69, 0x74, 0x65, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, + 0x16, 0x04, 0x14, 0xef, 0xc4, 0x2e, 0x33, 0x5a, 0xaf, 0x9e, 0x27, 0xd5, + 0x31, 0xf1, 0x69, 0xcf, 0x6e, 0xe3, 0xcc, 0xf4, 0x52, 0xe0, 0x35, 0x30, + 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, + 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x32, 0x4a, 0x01, 0x95, 0xe6, + 0x8b, 0xf3, 0xf6, 0x53, 0xf0, 0x45, 0x66, 0x1e, 0xba, 0x7a, 0xdc, 0x38, + 0xb2, 0x23, 0x37, 0xb9, 0x55, 0xed, 0x22, 0xea, 0x0b, 0xe3, 0xec, 0x12, + 0x54, 0xd6, 0x60, 0x6f, 0x6c, 0x8e, 0xa4, 0xb1, 0xa4, 0xd0, 0x54, 0x56, + 0xbe, 0xeb, 0x88, 0x27, 0x84, 0xb1, 0x32, 0xd9, 0x6c, 0xbd, 0xae, 0x7f, + 0xfb, 0x9a, 0x77, 0x3b, 0xfc, 0xb7, 0xb4, 0xc0, 0x1c, 0xca, 0x55, 0x63, + 0xfa, 0x49, 0xf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0x4e, 0x36, 0x05, 0x8f, 0x0a, 0xfa, 0x12, 0xe1, 0xa0 +}; +unsigned int projectCert_der_len = 1067; +#endif diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..7dc9dd8 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,69 @@ +#define HTTPS_DISABLE_SELFSIGNING 1 + +#include +#include +#include +#include +#include +#include +#include +#include "cert.h" +#include "private_key.h" + +using namespace httpsserver; + +SSLCert cert = SSLCert( + projectCert_der, projectCert_der_len, + projectKey_der, projectKey_der_len); + +HTTPSServer server = HTTPSServer(&cert); + +void handleRoot(HTTPRequest *req, HTTPResponse *res) +{ + res->setHeader("Content-Type", "text/plain"); + res->println("Hello from ESP32 over HTTPS!\n"); +} + +void setupServer() +{ + if (MDNS.begin("liteauth")) + { + Serial.println("MDNS responder started"); + } + + // server.getServer().setRSACert(new BearSSL::X509List(server_cert), new BearSSL::PrivateKey(server_private_key)); + // server.getServer().setCache(&serverCache); + + ResourceNode *nodeRoot = new ResourceNode("/", "GET", &handleRoot); + + server.registerNode(nodeRoot); + server.start(); + + MDNS.addService("https", "tcp", 443); +} + +void setup() +{ + Serial.begin(9600); + + if (!LittleFS.begin()) + { + Serial.println("An error occurred while mounting LittleFS!"); + return; + } + + initWiFi(); + + setupServer(); + + Serial.print("Token for this session: "); + Serial.println(getToken().c_str()); + + setupApi(&server); +} + +void loop() +{ + server.loop(); + delay(1); +} diff --git a/src/private_key.h b/src/private_key.h new file mode 100644 index 0000000..873c37e --- /dev/null +++ b/src/private_key.h @@ -0,0 +1,108 @@ +#ifndef PRIVATE_KEY_H_ +#define PRIVATE_KEY_H_ +unsigned char projectKey_der[] = { + 0x30, 0x82, 0x04, 0xbc, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, + 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, + 0x04, 0xa6, 0x30, 0x82, 0x04, 0xa2, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, + 0x01, 0x00, 0xdf, 0xa7, 0xb8, 0x47, 0xbe, 0xbb, 0x8e, 0xf9, 0xe9, 0x63, + 0xb3, 0xac, 0xd2, 0xff, 0xe2, 0xc7, 0x63, 0xc3, 0x14, 0xe5, 0x45, 0xf2, + 0x10, 0xdb, 0x24, 0xeb, 0x85, 0x01, 0x37, 0x89, 0x5b, 0xeb, 0xcb, 0x3c, + 0xed, 0xf1, 0xa8, 0x25, 0x7b, 0x20, 0x77, 0xf8, 0x1f, 0x7f, 0x3e, 0x53, + 0x70, 0xeb, 0xcb, 0x7c, 0xa6, 0x0e, 0xcf, 0x0a, 0x63, 0xc8, 0x46, 0x10, + 0xdb, 0xac, 0xfd, 0x6a, 0x15, 0xf5, 0x35, 0xad, 0x8b, 0x0e, 0xb9, 0x2d, + 0x0d, 0x5b, 0x30, 0x01, 0x07, 0x7e, 0x61, 0x24, 0x6d, 0x4d, 0x6c, 0x7c, + 0x6f, 0x52, 0x7b, 0xb9, 0x2b, 0x71, 0x04, 0x89, 0xb2, 0x00, 0xe2, 0x94, + 0x91, 0x9f, 0x79, 0x74, 0x10, 0xc3, 0x9e, 0xea, 0x87, 0x97, 0xf0, 0x87, + 0x51, 0x83, 0x45, 0xa5, 0xda, 0x25, 0xdc, 0x90, 0x31, 0x81, 0x5f, 0x33, + 0xd6, 0xc5, 0x64, 0x00, 0x3e, 0x4c, 0xc1, 0xde, 0xda, 0x0b, 0x20, 0x6f, + 0x23, 0x1a, 0xd8, 0xe8, 0xc8, 0x9d, 0x25, 0xcc, 0xf9, 0x31, 0x76, 0x95, + 0xc1, 0xa3, 0x74, 0xd9, 0x66, 0xe6, 0x67, 0x21, 0x75, 0x37, 0x07, 0xce, + 0x84, 0x8e, 0x19, 0x34, 0x88, 0x57, 0x28, 0x3b, 0xd2, 0x73, 0xdc, 0x14, + 0x0a, 0xb2, 0xf0, 0x35, 0x36, 0xd1, 0xbd, 0x6a, 0x27, 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, + 0x0e, 0x77, 0xd6, 0xe7, 0x07, 0x37, 0xa9, 0xd2, 0x52, 0x39, 0x02, 0x44, + 0x0a, 0x3a, 0xe0, 0x45, 0x79, 0x55, 0x2b, 0xa6, 0x0e, 0xa5, 0xc2, 0x18, + 0xa6, 0x14, 0xda, 0xdc, 0xb2, 0x3b, 0xac, 0xed, 0x1b, 0x6c, 0xb3, 0xd7, + 0x1a, 0x9f, 0xc8, 0x0c, 0x55, 0x05, 0x60, 0x26, 0xd0, 0x5e, 0xa4, 0x37, + 0x4e, 0x20, 0x06, 0xd3, 0x41, 0x7e, 0x9b, 0x9f, 0xfb, 0x5f, 0x11, 0x10, + 0x76, 0xae, 0x72, 0xfd, 0xcb, 0x2c, 0x25, 0x1f, 0x26, 0x77, 0x27, 0x81, + 0x29, 0x5e, 0xaa, 0xfa, 0x2c, 0x1c, 0x6d, 0xf5, 0x31, 0xef, 0x0f, 0xea, + 0x79, 0x76, 0x55, 0x2b, 0x69, 0x0d, 0x46, 0x31, 0x18, 0xb8, 0xdf, 0x8c, + 0x9a, 0xaf, 0xdc, 0x70, 0x7b, 0x4d, 0xdc, 0xfc, 0x79, 0x8e, 0x6a, 0x1c, + 0xab, 0x37, 0xb0, 0xc2, 0x94, 0x66, 0x73, 0x74, 0xfb, 0x9a, 0x5e, 0x6d, + 0x37, 0x59, 0x93, 0x49, 0x29, 0x21, 0x34, 0x32, 0x2c, 0xf2, 0xc1, 0x20, + 0x97, 0x72, 0xab, 0xa4, 0xd2, 0x52, 0x03, 0xcd, 0xff, 0xbb, 0x0c, 0x14, + 0x91, 0xdb, 0x07, 0x14, 0xf7, 0xdd, 0xaa, 0xc8, 0xf0, 0xca, 0x83, 0xd4, + 0xb1, 0xe4, 0xa4, 0x36, 0x50, 0x2b, 0x31, 0x02, 0x81, 0x81, 0x00, 0xf8, + 0xf0, 0x06, 0x23, 0x63, 0x18, 0x48, 0xe9, 0xae, 0x3b, 0x52, 0x16, 0xc2, + 0xfa, 0x0f, 0x60, 0x1b, 0x27, 0x07, 0x02, 0xd1, 0xfd, 0x82, 0x98, 0xc6, + 0x0d, 0xf4, 0xdc, 0xfc, 0xfd, 0xc1, 0x78, 0xdf, 0x79, 0xed, 0x7a, 0xee, + 0x87, 0xdd, 0x7f, 0xcd, 0x45, 0x30, 0x52, 0xab, 0x45, 0x7e, 0xa8, 0xfb, + 0x9b, 0xaa, 0x84, 0xa0, 0x83, 0xc3, 0xf4, 0x9d, 0x68, 0x84, 0x1a, 0x51, + 0x65, 0x19, 0xeb, 0x7c, 0xc0, 0x97, 0xc2, 0x66, 0x7b, 0xe0, 0xbb, 0x1e, + 0x12, 0x50, 0xa7, 0x08, 0x75, 0x99, 0x33, 0xee, 0x57, 0x35, 0x8a, 0x9f, + 0x39, 0x7c, 0x78, 0x51, 0x5b, 0x79, 0xe5, 0x4c, 0x9d, 0x51, 0x5e, 0xe7, + 0x17, 0x94, 0x19, 0x47, 0x5c, 0x86, 0x4b, 0x36, 0xd8, 0x3a, 0x4d, 0xd8, + 0x9c, 0x8d, 0x15, 0xa3, 0x52, 0x06, 0x11, 0x80, 0x4d, 0xa8, 0x90, 0x14, + 0x64, 0x60, 0x60, 0xd9, 0x47, 0x57, 0x69, 0x02, 0x81, 0x81, 0x00, 0xe6, + 0x00, 0x13, 0x4c, 0x3d, 0xb0, 0xfb, 0x0e, 0x25, 0x2b, 0xfe, 0x43, 0xc8, + 0x7d, 0x34, 0x06, 0xca, 0x06, 0x31, 0x4f, 0xb5, 0x08, 0xcf, 0x00, 0x45, + 0x23, 0x8a, 0xe4, 0xa4, 0xbd, 0x9a, 0x7d, 0xc6, 0x1e, 0xc3, 0xbb, 0x6c, + 0xd5, 0x85, 0x0a, 0x0d, 0xa1, 0x28, 0x87, 0x15, 0x80, 0x25, 0xef, 0x85, + 0x1d, 0x80, 0x72, 0x22, 0x03, 0xce, 0x02, 0x78, 0x8d, 0x8f, 0x33, 0x00, + 0x42, 0xf2, 0xd5, 0xb2, 0xda, 0xff, 0x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xcb, 0x68, 0xc2, 0x5f, 0x6e, + 0xd3, 0xd5, 0x25, 0xb4, 0xda, 0x21, 0x02, 0x81, 0x80, 0x57, 0x19, 0x1c, + 0x35, 0xb8, 0xfe, 0xf6, 0x73, 0xaa, 0xdb, 0xf8, 0x13, 0xcf, 0x2e, 0xaa, + 0xaf, 0x0f, 0x7e, 0x3c, 0xda, 0x44, 0x62, 0x2b, 0x91, 0x9c, 0x9d, 0x13, + 0x11, 0xf6, 0xd8, 0xde, 0x52, 0x56, 0xde, 0x7b, 0x9c, 0xd4, 0x60, 0x1f, + 0x5b, 0x69, 0x41, 0xe8, 0x49, 0x0f, 0x79, 0x51, 0xe4, 0x5c, 0x72, 0x89, + 0x9b, 0xaf, 0x09, 0xe5, 0xcf, 0xc5, 0xbb, 0x45, 0xc9, 0x38, 0x86, 0x21, + 0xd3, 0x8f, 0x41, 0xa3, 0x79, 0xb3, 0xe3, 0x7b, 0x6f, 0xc0, 0x0e, 0x79, + 0x45, 0x32, 0x1f, 0x45, 0x1d, 0xac, 0x57, 0x3e, 0x98, 0x87, 0xb0, 0x49, + 0x68, 0x74, 0x4d, 0xb8, 0xb1, 0xce, 0x31, 0xab, 0x5a, 0x49, 0x84, 0xae, + 0xac, 0x27, 0x6e, 0xa6, 0x90, 0x9e, 0xde, 0xc2, 0x74, 0x12, 0xcf, 0x7d, + 0x5a, 0x07, 0x77, 0xe2, 0xa3, 0xfe, 0x9e, 0x86, 0x4b, 0x91, 0x41, 0x20, + 0x88, 0xd9, 0xee, 0x19, 0x51, 0x02, 0x81, 0x80, 0x6b, 0x17, 0x7a, 0x49, + 0xf9, 0x76, 0x53, 0xe7, 0xb2, 0x33, 0x9b, 0xf3, 0x32, 0x30, 0x88, 0x39, + 0xe9, 0x09, 0x63, 0x17, 0x4c, 0xb7, 0xb8, 0xdb, 0x65, 0x74, 0xb5, 0xd8, + 0xf6, 0x50, 0x74, 0xf5, 0xbf, 0x93, 0x09, 0x77, 0xda, 0x9c, 0xa9, 0x0e, + 0x0c, 0x64, 0x5d, 0x5a, 0xac, 0xa0, 0x88, 0x75, 0x5a, 0xc8, 0xdc, 0xf5, + 0x65, 0x68, 0x6a, 0x41, 0xf1, 0xed, 0xd2, 0xc0, 0x2a, 0x62, 0xcf, 0x87, + 0x5e, 0x6f, 0x2b, 0x7e, 0x0f, 0xc9, 0x56, 0x01, 0x68, 0xcb, 0xdf, 0xb9, + 0xd7, 0x30, 0x63, 0xe4, 0x5f, 0x9f, 0xb7, 0xfe, 0xcd, 0xff, 0xda, 0x69, + 0x19, 0xac, 0x42, 0xe8, 0xfe, 0xcd, 0xa7, 0xec, 0x90, 0x4e, 0xfe, 0xae, + 0xc1, 0x83, 0x72, 0x1a, 0xd5, 0x8e, 0x84, 0xa3, 0x91, 0x51, 0xc3, 0xd1, + 0x26, 0x4c, 0xd5, 0xd7, 0xf7, 0x57, 0x54, 0x14, 0x8a, 0x76, 0x01, 0xae, + 0xe0, 0x1d, 0xf0, 0xde +}; +unsigned int projectKey_der_len = 1216; +#endif diff --git a/test/README b/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html