mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 10:55:06 +00:00
3.0 KiB
3.0 KiB
development-module
Development server (development-server): a TLS server for remote development access: a remote shell, file transfer and app management.
The C API is in <development/server.h>.
development_server_set_enabled()starts or stops listening on TCP port 6667 and persists the choice for the next boot.- The device has a self-signed certificate, which is generated on first use.
development_server_get_fingerprint()returns its SHA-256 fingerprint, so a client can verify that it connects to the right device. - Clients authenticate with their own self-signed certificate (mutual TLS).
Unknown clients are accepted or rejected by the user through the
DEVELOPMENT_SERVER_PROMPT_APP_IDapp, which the firmware provides. The user can choose to always trust a client. - At most 3 sessions are active at a time, and at most 1 of them is a
shellsession.
Protocol
- The client connects with TLS 1.2 and presents its certificate.
- The client sends a JSON line:
{"protocol":1,"mode":"shell","client":"user@host","columns":80,"rows":24}Inshellmode, an optional"command"(at most 511 bytes) runs that command likesh -cinstead of an interactive shell. - The server answers with a JSON line once the client is accepted:
{"status":"accepted"},{"status":"rejected"}or{"status":"error","message":"..."} - In
shellmode, both sides then send frames:[type u8][length u16 big-endian][payload], with at most 1024 payload bytes.0x01data: terminal input from the client, terminal output from the server0x02resize: from the client, payload is[columns u16][rows u16](big-endian)0x03exit: from the server, payload is the shell's exit code asi32(big-endian), after which the server closes the connection
- In
syncmode, the client sends requests with the same frames. Paths are absolute and UTF-8 encoded.0x10stat[path]: answered with0x11[type u8][size u64], where the type is 0 for missing, 1 for a file and 2 for a directory0x12push[path], then0x01data frames, then0x14done: answered with0x15ok, or0x16fail[message]. Parent directories are created. A failed or interrupted push removes the file.0x13pull[path]: answered with0x01data frames and0x14done, or with0x16fail[message]
- In
appmode, the client manages apps with the same frames:0x20install[file name], then0x01data frames with the.apppackage, then0x14done: answered with0x15ok, or0x16fail[message]0x21uninstall[package id]: answered with0x15ok, also when the package isn't installed, or0x16fail[message]0x22run[app id]: starts the app, or restarts it when it's in the foreground. Answered with0x15ok, or0x16fail[message]
Buildscripts/TactilitySDK/Tools/shell.py is a client for this server. App developers run it as tt shell, and copy files with tt push and tt pull.
License: Apache v2.0