You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5413c98
Browse filesBrowse the repository at this point in the historyBrowse files
SaF END and stored layouts, and device certificates (dash#49, #57, #29)
Store and forward:
- set_saf_end_callback() and saf_end_timeout for the server's SAF END.
- The server's CFG DASH request is answered with the C64 on the announce
topic.
- disconnect() publishes what the devices have already sent first.
- The intermittent example waits for SAF END and the store sync.
Device certificates (dash_docs ClientCertificates):
- DeviceCertificates and Device(certificates=): states PASSWORD, PENDING
and CERT, the first certificate from the server over the password,
renewal in the last year, and the CRT messages with the app.
- DashConnection logs in on cert_port (8885) as d-<device id>, checks a
new certificate before using it, falls back to the password while
PENDING, and erases the password on reaching CERT.
- The DashIO Server CA is bundled. cryptography is a new dependency.
Tested on dash.dashio.io: first issue, login without a password,
revocation, recovery with a new Dash login, and renewal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-`utilities/`: the `c64_encode`, `c64_decode` and `dashio_data_exporter` commands.
@@ -78,6 +79,17 @@ Notes for working on python-dashio, the Python library for the DashIO protocol a
78
79
-`SEC`: `\t<device_id>\tSEC\tKEY\t<key>`, stores a device key (BLE security).
79
80
-`DATA`: `OTA` and `SDU` only.
80
81
-**The Dash server is the source of truth for history.** For a control with `storage_enable()` (`Device._server_stored`), history requests are only answered when they come from a Dash server connection (`msg_from` starting `DASH:`), never over TCP, BLE or other local connections. Otherwise an app connected locally takes the device's history as complete and doesn't fetch the older history from the server. Live updates still go to every connection.
82
+
-**Store and forward (SaF) on the Dash server** (dash_docs `StoreAndForward.md`, dash#49, dash#57), for devices with `store_and_forward` on:
83
+
- After each WHO the server sends the held control messages, then `\t<device_id>\tSAF\tEND\n`, in one publish. `set_saf_end_callback()` is called with True on END, or False when it doesn't come within `saf_end_timeout` (5 s, as zephyr-dashio) of the WHO on a DashConnection. The wait is checked in `Device.run()`.
84
+
- When the server doesn't keep the device's current layout, it asks with `\t<device_id>\tCFG\tDASH\t1\n`, before END. The device sends its usual C64 reply, always C64 and the 1 column layout, on the **announce** topic, not as a reply. `DASH` is never a dashboard ID.
85
+
-`DashConnection.disconnect()` from another thread has the connection thread publish what's waiting in its zmq socket first, so a reply sent just before END isn't dropped by the planned disconnect.
86
+
-**Device certificates** (dash_docs `ClientCertificates/DashIO_Client_Certificates.md`, dash#29), in `device_certificates.py`:
87
+
-`DeviceCertificates(path)` is given to the Device (`certificates=`), which handles the CRT messages: REQUEST INFO/CSR and UPDATE from the app, over any connection, and SVR_CRT/ERR from the server. The device sends SVR_CSR and SVR_STATUS on announce (`CertificateSession`, polled in `Device.run()`, started by `connection_ready()` from the DashConnection's subscription).
88
+
- States PASSWORD, PENDING and CERT, kept in `state.json` in the directory with `key.pem`, `cert.pem`, `ca.pem` (from the app's `caCert`), `new_key.pem` (an outstanding request's key) and `previous_*.pem` (a renewal not yet proven). Files are written 0600.
89
+
- The DashConnection takes the certificate from its one device (a second device raises `ValueError`), and makes a new paho client when it changes login: client ID `d-<device_id>` and `tls_set_context` for port 8885, a random client ID for 8883, because the broker refuses `d-` client IDs on password logins.
90
+
- A certificate not yet used to log in (PENDING, or a renewal) is checked first with a TLS handshake and a short read (`_check_certificate()`): with TLS 1.3 the broker refuses a client certificate with an alert after the handshake, which paho only reports as a lost connection. Refused: PENDING falls back to the password for an hour and reports 420; a renewal rolls back to the previous certificate. Unreachable: check again with backoff.
91
+
- On the first certificate login the connection erases its password and `state_callback("CERT")` lets the program erase its copy. A new Dash login from the app (the DASHIO message, when the dashio callback accepts it) calls `reset()`: back to PASSWORD, keys deleted.
92
+
- The DashIO Server CA is bundled as `dashio/certs/dashio-server-ca.crt` (package data). `cryptography` is a dependency.
81
93
-**`DashStore` and history upload (SDU):** a port of the firmware's DashIO Storage Manager (`../zephyr-dashio-tally/port.md`, ESP-IDF port in `../dashesp/components/dashio_dsm`), using sqlite instead of a flash ring buffer.
82
94
-`Device(..., store=DashStore(path))` gives every TimeGraph, EventLog and Map on the device the store (`control._store`). They record into it as well as their ring buffers, and answer the app's history requests from it.
83
95
- The wire format follows `../dash_docs/DashIODataFormat/DashIO_Data_Updater.md` (the SDU section): the timestamp request (lines, then tracks, then logs), `%.6f` floats, `T`/`F` booleans, MAP values as strings without `time`, LOG `color` left out when empty, and the FNV-1a hash (`%016x`) over the JSON. The golden vectors are in `tests/test_dash_store.py`.
0 commit comments