Skip to content

Commit 1ece9ab

Browse files
committed
Instructions for updating secrets
1 parent 4ea5335 commit 1ece9ab

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Generates Time-based One-Time Password's (TOTP) using MicroPython, Raspberry Pi
2121
- Create a `WifiSecrets.json` file (based on `WifiSecrets.json.example`) which includes the common wifi SSIDs + passphrases available.
2222
- Flash the Pico W with the latest [MicroPython](https://micropython.org/download/rp2-pico-w/).
2323
- Copy the codebase except `main.py` to the Raspberry Pi Pico W.
24-
- Open an interactive session on the Pico and encrypt the codes.json and WifiSecrets.json as below:
24+
- Open an interactive session on the Pico and encrypt the `codes.json` and `WifiSecrets.json` as below:
2525
```
2626
>>> import cryptor
2727
>>> cryptor.encrypt('codes.json','mypasswd')
@@ -32,8 +32,28 @@ Generates Time-based One-Time Password's (TOTP) using MicroPython, Raspberry Pi
3232
- Reset the Pico W
3333
- Enter your password at the initial password prompt.
3434
- Fix datetime at prompt if Wifi doesn't work.
35-
- Now you can cycle through your TOTP's using a button.
35+
- Now you can cycle through your TOTP's using Key0 of the Pico-Oled-1.3.
36+
- Key1 of the Pico-Oled-1.3 toggles the display ON/OFF.
3637

38+
# Updating secrets
39+
40+
- Connect to the REPL
41+
- Press CTRL-C to stop the code and bring up the prompt
42+
- Run the following code to dump the secrets files to console as plain text:
43+
```
44+
>>> import cryptor
45+
>>> print(cryptor.decrypt('codes.json.encoded','mypasswd').decode())
46+
>>> print(cryptor.decrypt('WifiSecrets.json.encoded','mypasswd').decode())
47+
```
48+
- Copy the outputs into `codes.json` and `WifiSecrets.json` on your workstation, and update with new secrets as required.
49+
- Push the updated `codes.json` and `WifiSecrets.json` to the Pico W.
50+
- Encrypt `codes.json` and `WifiSecrets.json` and overwrite previous encoded files as below:
51+
```
52+
>>> import cryptor
53+
>>> cryptor.encrypt('codes.json','mypasswd')
54+
>>> cryptor.encrypt('WifiSecrets.json','mypasswd')
55+
```
56+
- Remove the unencrypted `WifiSecrets.json` and `codes.json` from the Pico W storage.
3757

3858
Notes:
3959
1. The Bootsel button is used for user input as the pico-oled-1.3 only has 2 buttons

0 commit comments

Comments
 (0)