Implement WiFI and Token provisioning
At the moment, all credentials and tokens are baked into the image at compile-time. This has several issues:
- If someone changes access points, a recompile is required by the user
- Compiling itself isn't 100% trivial: the ESP-IDF requires setup, and the downloading of a not-that-small amount of data.
- This data also makes the firmware files themselves contain secrets, which is not optimal
- Makes OTA updates impossible
We should switch to a method to provision WiFi and token information at run-time, and store them in the NVS of the ESP.
There are a few things going on for us that make this less trivial than with other projects:
- We need to provision token information; this means that while we can use the ESP-IDFs provisioning libraries, we can not use the SoftAP/BLE applications made by Espressif to provision (as far as my understanding goes, they do not use custom endpoints, and we need to set up some custom endpoint / data field to store the token and URL)
- Espressif seems to heavily recommend using QR codes to aid in provisioning; this would require either the base station UART being attached and actively looked at during provisioning, or a screen on the base station itself. It would be best if we could avoid this. QR codes are not required, but implementing proof of possession checks would be next to impossible.
- Hopefully, the latter part should be ignorable - the provisioning service should only run once (or if NVS is cleared / data is reset), and I don't think the chance is high that devices will be confused due to a huge amount of base stations existing in one area or anything.
This also means we may need to develop apps / scripts to provision the base stations; which is also not exactly ideal as it adds more workload, but there may not be a good way around this