@rstreamlabs/webtty 1.9.1 → 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
@@ -389,15 +414,49 @@ WebTTY E2E encryption.
389
414
  Protocol suite identifiers currently represented in the WebTTY protobuf
390
415
  contract are:
391
416
 
392
- | Field | Protocol identifiers |
393
- | ------------------ | ---------------------------------------------------------------------------------- |
394
- | `payloadSuite` | `aes-256-gcm`, `chacha20-poly1305` |
395
- | `keyEnvelopeSuite` | `hpke-x25519-hkdf-sha256-aes-256-gcm`, `hpke-x25519-hkdf-sha256-chacha20-poly1305` |
417
+ | Field | Protocol identifiers |
418
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
419
+ | `payloadSuite` | `aes-256-gcm`, `aes-256-gcm-random-nonce`, `chacha20-poly1305` |
420
+ | `keyEnvelopeSuite` | `hpke-x25519-hkdf-sha256-aes-256-gcm`, `p256-hkdf-sha256-aes-256-gcm-random-nonce`, `hpke-x25519-hkdf-sha256-chacha20-poly1305` |
421
+
422
+ The helpers support two complete E2E profiles. Existing applications keep using
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
425
+ P-256/HKDF-SHA256/AES-256-GCM random-nonce profile and use WebTransport:
426
+
427
+ ```ts
428
+ import { createWebTTYE2EClientPayloadCrypto } from "@rstreamlabs/webtty";
429
+ import { WebTTY } from "@rstreamlabs/webtty";
430
+ import { webTTYFIPSCompatibleKeyEnvelopeSuite } from "@rstreamlabs/webtty";
431
+
432
+ const payloadCrypto = await createWebTTYE2EClientPayloadCrypto({
433
+ keyEnvelopeSuite: webTTYFIPSCompatibleKeyEnvelopeSuite,
434
+ recipients: [
435
+ {
436
+ keyEnvelopeSuite: webTTYFIPSCompatibleKeyEnvelopeSuite,
437
+ keyId: serverKeyId,
438
+ publicKey: serverPublicKey,
439
+ },
440
+ ],
441
+ });
442
+
443
+ const client = new WebTTY(
444
+ { transport: "webtransport", url },
445
+ { payloadCrypto },
446
+ );
447
+ ```
396
448
 
397
- The helpers in this package support only the AES-256-GCM payload suite and the
398
- HPKE/X25519/HKDF-SHA256/AES-256-GCM key-envelope suite. ChaCha20-Poly1305
399
- identifiers are reserved for forward compatibility and are rejected by the
400
- current helpers.
449
+ Standard rstream endpoints accept both profiles. FIPS Go builds accept only the
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
454
+ reserved for forward compatibility and are rejected by the current helpers.
455
+
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.
401
460
 
402
461
  Do not derive payload keys from passwords or application strings.
403
462
 
@@ -425,3 +484,26 @@ npm --workspace @rstreamlabs/webtty run type-check
425
484
  npm --workspace @rstreamlabs/webtty run lint
426
485
  npm --workspace @rstreamlabs/webtty run build
427
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.