Skip to content

Commit 8eade79

Browse files
Merge b4a0b6c into b17e14c
2 parents b17e14c + b4a0b6c commit 8eade79

15 files changed

+12
-44
lines changed

content/arduino-cloud/04.cloud-editor/store-your-sensitive-data-safely-when-sharing/store-your-sensitive-data-safely-when-sharing.md

+12-44
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,43 @@
11
---
2-
title: 'Store your sensitive data safely when sharing a sketch'
2+
title: 'Store Sensitive Data in Sketches'
33
description: 'Learn how to share sketches without sharing the sensitive data such as Wi-Fi credentials and API keys.'
44
---
55

6-
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](https://create.arduino.cc/projecthub/Arduino_Genuino/share-your-sketches-on-the-arduino-web-editor-00a02c). 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.
6+
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](content/arduino-cloud/04.cloud-editor/embedding-create-iframes/embedding-create-iframes.md). 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.
77

8-
This feature has been designed specifically for the [Arduino Create Editor](https://create.arduino.cc/editor). If you have yet to try it, follow [this tutorial to get started](https://create.arduino.cc/projecthub/Arduino_Genuino/getting-started-with-the-arduino-web-editor-4b3e4a) — all you need is an Arduino ID.
8+
This feature has been designed specifically for the [Arduino Cloud Editor](https://app.arduino.cc). If you have yet to try it, follow [Getting Started with Arduino Cloud](https://docs.arduino.cc/arduino-cloud/guides/overview/) — all you need is an Arduino ID.
99

1010
## How it works
1111

1212
Basically every time you type `SECRET_SOMETHING` in your sketch and save it, we will create a Secret tab for you to fill out.
1313

14-
Let’s start with an example, just so you can see how it works.
15-
16-
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](https://create.arduino.cc/editor/Arduino_Genuino/2ab7cb05-7f86-41cb-994f-d121d6f3bf34/preview) and add the example to your sketchbook.
17-
18-
![share_secure_sketches_img_1](assets/share_secure_sketches_img_1.jpg)
19-
20-
As you can see, there are some identifiers like `SECRET_SIID` and `SECRET_PSW`. If you now click on the tab called “Secret,” you will notice some input fields where you can fill in your data.
21-
22-
If you have a [MKR1000](/hardware/mkr-1000-wifi) 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).
23-
24-
![share_secure_sketches_img_2](assets/share_secure_sketches_img_2.png)
25-
![share_secure_sketches_img_3](assets/share_secure_sketches_img_3.jpg)
26-
2714
## How to Add Secret Values to Your Own Sketch
2815

29-
Write your sketch as you would normally.
30-
31-
![share_secure_sketches_img_4](assets/share_secure_sketches_img_4.jpg)
16+
Write your sketch as you would normally. Then click on the plus icon next to your sketch name and click on "Add Secrets Tab".
3217

33-
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.**
18+
![Add SECRET Tab](./assets/add_secret_1.png)
3419

35-
![share_secure_sketches_img_5](assets/share_secure_sketches_img_5.png)
20+
In your sketch, replace the strings containing sensitive data by writing `SECRET_NAMEYOUWANT`. For instance, if your string is `"ssid`, you should replace it with `SECRET_SSID`. **Make sure all these identifiers are in caps.**
3621

37-
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.
22+
![SECRET in Code](./assets/add_secret_3.png)
3823

39-
![share_secure_sketches_img_6](assets/share_secure_sketches_img_6.jpg)
40-
41-
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.
24+
A new page will appear where you can enter your secret keys.
4225

43-
![share_secure_sketches_img_7](assets/share_secure_sketches_img_7.png)
4426

45-
Alternatively, you can also click on the tab button and add the Secret tab directly from there. These instructions will be reported for quick reference.
46-
47-
![share_secure_sketches_img_8](assets/share_secure_sketches_img_8.jpg)
27+
![Add SECRET Key](./assets/add_secret_2.png)
4828

29+
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.
4930

5031
## Adding an extra optional field
5132

52-
If you want to add another field, let's say to store the pin for your SIM card, or an API token, we can add an optional field. All we need to do is adding this at the top of our sketch:
53-
54-
```arduino
55-
const char optional[] = SECRET_OPTIONAL;
56-
```
57-
58-
So let's say we use `SECRET_SSID` and `SECRET_PASS`, this one would just be added in the same fashion.
33+
If you look at the examples above you notice we've also added a `SECRET_OPTIONAL_PASS`. This is used to store optional information e.g. a password that might be needed to connect to the Wi-Fi®.
5934

60-
![img of editor](assets/secret_feature_1.png)
61-
62-
Now if we head over to the **Secret** tab, it will be visible, and you can input your optional credential.
63-
64-
![img of secret tab](assets/secret_feature_2.png)
35+
You can add it in the same fashion as the `SECRET_SSID` and add the `OPTIONAL` to it.
6536

6637
## Download the sketch
6738

6839
If you download a sketch, we will automatically create a file called arduino_secrets.h and add it to the .zip file. If you open the sketch with the Desktop IDE, you will be able to fill up this tab with your secrets as usual.
6940

70-
![share_secure_sketches_img_9](assets/share_secure_sketches_img_9.png)
71-
72-
7341
## Tech Details
7442

7543
All the values you enter will be considered strings.

0 commit comments

Comments
 (0)