# MangoLink TLS pairing QR, version 1

Available in Android 0.3.0 (3) and Simulator 0.3.0. This is an optical setup
format, separate from MangoLink's newline-delimited JSON wire protocol.

Example (public test values, not working credentials):

```text
mangolink://pair?v=1&mode=tls&host=192.168.1.25&port=8766&sha256=ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB&token=test-token
```

The scheme is `mangolink`, authority `pair`, with no path, fragment or user info.
Query names and values use UTF-8 URL form encoding (percent escaping; `+` means
space). Required fields: `v=1`, `mode=tls`, `host`, `port` (1–65535), and
`sha256` (64 hex digits of the DER-encoded leaf certificate's SHA-256 digest).
Optional `token` is at most 256 characters without control characters. Host is
an IP literal (IPv6 without square brackets) or hostname up to 253 characters;
wildcard bind addresses `0.0.0.0` and `::` cannot be destinations. Do not include
the private key. The whole encoded payload must be at most 2,048 characters.
Unknown/duplicate fields, unsupported versions, non-TLS modes and malformed
values are rejected before changing any connection field. If `token` is omitted,
the phone clears any previous token rather than sending it to a different server.

Only scan the expected simulator/device display. The QR is an out-of-band trust
transfer, not a signed or encrypted credential container. A QR that includes a
token lets anyone who reads it use that token while the server accepts it.
No QR payload is deliberately logged, exported, uploaded or persisted by the app.
The phone scans locally with ZXing, does not save camera images, fills fields
and selects TLS. The user reviews details and taps Connect; normal certificate
pin verification still happens before the token is sent. There is no external
deep-link handler or automatic connection. Manual entry remains available.

Simulator: start TLS, open Show pairing QR, enter the reachable LAN address and
generate the code. It uses the running server's port, token and fingerprint.
The token is included by default and can be omitted with the checkbox. QR
images exist only in desktop memory; closing the dialog does not revoke tokens.
The four-module white QR border must remain visible for reliable scanning.
