@rstreamlabs/webtty 1.10.0 → 1.11.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 CHANGED
@@ -266,6 +266,31 @@ The browser client uses WebSocket by default:
266
266
  const terminal = new WebTTY({ url: "wss://terminal.example/session" });
267
267
  ```
268
268
 
269
+ In Node.js, supply the Node transport to each client configuration:
270
+
271
+ ```ts
272
+ import { nodeWebSocketFactory } from "@rstreamlabs/webtty/node";
273
+ import { runWebTTYCommand } from "@rstreamlabs/webtty/node";
274
+
275
+ const result = await runWebTTYCommand(
276
+ {
277
+ url: "wss://terminal.example/session",
278
+ webSocketFactory: nodeWebSocketFactory,
279
+ },
280
+ "whoami",
281
+ );
282
+ ```
283
+
284
+ This uses HTTP/1.1 WebSocket with normal TLS verification, a 10-second handshake
285
+ deadline, a 1-second close deadline and the configured `maxMessageSize` limit.
286
+ It works independently of the global WebSocket implementation and does not
287
+ modify other clients or browser bundles. The same option applies to `WebTTY`,
288
+ `openWebTTYCommand` and `WebTTYRemoteExecutor`. WebTransport still requires a
289
+ runtime that provides it; selecting it never falls back silently to WebSocket.
290
+ Node 26.7's experimental HTTP/2 WebSocket handshake rejects a conforming
291
+ [RFC 8441 endpoint](https://www.rfc-editor.org/rfc/rfc8441.html#section-5);
292
+ the Node factory avoids that runtime-specific failure.
293
+
269
294
  Use WebTransport when the endpoint is published over HTTP/3 WebTransport:
270
295
 
271
296
  ```ts
@@ -395,17 +420,20 @@ contract are:
395
420
  | `keyEnvelopeSuite` | `hpke-x25519-hkdf-sha256-aes-256-gcm`, `p256-hkdf-sha256-aes-256-gcm-random-nonce`, `hpke-x25519-hkdf-sha256-chacha20-poly1305` |
396
421
 
397
422
  The helpers support two complete E2E profiles. Existing applications keep using
398
- the default HPKE/X25519/HKDF-SHA256/AES-256-GCM profile. Applications that need
399
- to interoperate with a FIPS build of the Go client or engine must select the
423
+ the default HPKE/X25519/HKDF-SHA256/AES-256-GCM profile. Applications that use
424
+ E2E with a FIPS build of the Go client or engine must select the
400
425
  P-256/HKDF-SHA256/AES-256-GCM random-nonce profile and use WebTransport:
401
426
 
402
427
  ```ts
403
- const keyEnvelopeSuite = "p256-hkdf-sha256-aes-256-gcm-random-nonce" as const;
404
- const identity = await generateWebTTYE2EIdentity(keyEnvelopeSuite);
428
+ import { createWebTTYE2EClientPayloadCrypto } from "@rstreamlabs/webtty";
429
+ import { WebTTY } from "@rstreamlabs/webtty";
430
+ import { webTTYFIPSCompatibleKeyEnvelopeSuite } from "@rstreamlabs/webtty";
431
+
405
432
  const payloadCrypto = await createWebTTYE2EClientPayloadCrypto({
433
+ keyEnvelopeSuite: webTTYFIPSCompatibleKeyEnvelopeSuite,
406
434
  recipients: [
407
435
  {
408
- keyEnvelopeSuite,
436
+ keyEnvelopeSuite: webTTYFIPSCompatibleKeyEnvelopeSuite,
409
437
  keyId: serverKeyId,
410
438
  publicKey: serverPublicKey,
411
439
  },
@@ -419,15 +447,16 @@ const client = new WebTTY(
419
447
  ```
420
448
 
421
449
  Standard rstream endpoints accept both profiles. FIPS Go builds accept only the
422
- P-256 random-nonce profile and WebTransport. ChaCha20-Poly1305 identifiers remain
450
+ P-256 random-nonce profile for E2E and require WebTransport. Application E2E
451
+ is optional unless server or workspace policy requires it; a transport-only
452
+ connection does not protect terminal content from an Engine that terminates
453
+ transport encryption. ChaCha20-Poly1305 identifiers remain
423
454
  reserved for forward compatibility and are rejected by the current helpers.
424
455
 
425
- This JavaScript implementation is protocol-compatible with the FIPS profile;
426
- it does not embed the validated Go Cryptographic Module and is not itself a
427
- validated FIPS 140-3 cryptographic module. The **FIPS 140-3 Inside — Go
428
- Cryptographic Module, Certificate #5247 (Overall Security Level 1)** statement
429
- applies only to the corresponding Go client and engine artifacts that embed
430
- and enforce that module, not to browser WebCrypto or this JavaScript package.
456
+ This JavaScript implementation provides protocol interoperability with the
457
+ FIPS Go artifacts. Browser WebCrypto does not embed the validated Go
458
+ Cryptographic Module, so this package does not carry the Go module's FIPS
459
+ 140-3 Inside status.
431
460
 
432
461
  Do not derive payload keys from passwords or application strings.
433
462
 
@@ -455,3 +484,26 @@ npm --workspace @rstreamlabs/webtty run type-check
455
484
  npm --workspace @rstreamlabs/webtty run lint
456
485
  npm --workspace @rstreamlabs/webtty run build
457
486
  ```
487
+
488
+ # Transport resource limits
489
+
490
+ `WebTTYClientConfig.maxMessageSize` limits encoded messages in both directions
491
+ and defaults to 1 MiB. WebTransport validates a frame length before allocating
492
+ its body and buffers at most one partial frame. It pauses reads while an async
493
+ message handler (including E2E decryption) is pending. Incoming WebSocket data
494
+ and outgoing transport queues are bounded to four times the message limit;
495
+ SDK queues also have a 1,024 message limit. Exceeding a limit closes the session
496
+ with an explicit error. Applications should split large stdin writes into
497
+ chunks below the message limit, allowing for protobuf and encryption overhead.
498
+
499
+ Disconnect cancels pending transport setup and reads, aborts writes and drops
500
+ queued terminal data. Late decryption results are not delivered after a local
501
+ disconnect. A runtime without WebTransport reports that capability limitation.
502
+
503
+ For Node local trust helpers, `RSTREAM_DATA_DIR` selects an absolute state root
504
+ instead of the default `~/.rstream`. This matches the Go and C++ CLI state layout
505
+ and is independent of the engine connection configuration.
506
+
507
+ ## Shared filesystem backend
508
+
509
+ `WebTTYFileSystem` and its existing exports remain available. The implementation now lives in `@rstreamlabs/filesystem`, which also exports `WebDAVFileSystem` and the transport-independent `FileSystemBackend` interface. Existing WebTTY write helpers and configuration are preserved. New read clients can use `readStream` to avoid buffering large downloads; native `downloadURL` is available only when authentication does not require custom headers. This filesystem protocol is independent from the temporary encrypted file-sharing utility and from WebTTY E2E payload encryption.