@freerdp-bridge/fastify 0.0.0-stage → 0.2.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FreeRDP Browser Bridge contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,91 @@
1
- # Temporary Holding Version
1
+ # FreeRDP Browser Bridge — Fastify
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ## Purpose
4
+
5
+ Mount RDP HTTP and WebSocket routes inside an existing Fastify 5 application,
6
+ on its existing port. Each session runs a separate native worker; FreeRDP does
7
+ not run inside Node.js. Package name: `@freerdp-bridge/fastify`.
8
+
9
+ ## Installation
10
+
11
+ Install the adapter and the matching native runtime version for your server:
12
+
13
+ ```sh
14
+ # Linux x64 / glibc
15
+ npm install fastify@5.12.5 @freerdp-bridge/fastify@0.2.2 @freerdp-bridge/runtime-linux-x64-gnu@0.2.2
16
+
17
+ # Windows x64
18
+ npm install fastify@5.12.5 @freerdp-bridge/fastify@0.2.2 @freerdp-bridge/runtime-win32-x64@0.2.2
19
+ ```
20
+
21
+ For an unreleased source checkout, use locally built tarballs instead;
22
+ a source version number alone does not establish registry availability.
23
+ ## Requirements
24
+
25
+ Requires Node.js 24, ESM, Fastify 5 and a native runtime of the same product
26
+ version as all JS bridge packages. Install the runtime explicitly.
27
+ Runtime packages include their private native libraries, helpers and notices.
28
+ This adapter contains JavaScript/declarations; the compiled C++ worker and
29
+ native IPC components are supplied by the separate platform runtime, not by
30
+ the adapter. The runtime also carries its third-party source companions.
31
+ They require no compiler or network installation script. Node/browser binaries
32
+ are separate prerequisites. macOS, ARM and musl are not supported by this set.
33
+
34
+ ## Usage
35
+
36
+ ```ts
37
+ import Fastify from 'fastify';
38
+ import { rdpBridgePlugin, resolveNativeRuntime } from '@freerdp-bridge/fastify';
39
+
40
+ const app = Fastify();
41
+ const worker = await resolveNativeRuntime({
42
+ runtimeRoot: '/private/run/rdp-bridge', // Absolute, private, writable host path.
43
+ });
44
+
45
+ app.register(rdpBridgePlugin, {
46
+ prefix: '/rdp',
47
+ worker,
48
+ allowedOrigins: ['https://app.example'],
49
+ authenticate: request => verifyApplicationIdentity(request),
50
+ });
51
+ await app.listen({ host: '127.0.0.1', port: 8080 });
52
+ ```
53
+
54
+ `verifyApplicationIdentity` is your host application's bearer/mTLS verification,
55
+ returning `{ id: verifiedUserId }` or `undefined`. There is no default identity.
56
+ Cookie-based identity needs a separate CSRF/Origin adapter and is currently
57
+ refused. On Windows, use an absolute Windows path for runtimeRoot. The host
58
+ owns external TLS and access logging; exclude credentials and attach URL tokens.
59
+
60
+ ## Limitations
61
+
62
+ The plugin validates bodies strictly within 64 KiB, preserves session ownership,
63
+ uses single-use control/media tokens, and verifies RDP certificates strictly by
64
+ default. Inspect `/rdp/v1/build` and `/rdp/v1/capabilities` for the actual native
65
+ profile. A package install does not imply all original V1 device capabilities.
66
+
67
+ If your application already owns a catch-all WebSocket router, register with
68
+ `upgradeMode: 'manual'`, retain the bridge handle from `onReady(handle)`, and
69
+ call `handle.handleUpgrade(request, socket, head)` in that router. A true return
70
+ means bridge owns the request; false leaves it untouched for host routing.
71
+ Automatic mode requires other upgrade listeners to select only their own paths.
72
+
73
+ `await app.close()` joins bridge cleanup. `await handle.close()` independently
74
+ retires bridge sockets/workers while preserving the host HTTP/WS application.
75
+ Retain a closed manual handle until host shutdown to refuse late bridge upgrades.
76
+
77
+ `handle.diagnostics()` and authenticated `/rdp/v1/diagnostics` return bounded
78
+ aggregate lifecycle telemetry. Optional session diagnostics use the existing
79
+ control protocol and its rate/size budget; they never include remote contents.
80
+
81
+ `@freerdp-bridge/fastify/browser` exports `referenceBrowserDirectory` with the
82
+ optional reference HTML/JS. Serve those assets through your static router, then
83
+ configure the client with `basePath: '/rdp'`. Keep that prefix on reattachment.
84
+ The host owns presentation, identity and browser permission policy.
85
+
86
+ Complete source-tree guides are `docs/FASTIFY_USAGE.md` and
87
+ `docs/NATIVE_NPM_RUNTIME.md`; the public `.d.ts` files describe the options.
88
+ ## License
89
+
90
+ Project-owned code uses MIT (LICENSE). Native dependencies retain their own licenses in
91
+ the platform runtime package's THIRD_PARTY_NOTICES.md and bundled notices.
@@ -0,0 +1 @@
1
+ export { referenceBrowserDirectory } from '@freerdp-bridge/api/browser';
@@ -0,0 +1,2 @@
1
+ export { referenceBrowserDirectory } from '@freerdp-bridge/api/browser';
2
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { rdpBridgePlugin, NativeSessionWorker, WorkerProcess, SessionManager, SessionError, createSecureLogger, resolveNativeRuntime, NativeRuntimeError, } from '@freerdp-bridge/api/fastify';
2
+ export type { RdpBridgePluginOptions, BridgeHandle, WorkerOptions, SessionCreate, Principal, NativeRuntimeOptions, } from '@freerdp-bridge/api/fastify';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { rdpBridgePlugin, NativeSessionWorker, WorkerProcess, SessionManager, SessionError, createSecureLogger, resolveNativeRuntime, NativeRuntimeError, } from '@freerdp-bridge/api/fastify';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@freerdp-bridge/fastify",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.2",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": ">=24 <25"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "LICENSE",
12
+ "README.md"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./browser": {
20
+ "types": "./dist/browser.d.ts",
21
+ "import": "./dist/browser.js"
22
+ }
23
+ },
24
+ "dependencies": {
25
+ "@freerdp-bridge/api": "0.2.2"
26
+ },
27
+ "peerDependencies": {
28
+ "fastify": "^5.12.5"
29
+ },
30
+ "scripts": {
31
+ "build": "tsc -b"
32
+ }
6
33
  }