Skip to content

Commit fb3a86e

Browse files
Bot Updating Documentation
1 parent 7add7ea commit fb3a86e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/images/docker-baseimage-selkies.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ The server can be forced to use a single, fixed resolution for all connecting cl
179179
| `SELKIES_USE_BROWSER_CURSORS` | `False` | Use browser CSS cursors instead of rendering to canvas. |
180180
| `SELKIES_USE_CSS_SCALING` | `False` | HiDPI when false, if true a lower resolution is sent from the client and the canvas is stretched. |
181181
| `SELKIES_PORT` (or `CUSTOM_WS_PORT`) | `8082` | Port for the data websocket server. |
182+
| `SELKIES_CONTROL_PORT` | `8083` | Port for the internal control plane API, used for managing access tokens when in secure mode. |
183+
| `SELKIES_MASTER_TOKEN` | `''` | Master token to enable secure mode. If set, clients must authenticate using tokens provided via the control plane API. |
182184
| `SELKIES_DRI_NODE` (or `DRI_NODE`) | `''` | Path to the DRI render node for VA-API. |
183185
| `SELKIES_AUDIO_DEVICE_NAME` | `'output.monitor'` | Audio device name for pcmflux capture. |
184186
| `SELKIES_WATERMARK_PATH` (or `WATERMARK_PNG`) | `''` | Absolute path to the watermark PNG file. |
@@ -212,6 +214,43 @@ All base images are built for x86_64 and aarch64 platforms.
212214
| Kali | kali |
213215
| Ubuntu | ubuntunoble |
214216

217+
### Control Plane API for Token Management
218+
219+
When secure mode is enabled (`SELKIES_MASTER_TOKEN` is set), the server runs a control plane API on the `control_port` (default: 8083). This API is used to dynamically set and update the access tokens that clients can use to connect. This control plane port is meant for integrators that want to wrap the baseimage in their own platforms and handle authentication, this port should never be exposed publically.
220+
221+
**Endpoint:** `POST /tokens`
222+
223+
**Authentication:** The request must include an `Authorization` header with the master token: `Authorization: Bearer <your-master-token>`
224+
225+
**Request Body:** A JSON object where each key is a unique access token string you create, and the value is a permissions object defining that token's capabilities.
226+
227+
**Permissions Object Fields:**
228+
* `"role"`: (String, required) Can be one of the following:
229+
* `"controller"`: Full access. Can send keyboard, mouse, and all other input events.
230+
* `"viewer"`: Restricted access. Primarily for viewing the stream. Can be granted specific input rights via the `slot` property.
231+
* `"slot"`: (Integer or `null`, required) Assigns an input slot, for gamepads.
232+
* `null`: No specific input slot. A viewer with a `null` slot has no input capabilities.
233+
* `1`: Grants the `viewer` control over the **Player 1** gamepad *only*.
234+
* `2`: Grants the `viewer` control over the **Player 2** gamepad *only*.
235+
* `3`: Grants the `viewer` control over the **Player 3** gamepad *only*.
236+
* `4`: Grants the `viewer` control over the **Player 4** gamepad *only*.
237+
238+
**Behavior:** When a valid request is received, the server replaces its entire set of active tokens with the new set provided in the payload. It then runs a reconciliation process: any connected client whose token is now invalid or has changed permissions will be disconnected and users input capabilities will be modified live.
239+
240+
**Example `curl` Command:**
241+
```bash
242+
curl -X POST http://localhost:8083/tokens \
243+
-H "Authorization: Bearer my-secret-master-token" \
244+
-H "Content-Type: application/json" \
245+
-d '{
246+
"user-token-1": {"role": "controller", "slot": null},
247+
"user-token-2": {"role": "viewer", "slot": 1},
248+
"user-token-3": {"role": "viewer", "slot": null}
249+
}'
250+
```
251+
252+
Clients in this mode must connect with a valid token (`?token=...`) to establish a WebSocket connection.
253+
215254
### DRI3 GPU Acceleration
216255
217256
For accelerated apps or games, render devices can be mounted into the container and leveraged by applications using:

0 commit comments

Comments
 (0)