Documentation
¶
Overview ¶
Command wittyconnect is the desktop app's helper for peer-to-peer connections: the app starts it, tells it which server to reach, and gets back a local address to load the server from.
It is driven over its standard input and output, one JSON object per line, so nothing secret is ever on a command line where other programs can read it. The app writes the configuration first:
{"key":"…","serverId":"12D3KooW…","hints":["/ip4/…"]}
and reads events:
{"event":"ready","port":51234,"secret":"…","deviceId":"12D3KooW…"}
{"event":"state","state":{"path":"direct","transport":"quic"}}
{"event":"addrs","addrs":["/ip4/…"]} (after a path is found; to keep as hints)
{"event":"enrol","result":{"ok":true,"code":"123456"}}
{"event":"error","error":"…"}
Further lines are commands: {"cmd":"enrol","secret":"…","name":"…","platform":"desktop"}, {"cmd":"network-changed"}, {"cmd":"addrs"}. When its input closes, because the app quit or crashed, it exits: it never outlives the app.
"wittyconnect keygen" prints a new device key and its ID and exits. "wittyconnect join" shows a code and waits for the server to take it: see runJoin. "wittyconnect version" prints the version of the protocol it speaks (2 has join).