Skip to content

Set up a display over Bluetooth - #8

Merged
CLCK0622 merged 1 commit into
mainfrom
feat/ble-wifi-setup
Oct 21, 2026
Merged

CLCK0622 merged 1 commit into
mainfrom
feat/ble-wifi-setup

Conversation

@CLCK0622

Copy link
Copy Markdown
Member

Pair Display on the Mac used to say "use your iPhone". It now sets up a display end to end over Bluetooth: Wi-Fi first, then the claim.

Flow: the display can't get online → the user holds its touch strip for 3 s → it advertises for 3 minutes and shows a QR + 8-character code → the Mac lists it, takes the code, lists the Wi-Fi networks the display can see, waits until it has joined, then posts the bind URI the display handed over (inside the code-secured session) to POST /api/devices/bind/nfc.

InkletSetupKit (new target, also compiled into the iPhone app) speaks Espressif network_provisioning with Security 1 — X25519 + PoP, one AES-256-CTR keystream shared by both directions. Field numbers checked against the esp-idf / idf-extra-components protos; endpoint names, service UUID, PoP alphabet and the post-join 5 s grace checked against inklet_prov.cpp.

Review fixes on top of the original change:

  • A request whose reply never arrives (timeout, ATT error) now ends the session: the keystream had advanced on one side only, so every later request would decrypt to noise and the user was stuck on the network picker.
  • One request at a time (single continuation slot); join / rescan ignore a second trigger.
  • An already-online display is pointed at the iPhone NFC tap; after setup the page opens the device that was added, not devices.first.

Tests: swift test 87/87, incl. NIST CTR-AES256 vector and Sec1 key agreement.

A Mac can't read a display's NFC tag, so Pair Display used to be a page
telling you to fetch your iPhone. A display that can't get online now
opens a 3-minute Bluetooth setup window when its touch strip is held;
the Mac finds it, takes the 8-character code on its screen, lists the
Wi-Fi networks the display itself can see, waits until it has joined
one, and claims it with POST /api/devices/bind/nfc using the bind URI
the display hands over inside the code-secured session.

InkletSetupKit speaks Espressif's network_provisioning protocol with
Security 1 (X25519 + proof of possession, one AES-256-CTR keystream for
both directions). The same sources are compiled into the iPhone app.

- A request whose reply never arrives ends the session: the keystream
  has moved on one side only, so everything after would be noise.
- One request at a time; join and rescan ignore a second trigger.
- An already-online display is pointed at the iPhone's NFC tap, and
  the page opens the display that was added rather than the first one
  in the list.
Copilot AI balanced review requested due to automatic review settings October 21, 2026 01:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@CLCK0622
CLCK0622 merged commit 48069d9 into main Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants