@freerdp-bridge/fastify 0.0.0-stage → 0.2.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/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,74 @@
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
+ Mount RDP HTTP and WebSocket routes inside an existing Fastify 5 application,
4
+ on its existing port. Each session runs a separate native worker; FreeRDP does
5
+ not run inside Node.js. Requires Node.js 24.
6
+
7
+ Install the adapter and the matching native runtime version for your server:
8
+
9
+ ```sh
10
+ # Linux x64 / glibc
11
+ npm install fastify@5.12.5 @freerdp-bridge/fastify@0.2.1 @freerdp-bridge/runtime-linux-x64-gnu@0.2.1
12
+
13
+ # Windows x64
14
+ npm install fastify@5.12.5 @freerdp-bridge/fastify@0.2.1 @freerdp-bridge/runtime-win32-x64@0.2.1
15
+ ```
16
+
17
+ For an unreleased source checkout, use locally built tarballs instead;
18
+ a source version number alone does not establish registry availability.
19
+ Runtime packages include their private native libraries, helpers and notices.
20
+ They require no compiler or network installation script. Node/browser binaries
21
+ are separate prerequisites. macOS, ARM and musl are not supported by this set.
22
+
23
+ ```ts
24
+ import Fastify from 'fastify';
25
+ import { rdpBridgePlugin, resolveNativeRuntime } from '@freerdp-bridge/fastify';
26
+
27
+ const app = Fastify();
28
+ const worker = await resolveNativeRuntime({
29
+ runtimeRoot: '/private/run/rdp-bridge', // Absolute, private, writable host path.
30
+ });
31
+
32
+ app.register(rdpBridgePlugin, {
33
+ prefix: '/rdp',
34
+ worker,
35
+ allowedOrigins: ['https://app.example'],
36
+ authenticate: request => verifyApplicationIdentity(request),
37
+ });
38
+ await app.listen({ host: '127.0.0.1', port: 8080 });
39
+ ```
40
+
41
+ `verifyApplicationIdentity` is your host application's bearer/mTLS verification,
42
+ returning `{ id: verifiedUserId }` or `undefined`. There is no default identity.
43
+ Cookie-based identity needs a separate CSRF/Origin adapter and is currently
44
+ refused. On Windows, use an absolute Windows path for runtimeRoot. The host
45
+ owns external TLS and access logging; exclude credentials and attach URL tokens.
46
+
47
+ The plugin validates bodies strictly within 64 KiB, preserves session ownership,
48
+ uses single-use control/media tokens, and verifies RDP certificates strictly by
49
+ default. Inspect `/rdp/v1/build` and `/rdp/v1/capabilities` for the actual native
50
+ profile. A package install does not imply all original V1 device capabilities.
51
+
52
+ If your application already owns a catch-all WebSocket router, register with
53
+ `upgradeMode: 'manual'`, retain the bridge handle from `onReady(handle)`, and
54
+ call `handle.handleUpgrade(request, socket, head)` in that router. A true return
55
+ means bridge owns the request; false leaves it untouched for host routing.
56
+ Automatic mode requires other upgrade listeners to select only their own paths.
57
+
58
+ `await app.close()` joins bridge cleanup. `await handle.close()` independently
59
+ retires bridge sockets/workers while preserving the host HTTP/WS application.
60
+ Retain a closed manual handle until host shutdown to refuse late bridge upgrades.
61
+
62
+ `handle.diagnostics()` and authenticated `/rdp/v1/diagnostics` return bounded
63
+ aggregate lifecycle telemetry. Optional session diagnostics use the existing
64
+ control protocol and its rate/size budget; they never include remote contents.
65
+
66
+ `@freerdp-bridge/fastify/browser` exports `referenceBrowserDirectory` with the
67
+ optional reference HTML/JS. Serve those assets through your static router, then
68
+ configure the client with `basePath: '/rdp'`. Keep that prefix on reattachment.
69
+ The host owns presentation, identity and browser permission policy.
70
+
71
+ Complete source-tree guides are `docs/FASTIFY_USAGE.md` and
72
+ `docs/NATIVE_NPM_RUNTIME.md`; the public `.d.ts` files describe the options.
73
+ Project-owned code uses MIT. Native dependencies retain their own licenses in
74
+ 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,32 @@
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.1",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": ">=24 <25"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "LICENSE"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ },
18
+ "./browser": {
19
+ "types": "./dist/browser.d.ts",
20
+ "import": "./dist/browser.js"
21
+ }
22
+ },
23
+ "dependencies": {
24
+ "@freerdp-bridge/api": "0.2.1"
25
+ },
26
+ "peerDependencies": {
27
+ "fastify": "^5.12.5"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc -b"
31
+ }
6
32
  }