Skip to content

Commit 838549b

Browse files
committed
Update SECRET document
1 parent d8a69e3 commit 838549b

15 files changed

+15
-44
lines changed

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

+15-44
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,46 @@
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](
7+
78

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.
99

10-
## How it works
11-
12-
Basically every time you type `SECRET_SOMETHING` in your sketch and save it, we will create a Secret tab for you to fill out.
13-
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.
10+
). 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.
1711

18-
![share_secure_sketches_img_1](assets/share_secure_sketches_img_1.jpg)
12+
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.
1913

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).
14+
## How it works
2315

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)
16+
Basically every time you type `SECRET_SOMETHING` in your sketch and save it, we will create a Secret tab for you to fill out.
2617

2718
## How to Add Secret Values to Your Own Sketch
2819

29-
Write your sketch as you would normally.
20+
Write your sketch as you would normally. Then click on the plus icon next to your sketch name and click on "Add Secrets Tab".
3021

31-
![share_secure_sketches_img_4](assets/share_secure_sketches_img_4.jpg)
22+
![Add SECRET Tab](./assets/add_secret_1.png)
3223

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.**
24+
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.**
3425

35-
![share_secure_sketches_img_5](assets/share_secure_sketches_img_5.png)
26+
![SECRET in Code](./assets/add_secret_3.png)
3627

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.
28+
A new page will appear where you can enter your SECRET-Keys
3829

39-
![share_secure_sketches_img_6](assets/share_secure_sketches_img_6.jpg)
30+
![Add SECRET Key](./assets/add_secret_2.png)
4031

4132
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.
4233

43-
![share_secure_sketches_img_7](assets/share_secure_sketches_img_7.png)
44-
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)
48-
49-
5034
## Adding an extra optional field
5135

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.
36+
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®.
5937

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)
38+
You can add it in the same fashion as the `SECRET_SSID` and add the `OPTIONAL` to it.
6539

6640
## Download the sketch
6741

6842
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.
6943

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

7546
All the values you enter will be considered strings.

0 commit comments

Comments
 (0)