Steps are outlined below, but need more description. Actually, it might be better to find some ways to shorten this a bit.
public.pem and key_uuid.toml from the SD cardconfig.toml on the serverstartup.toml on the SD cardstartup.toml, config.toml, and any other files you may need on the SD cardstartup.tomlA file named startup.toml is used to configure the module’s boot-time behavior. As such, it needs to be loaded
from an SD card - it is loaded and used before the module potentially connects to the internet.
Here’s an example of a complete startup.toml:
mode = "online"
[[wifi]]
ssid = "network"
password = "test_password"
[[wifi]]
ssid = "network2"
password = "test_password2"
[server]
host = "hambones.app"
config_dir = "/dev_api/config/"
auth = true
The startup.toml file has several important fields.
First, the mode key determines whether the module will try to connect to the Internet to update its own configuration
or not.
mode is "online", the module will attempt to connect to the Internet and refresh its configuration from a
remote server.mode is "standalone", the module will not connect to the Internet.mode is "static", the module will connect to the Internet, but will not update its configuration
automatically.The table under the wifi key, which may be repeated, (see the double bracket) provides WiFi credentials. The module
will attempt to connect to each of the networks in sequence, if its mode is "online" or "static".
ssid sub-field is required.password sub-field can be omitted.The server key specifies the server the device should fetch its config.toml, if its mode is "online". The module
will issue a GET request to the server specified. If it provides an HTTP 200 response, the response content will be
saved on the module.
host is the internet address or fully-qualified domain name. It may include a port number.config_dir provides the subdirectory to fetch the configuration from.auth is true, then the header for the request will include a JSON Web Token using the module’s
RSA key.If the request does not complete or the server responds with an error, the module falls back to the previous configuration.
The server table has no effect if the module’s mode is "standalone" or "static".
config.tomlA file named config.toml is used to configure the application, or what the display actually shows, in addition to
specifying the layout and location of other resources that are needed.
Here’s a sample ``
render_root)Upon initial startup, the module will generate several files that it uses to sign server requests. The server application verify these digital signatures to prove to a server that the module, and not some other party, is requesting information. That said, the server needs to know about the public key.
To authorize, the module provides a JSON Web Token with an RS256 signature. After
an SD card is inserted, the public key is copied in PEM format to it, into a
file named public.pem. This file may be uploaded to the server application, or
otherwise used to verify the signature provided in those HTTP requests.
The corresponding private key is saved onboard the device.