Store Your Sensitive Data Safely When Sharing a Sketch
If there is sensitive data that you want to keep private when sharing a sketch, add a secret tab and store your private info there!
Often in your sketch, there is some sensitive data that you’d like to keep private, which could accidentally become public when published on GitHub or when you share your sketch with someone else via URL. This sensitive information may include Wi-Fi network names and passwords, API key, and so on. But now, you can add a secret tab to your sketch and store your private data there.
How it works
Basically every time you type
SECRET_SOMETHING in your sketch and save it, we will create a Secret tab for you to fill out.
Let’s start with an example, just so you can see how it works.
Go to the Libraries panel and type ‘Wifi101’ in the search tab, then click on the ConnectWithWPA example. You can also click on this link and add the example to your sketchbook.
As you can see, there are some identifiers like
SECRET_PSW . If you now click on the tab called “Secret,” you will notice some input fields where you can fill in your data.
If you have a MKR1000 lying around, you can upload this sketch on it and watch your board connect to Internet (just make sure you join a 2GHz WiFi network).
How to Add Secret Values to Your Own Sketch
Write your sketch as you would normally.
In your sketch, replace the strings containing sensitive data by writing
SECRET_NAMEYOUWANT . For instance, if your string is
"psw” , you should replace it with
SECRET_PSW . Make sure all these identifiers are in caps.
The Secret tab will be automatically created as soon as you type
SECRET_SOMETHING. Go to Secret tab and fill out the fields with the sensitive values.
That’s it! If you share this sketch with someone via URL or if you download it, the values on the tab will be blank.
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw