@rstreamlabs/tunnels 2.0.0 → 3.1.0
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/README.md +21 -10
- package/dist/index.d.mts +90 -79
- package/dist/index.d.ts +90 -79
- package/dist/index.js +121 -83
- package/dist/index.mjs +121 -83
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ await watch.connect();
|
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
URL-based watch authentication requires a short-lived token with bounded
|
|
115
|
-
lifetime and watch-only tunnel list
|
|
115
|
+
lifetime and watch-only tunnel list resources.
|
|
116
116
|
|
|
117
117
|
Browser integrations should provide `auth` as a function that calls a backend
|
|
118
118
|
token route and returns a fresh watch token for each connection attempt. Do not
|
|
@@ -121,17 +121,19 @@ store the `rstream.token` query token as durable browser state.
|
|
|
121
121
|
## Scoped Auth Tokens
|
|
122
122
|
|
|
123
123
|
`auth.createAuthToken()` mints short-lived engine tokens. Prefer
|
|
124
|
-
`
|
|
125
|
-
other services.
|
|
124
|
+
`resources.tunnels` when delegating capabilities to devices, browser sessions,
|
|
125
|
+
or other services.
|
|
126
126
|
|
|
127
127
|
```ts
|
|
128
128
|
const { token } = await client.auth.createAuthToken({
|
|
129
129
|
expires_in: 60,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
resources: {
|
|
131
|
+
tunnels: {
|
|
132
|
+
scopes: {
|
|
133
|
+
tunnels: {
|
|
134
|
+
list: { select: { id: true, name: true, protocol: true } },
|
|
135
|
+
connect: { params: { path: { regex: "^/api" } } },
|
|
136
|
+
},
|
|
135
137
|
},
|
|
136
138
|
},
|
|
137
139
|
},
|
|
@@ -139,8 +141,8 @@ const { token } = await client.auth.createAuthToken({
|
|
|
139
141
|
```
|
|
140
142
|
|
|
141
143
|
When the client is configured with `projectEndpoint` or `projectId`, scope-only
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
tunnel resources are project-scoped by default. Pass `projectScoped: false`
|
|
145
|
+
only when a global scope-only tunnel resource is intentional.
|
|
144
146
|
|
|
145
147
|
## TURN Credentials
|
|
146
148
|
|
|
@@ -160,9 +162,14 @@ const turn = await createTURNCredentials({
|
|
|
160
162
|
},
|
|
161
163
|
projectEndpoint: "project-endpoint",
|
|
162
164
|
clusterDomain: "cluster.example.rstream.test",
|
|
165
|
+
ttlSeconds: 600,
|
|
163
166
|
});
|
|
164
167
|
```
|
|
165
168
|
|
|
169
|
+
TURN credentials are short-lived. `ttlSeconds` is optional, defaults to 600 for
|
|
170
|
+
local derivation, and must be an integer between 1 and 3600 seconds. PAT-backed
|
|
171
|
+
credentials are additionally capped by the PAT expiration.
|
|
172
|
+
|
|
166
173
|
## Webhooks
|
|
167
174
|
|
|
168
175
|
Validate signed engine webhook payloads with constant-time signature comparison
|
|
@@ -189,6 +196,10 @@ import { parseWebTTYServers } from "@rstreamlabs/tunnels";
|
|
|
189
196
|
const servers = parseWebTTYServers(await client.tunnels.list());
|
|
190
197
|
```
|
|
191
198
|
|
|
199
|
+
WebTTY server metadata includes advertised capabilities such as `exec` and
|
|
200
|
+
`fs`. Older servers that do not advertise capabilities are treated as
|
|
201
|
+
`exec`-only with the execution path `/`.
|
|
202
|
+
|
|
192
203
|
## OpenAPI Document
|
|
193
204
|
|
|
194
205
|
The package exports the Engine API OpenAPI document from the main entrypoint
|