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
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,7 @@ To focus a specific simulator, open
63
63
The Rust server exposes HTTP on the requested port and WebTransport on `port + 1`.
64
64
The browser bootstrap comes from `GET /api/health`, which returns the WebTransport URL template,
65
65
certificate hash, and packet version needed by the client.
66
+
The served browser UI receives the generated API access token automatically; direct HTTP callers can use the startup token with `X-SimDeck-Token` or `Authorization: Bearer`.
@@ -30,11 +30,11 @@ Returns the static bootstrap information the browser client needs to open a WebT
30
30
|`httpPort` / `wtPort`| Numeric ports for the HTTP and WebTransport servers. WebTransport is always `httpPort + 1`. |
31
31
|`timestamp`| Server-side `time.now()` as a fractional Unix epoch in seconds. |
32
32
|`videoCodec`| Active encoder. One of `hevc`, `h264`, `h264-software`. See [Video Pipeline](/guide/video). |
33
-
|`webTransport.urlTemplate`| URL with a `{udid}` placeholder for the simulator stream. Substitute and dial. |
33
+
|`webTransport.urlTemplate`| URL with a `{udid}` placeholder and access token query for the simulator stream. |
34
34
|`webTransport.certificateHash.value`| SHA-256 of the server's self-signed cert. Pin via `serverCertificateHashes` in the WT client. |
35
35
|`webTransport.packetVersion`| The current binary packet protocol version. Clients should refuse to parse unknown versions. |
36
36
37
-
The certificate is regenerated every time the server restarts. A client that caches the hash should refetch `/api/health` after any disconnection.
37
+
The certificate and default access token are regenerated every time the server restarts. A client that caches the hash should refetch `/api/health` after any disconnection.
Copy file name to clipboardExpand all lines: docs/api/rest.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# REST Endpoints
2
2
3
-
The SimDeck server exposes one REST API over plain HTTP. Every route lives under `/api/`. Responses are JSON unless explicitly noted otherwise. Errors return a JSON body with `{"error": {"message": "..."}}` and an appropriate HTTP status.
3
+
The SimDeck server exposes one REST API over plain HTTP. Every route lives under `/api/`. Responses are JSON unless explicitly noted otherwise. Errors return a JSON body with `{"error": "..."}` and an appropriate HTTP status.
4
4
5
-
CORS is wide open (`Access-Control-Allow-Origin: *`) so you can call the API from any browser tab on the same network.
5
+
The served browser UI receives the generated access token automatically through a strict same-site cookie. Direct API callers must send `X-SimDeck-Token: <token>` or `Authorization: Bearer <token>`.
6
6
7
7
## Conventions
8
8
@@ -25,7 +25,7 @@ Returns server health, the WebTransport URL template, and the certificate hash t
Replace `{udid}` with the simulator UDID from `GET /api/simulators`.
13
+
Replace `{udid}` with the simulator UDID from `GET /api/simulators`. The `simdeckToken` query parameter is included in the authenticated `/api/health` response and is required by the WebTransport server.
|`--advertise-host`| matches `--bind`| Hostname or IP advertised to remote clients in the WebTransport URL template and cert. |
19
20
|`--client-root`| bundled `client/dist`| Override the static client directory. |
20
21
|`--video-codec`|`hevc`| One of `hevc`, `h264`, `h264-software`. See [Video Pipeline](/guide/video). |
22
+
|`--access-token`| generated at startup | Token accepted by `X-SimDeck-Token`, `Authorization: Bearer`, or the served UI cookie. |
21
23
22
24
When the server is up it prints something like:
23
25
24
26
```text
25
27
HTTP listening on http://127.0.0.1:4310
26
28
WebTransport listening on https://127.0.0.1:4311/wt/simulators/{udid}
27
29
Serving client from /usr/local/lib/node_modules/simdeck/client/dist
30
+
API access token: 9f...
28
31
```
29
32
30
33
`Ctrl-C` shuts both servers down cleanly.
@@ -36,6 +39,7 @@ Install SimDeck as a per-user `launchd` service. Same flags as `serve`:
36
39
```sh
37
40
simdeck service on [--port <u16>] [--bind <ip>] [--advertise-host <host>]
38
41
[--client-root <path>] [--video-codec <codec>]
42
+
[--access-token <token>]
39
43
```
40
44
41
45
The command writes `~/Library/LaunchAgents/dev.nativescript.simdeck.plist`, bootstraps it into `gui/<uid>`, and immediately kickstarts it. See [Background Service](/guide/service) for details.
Copy file name to clipboardExpand all lines: docs/cli/flags.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,14 @@ Override the static client directory. The Rust server serves the contents at the
67
67
68
68
Encoder used by the native bridge. See [Video Pipeline](/guide/video) for when to switch.
69
69
70
+
### `--access-token <token>`
71
+
72
+
| Default | generated at startup |
73
+
| ------- | -------------------- |
74
+
| Type | string |
75
+
76
+
HTTP API and WebTransport access token. The served browser UI receives it automatically through a strict same-site cookie, so normal local use does not require copying the token. Direct API callers should send either `X-SimDeck-Token: <token>` or `Authorization: Bearer <token>`.
77
+
70
78
## Positional arguments
71
79
72
80
Subcommands that take positionals expect them in the order shown:
@@ -72,16 +72,24 @@ Restarting the server invalidates the previous certificate. Open clients reconne
72
72
73
73
## Authentication and security
74
74
75
-
SimDeck assumes a trusted local network. The HTTP API has no built-in authentication and the WebTransport endpoint accepts any client that knows the URL.
75
+
SimDeck generates an API access token at startup unless you pass `--access-token <token>`. The served browser UI receives the token automatically through a strict same-site cookie, so opening `http://<advertise-host>:<port>` remains seamless.
76
+
77
+
Direct API callers must send one of:
78
+
79
+
```text
80
+
X-SimDeck-Token: <token>
81
+
Authorization: Bearer <token>
82
+
```
83
+
84
+
The WebTransport URL template returned by authenticated `GET /api/health` includes a `simdeckToken` query parameter for the browser stream worker.
76
85
77
86
Recommended practice for shared networks:
78
87
79
88
- Run SimDeck only on networks you control.
89
+
- Use `--access-token <stable-secret>` for background services or scripted LAN access.
80
90
- Combine with macOS Application Firewall to restrict inbound access to known peers.
81
91
- For shared NativeScript inspectors, set an `authToken` when starting the [Swift in-app agent](/inspector/swift#auth-token) so app-side requests must include the token.
82
92
83
-
A roadmap item is to add an optional bearer-token header for the HTTP API and WebTransport `?token=` parameter. Until that lands, treat SimDeck like any unauthenticated dev tool.
84
-
85
93
## Quick checklist
86
94
87
95
To make a SimDeck server reachable from another device:
0 commit comments