@rstreamlabs/tunnels 3.9.0 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/openapi.d.ts CHANGED
@@ -24,11 +24,19 @@ declare const engineOpenApiDocument: {
24
24
  };
25
25
  };
26
26
  }[];
27
- security: {
27
+ security: ({
28
28
  bearerAuth: never[];
29
- }[];
29
+ mutualTLS?: undefined;
30
+ } | {
31
+ mutualTLS: never[];
32
+ bearerAuth?: undefined;
33
+ })[];
30
34
  components: {
31
35
  securitySchemes: {
36
+ mutualTLS: {
37
+ type: string;
38
+ description: string;
39
+ };
32
40
  bearerAuth: {
33
41
  type: string;
34
42
  scheme: string;
@@ -98,6 +106,74 @@ declare const engineOpenApiDocument: {
98
106
  };
99
107
  };
100
108
  schemas: {
109
+ EngineDiscovery: {
110
+ type: string;
111
+ required: string[];
112
+ properties: {
113
+ version: {
114
+ type: string;
115
+ const: number;
116
+ };
117
+ projectEndpoint: {
118
+ type: string;
119
+ };
120
+ mtlsApiUrl: {
121
+ type: string;
122
+ format: string;
123
+ example: string;
124
+ };
125
+ capabilities: {
126
+ type: string;
127
+ items: {
128
+ type: string;
129
+ };
130
+ examples: string[][];
131
+ };
132
+ };
133
+ };
134
+ CreateTURNCredentials: {
135
+ type: string;
136
+ additionalProperties: boolean;
137
+ properties: {
138
+ ttlSeconds: {
139
+ type: string;
140
+ minimum: number;
141
+ maximum: number;
142
+ default: number;
143
+ };
144
+ };
145
+ };
146
+ TURNCredentials: {
147
+ type: string;
148
+ required: string[];
149
+ properties: {
150
+ username: {
151
+ type: string;
152
+ maxLength: number;
153
+ description: string;
154
+ };
155
+ credential: {
156
+ type: string;
157
+ maxLength: number;
158
+ description: string;
159
+ };
160
+ urls: {
161
+ type: string;
162
+ minItems: number;
163
+ maxItems: number;
164
+ items: {
165
+ type: string;
166
+ maxLength: number;
167
+ };
168
+ };
169
+ ttl: {
170
+ type: string;
171
+ minimum: number;
172
+ maximum: number;
173
+ description: string;
174
+ };
175
+ };
176
+ };
101
177
  Client: unknown;
102
178
  Event: unknown;
103
179
  ListClientsParams: unknown;
@@ -122,6 +198,164 @@ declare const engineOpenApiDocument: {
122
198
  "read-managed-webtty-recordings": string[];
123
199
  };
124
200
  paths: {
201
+ "/.well-known/rstream/engine": {
202
+ get: {
203
+ tags: string[];
204
+ summary: string;
205
+ operationId: string;
206
+ description: string;
207
+ security: never[];
208
+ responses: {
209
+ "200": {
210
+ description: string;
211
+ headers: {
212
+ "Cache-Control": {
213
+ schema: {
214
+ type: string;
215
+ };
216
+ example: string;
217
+ };
218
+ };
219
+ content: {
220
+ "application/json": {
221
+ schema: {
222
+ $ref: string;
223
+ };
224
+ };
225
+ };
226
+ };
227
+ "404": {
228
+ description: string;
229
+ };
230
+ };
231
+ };
232
+ };
233
+ "/api/turn-server/credentials": {
234
+ post: {
235
+ tags: string[];
236
+ summary: string;
237
+ operationId: string;
238
+ description: string;
239
+ security: ({
240
+ bearerAuth: never[];
241
+ mutualTLS?: undefined;
242
+ } | {
243
+ mutualTLS: never[];
244
+ bearerAuth?: undefined;
245
+ })[];
246
+ requestBody: {
247
+ required: boolean;
248
+ content: {
249
+ "application/json": {
250
+ schema: {
251
+ $ref: string;
252
+ };
253
+ };
254
+ };
255
+ };
256
+ responses: {
257
+ "200": {
258
+ description: string;
259
+ headers: {
260
+ "Cache-Control": {
261
+ schema: {
262
+ type: string;
263
+ };
264
+ example: string;
265
+ };
266
+ };
267
+ content: {
268
+ "application/json": {
269
+ schema: {
270
+ $ref: string;
271
+ };
272
+ };
273
+ };
274
+ };
275
+ "400": {
276
+ description: string;
277
+ headers: {
278
+ "Cache-Control": {
279
+ schema: {
280
+ type: string;
281
+ };
282
+ example: string;
283
+ };
284
+ };
285
+ };
286
+ "401": {
287
+ description: string;
288
+ headers: {
289
+ "Cache-Control": {
290
+ schema: {
291
+ type: string;
292
+ };
293
+ example: string;
294
+ };
295
+ };
296
+ };
297
+ "403": {
298
+ description: string;
299
+ headers: {
300
+ "Cache-Control": {
301
+ schema: {
302
+ type: string;
303
+ };
304
+ example: string;
305
+ };
306
+ };
307
+ };
308
+ "404": {
309
+ description: string;
310
+ headers: {
311
+ "Cache-Control": {
312
+ schema: {
313
+ type: string;
314
+ };
315
+ example: string;
316
+ };
317
+ };
318
+ };
319
+ "409": {
320
+ description: string;
321
+ headers: {
322
+ "Cache-Control": {
323
+ schema: {
324
+ type: string;
325
+ };
326
+ example: string;
327
+ };
328
+ };
329
+ };
330
+ "429": {
331
+ description: string;
332
+ headers: {
333
+ "Cache-Control": {
334
+ schema: {
335
+ type: string;
336
+ };
337
+ example: string;
338
+ };
339
+ };
340
+ };
341
+ "503": {
342
+ description: string;
343
+ headers: {
344
+ "Cache-Control": {
345
+ schema: {
346
+ type: string;
347
+ };
348
+ example: string;
349
+ };
350
+ };
351
+ };
352
+ };
353
+ "x-rstream-required-rules": {
354
+ resource: string;
355
+ action: string;
356
+ }[];
357
+ };
358
+ };
125
359
  "/api/openapi.json": {
126
360
  get: {
127
361
  tags: string[];
@@ -150,9 +384,13 @@ declare const engineOpenApiDocument: {
150
384
  parameters: {
151
385
  $ref: string;
152
386
  }[];
153
- security: {
387
+ security: ({
154
388
  bearerAuth: never[];
155
- }[];
389
+ mutualTLS?: undefined;
390
+ } | {
391
+ mutualTLS: never[];
392
+ bearerAuth?: undefined;
393
+ })[];
156
394
  responses: {
157
395
  "200": {
158
396
  description: string;
@@ -188,9 +426,13 @@ declare const engineOpenApiDocument: {
188
426
  parameters: {
189
427
  $ref: string;
190
428
  }[];
191
- security: {
429
+ security: ({
192
430
  bearerAuth: never[];
193
- }[];
431
+ mutualTLS?: undefined;
432
+ } | {
433
+ mutualTLS: never[];
434
+ bearerAuth?: undefined;
435
+ })[];
194
436
  responses: {
195
437
  "200": {
196
438
  description: string;
@@ -227,9 +469,13 @@ declare const engineOpenApiDocument: {
227
469
  parameters: {
228
470
  $ref: string;
229
471
  }[];
230
- security: {
472
+ security: ({
231
473
  bearerAuth: never[];
232
- }[];
474
+ mutualTLS?: undefined;
475
+ } | {
476
+ mutualTLS: never[];
477
+ bearerAuth?: undefined;
478
+ })[];
233
479
  responses: {
234
480
  "200": {
235
481
  description: string;
@@ -263,9 +509,13 @@ declare const engineOpenApiDocument: {
263
509
  parameters: {
264
510
  $ref: string;
265
511
  }[];
266
- security: {
512
+ security: ({
267
513
  bearerAuth: never[];
268
- }[];
514
+ mutualTLS?: undefined;
515
+ } | {
516
+ mutualTLS: never[];
517
+ bearerAuth?: undefined;
518
+ })[];
269
519
  responses: {
270
520
  "101": {
271
521
  description: string;
package/dist/openapi.js CHANGED
@@ -861,6 +861,19 @@ var watchParamsSchema = z7.object({
861
861
  tunnels: tunnelFilterSchema.optional()
862
862
  });
863
863
  var enginePermissions = {
864
+ "turn.credentials.create": {
865
+ name: "TURN Credentials: Create",
866
+ description: "Issue short-lived TURN credentials through either the Control plane or Engine API.",
867
+ rules: [
868
+ {
869
+ resource: [
870
+ "api.turn-server.credentials",
871
+ "engine.turn-server.credentials"
872
+ ],
873
+ action: "create"
874
+ }
875
+ ]
876
+ },
864
877
  "tunnels.resources.read-only": {
865
878
  name: "Discovery: Read-Only",
866
879
  description: "Read active clients, active tunnels, and live state events.",
@@ -940,13 +953,13 @@ var engineOpenApiDocument = {
940
953
  }
941
954
  }
942
955
  ],
943
- security: [
944
- {
945
- bearerAuth: []
946
- }
947
- ],
956
+ security: [{ bearerAuth: [] }, { mutualTLS: [] }],
948
957
  components: {
949
958
  securitySchemes: {
959
+ mutualTLS: {
960
+ type: "mutualTLS",
961
+ description: "EE project API only, on the dedicated authority returned by anonymous HTTPS discovery. Present one registered client certificate without a bearer or query token. Ordinary browser-facing hosts never request a client certificate."
962
+ },
950
963
  bearerAuth: {
951
964
  type: "http",
952
965
  scheme: "bearer",
@@ -1014,6 +1027,64 @@ var engineOpenApiDocument = {
1014
1027
  Forbidden: errorResponse("The token is not authorized.")
1015
1028
  },
1016
1029
  schemas: {
1030
+ EngineDiscovery: {
1031
+ type: "object",
1032
+ required: ["version", "projectEndpoint", "mtlsApiUrl", "capabilities"],
1033
+ properties: {
1034
+ version: { type: "integer", const: 1 },
1035
+ projectEndpoint: { type: "string" },
1036
+ mtlsApiUrl: {
1037
+ type: "string",
1038
+ format: "uri",
1039
+ example: "https://project.mtls.engine.example/api"
1040
+ },
1041
+ capabilities: {
1042
+ type: "array",
1043
+ items: { type: "string" },
1044
+ examples: [["engine-api-mtls", "turn-credentials-v2"]]
1045
+ }
1046
+ }
1047
+ },
1048
+ CreateTURNCredentials: {
1049
+ type: "object",
1050
+ additionalProperties: false,
1051
+ properties: {
1052
+ ttlSeconds: {
1053
+ type: "integer",
1054
+ minimum: 1,
1055
+ maximum: 3600,
1056
+ default: 600
1057
+ }
1058
+ }
1059
+ },
1060
+ TURNCredentials: {
1061
+ type: "object",
1062
+ required: ["username", "credential", "urls", "ttl"],
1063
+ properties: {
1064
+ username: {
1065
+ type: "string",
1066
+ maxLength: 512,
1067
+ description: "Opaque short-lived v2 issued identity. Do not parse in clients."
1068
+ },
1069
+ credential: {
1070
+ type: "string",
1071
+ maxLength: 1024,
1072
+ description: "Short-lived TURN password."
1073
+ },
1074
+ urls: {
1075
+ type: "array",
1076
+ minItems: 1,
1077
+ maxItems: 16,
1078
+ items: { type: "string", maxLength: 2048 }
1079
+ },
1080
+ ttl: {
1081
+ type: "integer",
1082
+ minimum: 1,
1083
+ maximum: 3600,
1084
+ description: "Effective remaining lifetime in seconds, clipped to identity, source credential and certificate expiry."
1085
+ }
1086
+ }
1087
+ },
1017
1088
  Client: jsonSchemaFor(clientSchema),
1018
1089
  Event: jsonSchemaFor(wsEventsSchema),
1019
1090
  ListClientsParams: jsonSchemaFor(listClientsParamsSchema),
@@ -1048,6 +1119,133 @@ var engineOpenApiDocument = {
1048
1119
  "read-managed-webtty-recordings": ["webtty.logs.read-only"]
1049
1120
  },
1050
1121
  paths: {
1122
+ "/.well-known/rstream/engine": {
1123
+ get: {
1124
+ tags: ["Discovery"],
1125
+ summary: "Discover the dedicated project mTLS API.",
1126
+ operationId: "get_engine_discovery",
1127
+ description: "Anonymous GET on the ordinary project Engine authority. Follow the returned HTTPS URL; do not infer an mTLS hostname. Cache per client using Cache-Control (normally one hour). No certificate, bearer token, cookie or redirect is required. Available only where an explicit EE mapping is configured.",
1128
+ security: [],
1129
+ responses: {
1130
+ "200": {
1131
+ description: "Project-bound discovery. Capabilities describe enabled server features; callers still need the corresponding rights.",
1132
+ headers: {
1133
+ "Cache-Control": {
1134
+ schema: { type: "string" },
1135
+ example: "public, max-age=3600"
1136
+ }
1137
+ },
1138
+ content: {
1139
+ "application/json": {
1140
+ schema: { $ref: "#/components/schemas/EngineDiscovery" }
1141
+ }
1142
+ }
1143
+ },
1144
+ "404": {
1145
+ description: "Dedicated mTLS API is not configured on this authority."
1146
+ }
1147
+ }
1148
+ }
1149
+ },
1150
+ "/api/turn-server/credentials": {
1151
+ post: {
1152
+ tags: ["TURN"],
1153
+ summary: "Issue short-lived project TURN credentials.",
1154
+ operationId: "create_engine_turn_credentials",
1155
+ description: "EE managed projects. Same request and response contract as Control plane project TURN issuance. Empty body is valid. Issued credentials require turn.credentials.create only; turn.relay.allocate applies to local PAT/APP derivation. Issuance does not allocate a relay and does not bypass relay quotas or revocation checks.",
1156
+ security: [{ bearerAuth: [] }, { mutualTLS: [] }],
1157
+ requestBody: {
1158
+ required: false,
1159
+ content: {
1160
+ "application/json": {
1161
+ schema: { $ref: "#/components/schemas/CreateTURNCredentials" }
1162
+ }
1163
+ }
1164
+ },
1165
+ responses: {
1166
+ "200": {
1167
+ description: "Short-lived project TURN credentials.",
1168
+ headers: {
1169
+ "Cache-Control": {
1170
+ schema: { type: "string" },
1171
+ example: "no-store"
1172
+ }
1173
+ },
1174
+ content: {
1175
+ "application/json": {
1176
+ schema: { $ref: "#/components/schemas/TURNCredentials" }
1177
+ }
1178
+ }
1179
+ },
1180
+ "400": {
1181
+ description: "Malformed, unknown or out-of-range request fields; body exceeds 4 KiB.",
1182
+ headers: {
1183
+ "Cache-Control": {
1184
+ schema: { type: "string" },
1185
+ example: "no-store"
1186
+ }
1187
+ }
1188
+ },
1189
+ "401": {
1190
+ description: "Missing, invalid, expired or mixed authentication proofs.",
1191
+ headers: {
1192
+ "Cache-Control": {
1193
+ schema: { type: "string" },
1194
+ example: "no-store"
1195
+ }
1196
+ }
1197
+ },
1198
+ "403": {
1199
+ description: "Missing turn.credentials.create permission, workspace membership or project resource scope.",
1200
+ headers: {
1201
+ "Cache-Control": {
1202
+ schema: { type: "string" },
1203
+ example: "no-store"
1204
+ }
1205
+ }
1206
+ },
1207
+ "404": {
1208
+ description: "Project not found.",
1209
+ headers: {
1210
+ "Cache-Control": {
1211
+ schema: { type: "string" },
1212
+ example: "no-store"
1213
+ }
1214
+ }
1215
+ },
1216
+ "409": {
1217
+ description: "Project or serving infrastructure is inactive.",
1218
+ headers: {
1219
+ "Cache-Control": {
1220
+ schema: { type: "string" },
1221
+ example: "no-store"
1222
+ }
1223
+ }
1224
+ },
1225
+ "429": {
1226
+ description: "Rate limit exceeded; do not retry through another issuer.",
1227
+ headers: {
1228
+ "Cache-Control": {
1229
+ schema: { type: "string" },
1230
+ example: "no-store"
1231
+ }
1232
+ }
1233
+ },
1234
+ "503": {
1235
+ description: "Authentication backend, serving metadata or issued keyring unavailable.",
1236
+ headers: {
1237
+ "Cache-Control": {
1238
+ schema: { type: "string" },
1239
+ example: "no-store"
1240
+ }
1241
+ }
1242
+ }
1243
+ },
1244
+ "x-rstream-required-rules": [
1245
+ { resource: "engine.turn-server.credentials", action: "create" }
1246
+ ]
1247
+ }
1248
+ },
1051
1249
  "/api/openapi.json": {
1052
1250
  get: {
1053
1251
  tags: ["Discovery"],
@@ -1074,7 +1272,7 @@ var engineOpenApiDocument = {
1074
1272
  summary: "List visible engine clients.",
1075
1273
  operationId: "list_engine_clients",
1076
1274
  parameters: [{ $ref: "#/components/parameters/ListClientsParams" }],
1077
- security: [{ bearerAuth: [] }],
1275
+ security: [{ bearerAuth: [] }, { mutualTLS: [] }],
1078
1276
  responses: {
1079
1277
  "200": jsonArrayResponse(
1080
1278
  "Visible clients.",
@@ -1093,7 +1291,7 @@ var engineOpenApiDocument = {
1093
1291
  summary: "List visible engine tunnels.",
1094
1292
  operationId: "list_engine_tunnels",
1095
1293
  parameters: [{ $ref: "#/components/parameters/ListTunnelsParams" }],
1096
- security: [{ bearerAuth: [] }],
1294
+ security: [{ bearerAuth: [] }, { mutualTLS: [] }],
1097
1295
  responses: {
1098
1296
  "200": jsonArrayResponse(
1099
1297
  "Visible tunnels. Fine-grained list scopes may filter objects and project fields.",
@@ -1113,7 +1311,7 @@ var engineOpenApiDocument = {
1113
1311
  summary: "Subscribe to visible engine state through Server-Sent Events.",
1114
1312
  operationId: "watch_engine_events_sse",
1115
1313
  parameters: [{ $ref: "#/components/parameters/WatchParams" }],
1116
- security: [{ bearerAuth: [] }],
1314
+ security: [{ bearerAuth: [] }, { mutualTLS: [] }],
1117
1315
  responses: {
1118
1316
  "200": streamResponse(
1119
1317
  "SSE stream. Each event is emitted as a data line containing a JSON Event object."
@@ -1132,7 +1330,7 @@ var engineOpenApiDocument = {
1132
1330
  summary: "Subscribe to visible engine state through a WebSocket upgrade.",
1133
1331
  operationId: "watch_engine_events_websocket",
1134
1332
  parameters: [{ $ref: "#/components/parameters/WatchParams" }],
1135
- security: [{ bearerAuth: [] }],
1333
+ security: [{ bearerAuth: [] }, { mutualTLS: [] }],
1136
1334
  responses: {
1137
1335
  "101": {
1138
1336
  description: "WebSocket connection accepted. Frames contain JSON Event objects."
package/dist/openapi.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  engineOpenApiDocument,
3
3
  engineOpenApiJson
4
- } from "./chunk-3VBF43NB.mjs";
4
+ } from "./chunk-DQN5T7CI.mjs";
5
5
  export {
6
6
  engineOpenApiDocument,
7
7
  engineOpenApiJson
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstreamlabs/tunnels",
3
- "version": "3.9.0",
3
+ "version": "3.10.1",
4
4
  "description": "JS/TS SDK for the rstream Engine API and tunnel runtime APIs.",
5
5
  "author": "@uartnet <hello@rstream.io>",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "typescript-config": "*"
48
48
  },
49
49
  "dependencies": {
50
- "@rstreamlabs/rstream": "3.8.2",
50
+ "@rstreamlabs/rstream": "3.9.1",
51
51
  "@types/jsonwebtoken": "^9.0.10",
52
52
  "jsonwebtoken": "^9.0.3",
53
53
  "zod": "^4.4.3"