Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created secure ESP32 example #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mattncsu
Copy link

I created a secure ESP32 example. I had to comment out the .setInsecure method as it doesn't appear in the ESP32 version of WiFiClientSecure

Secure ESP32-compatible Pushover example
commented out .setInsercure() as it's not working with ESP32.
Copy link
Member

@soundstorm soundstorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quality of this request is sadly bad.
Would appreciate it, if it does not break the 8266 and code quality improves.

@@ -44,7 +44,7 @@ void Pushover::setHTML(boolean html) {
boolean Pushover::send(void) {
WiFiClientSecure client;
if (_unsafe) {
client.setInsecure();
//client.setInsecure(); //not working with ESP32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you commenting out this? Please use preprocessor instructions.


const char* ssid = ""; // your network SSID (name of wifi network)
const char* password = ""; // your network password
const char* userToken = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If using extra spaces, please align all evenly.

#include <WiFiClientSecure.h>
#include <Pushover.h>

const char* ssid = ""; // your network SSID (name of wifi network)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why so many spaces?

Comment on lines +41 to +50
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
WiFi.begin(ssid, password);

// attempt to connect to Wifi network:
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
// wait 1 second for re-trying
delay(1000);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indentation

while (WiFi.status() != WL_CONNECTED) delay(50);
Serial.println("Connected");
client.setCACert(test_root_ca);
Pushover po = Pushover(appToken,userToken, SAFE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAFE can be left out, as it's the default value.

@mattncsu
Copy link
Author

Sorry for the low quality, just wanted to send a working ssl example for possible inclusion and there isn't a great mechanism for just contacting an author. Feel free to reject. Just wanted to put the code out there in case someone found it useful.

@soundstorm
Copy link
Member

You may improve it by using #ifndef ARDUINO_ARCH_ESP32 at the commented line and correct the indentation.

@SlothCroissant SlothCroissant mentioned this pull request Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants