autodev-cli 1.4.0 → 1.4.3
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/bin/autodev.js +0 -0
- package/out/agentBackup/archive.d.ts +44 -0
- package/out/agentBackup/archive.js +131 -0
- package/out/agentBackup/archive.js.map +1 -0
- package/out/agentBackup/export.d.ts +18 -0
- package/out/agentBackup/export.js +92 -0
- package/out/agentBackup/export.js.map +1 -0
- package/out/agentBackup/import.d.ts +21 -0
- package/out/agentBackup/import.js +40 -0
- package/out/agentBackup/import.js.map +1 -0
- package/out/agentBackup/index.d.ts +6 -0
- package/out/agentBackup/index.js +11 -0
- package/out/agentBackup/index.js.map +1 -0
- package/out/agentBackup/layout.d.ts +30 -0
- package/out/agentBackup/layout.js +126 -0
- package/out/agentBackup/layout.js.map +1 -0
- package/out/agentBackup/manifest.d.ts +24 -0
- package/out/agentBackup/manifest.js +70 -0
- package/out/agentBackup/manifest.js.map +1 -0
- package/out/agentBackup/opencodeDb.d.ts +20 -0
- package/out/agentBackup/opencodeDb.js +213 -0
- package/out/agentBackup/opencodeDb.js.map +1 -0
- package/out/agentBackup/sessionProviders.d.ts +35 -0
- package/out/agentBackup/sessionProviders.js +263 -0
- package/out/agentBackup/sessionProviders.js.map +1 -0
- package/out/agentBackup/upload.d.ts +9 -0
- package/out/agentBackup/upload.js +121 -0
- package/out/agentBackup/upload.js.map +1 -0
- package/out/cli.d.ts +1 -0
- package/out/cli.js +8 -0
- package/out/cli.js.map +1 -1
- package/out/cliExit.d.ts +34 -0
- package/out/cliExit.js +159 -0
- package/out/cliExit.js.map +1 -0
- package/out/commands/config.d.ts +2 -0
- package/out/commands/config.js +7 -7
- package/out/commands/config.js.map +1 -1
- package/out/commands/connect.d.ts +2 -0
- package/out/commands/connect.js +11 -0
- package/out/commands/connect.js.map +1 -1
- package/out/commands/export.d.ts +2 -0
- package/out/commands/export.js +79 -0
- package/out/commands/export.js.map +1 -0
- package/out/commands/import.d.ts +2 -0
- package/out/commands/import.js +92 -0
- package/out/commands/import.js.map +1 -0
- package/out/commands/init.d.ts +16 -0
- package/out/commands/init.js +9 -5
- package/out/commands/init.js.map +1 -1
- package/out/commands/resume.d.ts +2 -0
- package/out/commands/resume.js +65 -0
- package/out/commands/resume.js.map +1 -0
- package/out/commands/sessions.d.ts +2 -0
- package/out/commands/sessions.js +64 -0
- package/out/commands/sessions.js.map +1 -0
- package/out/commands/start.d.ts +2 -0
- package/out/commands/start.js +40 -7
- package/out/commands/start.js.map +1 -1
- package/out/commands/status.d.ts +2 -0
- package/out/commands/status.js +3 -3
- package/out/commands/status.js.map +1 -1
- package/out/commands/tailOutput.d.ts +12 -0
- package/out/commands/up.d.ts +3 -0
- package/out/configManager.d.ts +42 -0
- package/out/configManager.js +430 -0
- package/out/configManager.js.map +1 -0
- package/out/connect.d.ts +4 -0
- package/out/connect.js +7 -7
- package/out/connect.js.map +1 -1
- package/out/core/adapters.d.ts +34 -0
- package/out/core/adapters.js +84 -0
- package/out/core/adapters.js.map +1 -0
- package/out/core/commandHelpers.d.ts +12 -0
- package/out/core/commandHelpers.js +96 -0
- package/out/core/commandHelpers.js.map +1 -0
- package/out/core/projectMcp.d.ts +25 -0
- package/out/core/projectMcp.js +144 -0
- package/out/core/projectMcp.js.map +1 -0
- package/out/core/provider/BaseProvider.d.ts +14 -0
- package/out/core/provider/BaseProvider.js +25 -0
- package/out/core/provider/BaseProvider.js.map +1 -0
- package/out/core/provider/ProviderRegistry.d.ts +12 -0
- package/out/core/provider/ProviderRegistry.js +40 -0
- package/out/core/provider/ProviderRegistry.js.map +1 -0
- package/out/core/provider/contract.d.ts +62 -0
- package/out/core/provider/contract.js +9 -0
- package/out/core/provider/contract.js.map +1 -0
- package/out/core/provider/implementations.d.ts +54 -0
- package/out/core/provider/implementations.js +147 -0
- package/out/core/provider/implementations.js.map +1 -0
- package/out/core/settingsLoader.d.ts +221 -0
- package/out/core/settingsLoader.js +176 -0
- package/out/core/settingsLoader.js.map +1 -0
- package/out/discordGateway.d.ts +26 -0
- package/out/discordGateway.js +230 -0
- package/out/discordGateway.js.map +1 -0
- package/out/discordPoller.d.ts +28 -0
- package/out/discordPoller.js +247 -0
- package/out/discordPoller.js.map +1 -0
- package/out/dispatcher.d.ts +12 -0
- package/out/dispatcher.js +214 -0
- package/out/dispatcher.js.map +1 -0
- package/out/emailPoller.d.ts +42 -0
- package/out/emailPoller.js +221 -0
- package/out/emailPoller.js.map +1 -0
- package/out/git/gitService.d.ts +36 -0
- package/out/git/gitService.js +165 -0
- package/out/git/gitService.js.map +1 -0
- package/out/hookEventNormalizer.d.ts +39 -0
- package/out/hookEventNormalizer.js +397 -0
- package/out/hookEventNormalizer.js.map +1 -0
- package/out/hooksManager.d.ts +25 -0
- package/out/hooksManager.js +471 -0
- package/out/hooksManager.js.map +1 -0
- package/out/launchIde.d.ts +14 -0
- package/out/logger.d.ts +12 -0
- package/out/mcpEmailTest.d.ts +29 -0
- package/out/mcpEmailTest.js +245 -0
- package/out/mcpEmailTest.js.map +1 -0
- package/out/mcpInstallCheck.d.ts +23 -0
- package/out/mcpInstallCheck.js +219 -0
- package/out/mcpInstallCheck.js.map +1 -0
- package/out/mcpManager.d.ts +35 -0
- package/out/mcpManager.js +371 -0
- package/out/mcpManager.js.map +1 -0
- package/out/messageBuilder.d.ts +54 -0
- package/out/messageBuilder.js +373 -0
- package/out/messageBuilder.js.map +1 -0
- package/out/openCodeHooksManager.d.ts +23 -0
- package/out/openCodeHooksManager.js +511 -0
- package/out/openCodeHooksManager.js.map +1 -0
- package/out/periodicActions.d.ts +63 -0
- package/out/periodicActions.js +237 -0
- package/out/periodicActions.js.map +1 -0
- package/out/profileBuilder.d.ts +29 -0
- package/out/profileBuilder.js +366 -0
- package/out/profileBuilder.js.map +1 -0
- package/out/prompt.d.ts +12 -0
- package/out/prompt.js +18 -0
- package/out/prompt.js.map +1 -0
- package/out/protocolSections.d.ts +26 -0
- package/out/protocolSections.js +209 -0
- package/out/protocolSections.js.map +1 -0
- package/out/providers/claudeCliProvider.d.ts +71 -0
- package/out/providers/claudeCliProvider.js +425 -0
- package/out/providers/claudeCliProvider.js.map +1 -0
- package/out/providers/claudeTuiProvider.d.ts +23 -0
- package/out/providers/claudeTuiProvider.js +296 -0
- package/out/providers/claudeTuiProvider.js.map +1 -0
- package/out/providers/copilotCliProvider.d.ts +16 -0
- package/out/providers/copilotCliProvider.js +44 -0
- package/out/providers/copilotCliProvider.js.map +1 -0
- package/out/providers/copilotSdkProvider.d.ts +12 -0
- package/out/providers/copilotSdkProvider.js +445 -0
- package/out/providers/copilotSdkProvider.js.map +1 -0
- package/out/providers/grokTuiProvider.d.ts +14 -0
- package/out/providers/grokTuiProvider.js +271 -0
- package/out/providers/grokTuiProvider.js.map +1 -0
- package/out/providers/opencodeCliProvider.d.ts +29 -0
- package/out/providers/opencodeCliProvider.js +199 -0
- package/out/providers/opencodeCliProvider.js.map +1 -0
- package/out/providers/opencodeSdkProvider.d.ts +22 -0
- package/out/providers/opencodeSdkProvider.js +557 -0
- package/out/providers/opencodeSdkProvider.js.map +1 -0
- package/out/providers.d.ts +9 -0
- package/out/providers.js +44 -0
- package/out/providers.js.map +1 -0
- package/out/rateLimit.d.ts +18 -0
- package/out/rateLimit.js +90 -0
- package/out/rateLimit.js.map +1 -0
- package/out/rdp/auth.d.ts +55 -0
- package/out/rdp/auth.js +197 -0
- package/out/rdp/auth.js.map +1 -0
- package/out/rdp/bridge.d.ts +86 -0
- package/out/rdp/bridge.js +1398 -0
- package/out/rdp/bridge.js.map +1 -0
- package/out/rdp/constants.d.ts +86 -0
- package/out/rdp/constants.js +182 -0
- package/out/rdp/constants.js.map +1 -0
- package/out/rdp/index.d.ts +7 -0
- package/out/rdp/index.js +14 -0
- package/out/rdp/index.js.map +1 -0
- package/out/rdp/session.d.ts +30 -0
- package/out/rdp/session.js +196 -0
- package/out/rdp/session.js.map +1 -0
- package/out/rdp/types.d.ts +27 -0
- package/out/rdp/types.js +6 -0
- package/out/rdp/types.js.map +1 -0
- package/out/sdk/index.d.ts +22 -0
- package/out/sdk/index.js +81 -0
- package/out/sdk/index.js.map +1 -0
- package/out/sessionState.d.ts +54 -0
- package/out/sessionState.js +284 -0
- package/out/sessionState.js.map +1 -0
- package/out/sessions.d.ts +11 -0
- package/out/sessions.js +32 -0
- package/out/sessions.js.map +1 -0
- package/out/taskLoop.d.ts +152 -0
- package/out/taskLoop.js +2505 -0
- package/out/taskLoop.js.map +1 -0
- package/out/todo.d.ts +42 -0
- package/out/todo.js +311 -0
- package/out/todo.js.map +1 -0
- package/out/todoWriteManager.d.ts +26 -0
- package/out/todoWriteManager.js +44 -0
- package/out/todoWriteManager.js.map +1 -0
- package/out/vnc/auth.d.ts +52 -0
- package/out/vnc/auth.js +181 -0
- package/out/vnc/auth.js.map +1 -0
- package/out/vnc/bridge.d.ts +40 -0
- package/out/vnc/bridge.js +540 -0
- package/out/vnc/bridge.js.map +1 -0
- package/out/vnc/constants.d.ts +8 -0
- package/out/vnc/constants.js +34 -0
- package/out/vnc/constants.js.map +1 -0
- package/out/vnc/des.d.ts +6 -0
- package/out/vnc/des.js +93 -0
- package/out/vnc/des.js.map +1 -0
- package/out/vnc/index.d.ts +7 -0
- package/out/vnc/index.js +13 -0
- package/out/vnc/index.js.map +1 -0
- package/out/vnc/session.d.ts +18 -0
- package/out/vnc/session.js +193 -0
- package/out/vnc/session.js.map +1 -0
- package/out/vnc/types.d.ts +16 -0
- package/out/vnc/types.js +6 -0
- package/out/vnc/types.js.map +1 -0
- package/out/webSocketPoller.d.ts +95 -0
- package/out/webSocketPoller.js +986 -0
- package/out/webSocketPoller.js.map +1 -0
- package/out/webhook.d.ts +37 -0
- package/out/webhook.js +265 -0
- package/out/webhook.js.map +1 -0
- package/out/webhookPoller.d.ts +40 -0
- package/out/webhookPoller.js +378 -0
- package/out/webhookPoller.js.map +1 -0
- package/package.json +54 -41
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* VncBridge — TCP connection to a local VNC server.
|
|
4
|
+
*
|
|
5
|
+
* Handles RFB protocol version negotiation (3.3 / 3.7 / 3.8) and
|
|
6
|
+
* security types: None (1), VNC auth/DES (2), VeNCrypt (19).
|
|
7
|
+
*
|
|
8
|
+
* Emits:
|
|
9
|
+
* 'frame' (rect: VncRect) — one decoded framebuffer rectangle
|
|
10
|
+
* 'error' (err: Error) — unrecoverable error (connection closed)
|
|
11
|
+
* 'close' () — TCP connection closed
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.VncBridge = void 0;
|
|
48
|
+
const net = __importStar(require("net"));
|
|
49
|
+
const events_1 = require("events");
|
|
50
|
+
const auth_1 = require("./auth");
|
|
51
|
+
const constants_1 = require("./constants");
|
|
52
|
+
class VncBridge extends events_1.EventEmitter {
|
|
53
|
+
_sock = null;
|
|
54
|
+
_width = 0;
|
|
55
|
+
_height = 0;
|
|
56
|
+
_bypp = 4; // bytes-per-pixel (always 4 after we negotiate 32bpp)
|
|
57
|
+
_recvBuf = Buffer.alloc(0);
|
|
58
|
+
_closed = false;
|
|
59
|
+
get width() { return this._width; }
|
|
60
|
+
get height() { return this._height; }
|
|
61
|
+
// ── Public API ─────────────────────────────────────────────────────────────
|
|
62
|
+
/** Connect to a VNC server at 127.0.0.1:port. Resolves once handshake is done. */
|
|
63
|
+
connect(port, password, username) {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
const sock = net.createConnection(port, '127.0.0.1');
|
|
66
|
+
this._sock = sock;
|
|
67
|
+
// Pending-read queue for the async auth helpers
|
|
68
|
+
const readQueue = [];
|
|
69
|
+
let readBuf = Buffer.alloc(0);
|
|
70
|
+
const flushReadQueue = () => {
|
|
71
|
+
while (readQueue.length && readBuf.length >= readQueue[0].n) {
|
|
72
|
+
const { n, resolve: res } = readQueue.shift();
|
|
73
|
+
res(readBuf.slice(0, n));
|
|
74
|
+
readBuf = readBuf.slice(n);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const readExact = (n) => new Promise(res => { readQueue.push({ n, resolve: res }); flushReadQueue(); });
|
|
78
|
+
sock.on('error', (err) => {
|
|
79
|
+
if (!this._closed) {
|
|
80
|
+
this._closed = true;
|
|
81
|
+
this.emit('error', err);
|
|
82
|
+
reject(err);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
sock.on('close', () => {
|
|
86
|
+
if (!this._closed) {
|
|
87
|
+
this._closed = true;
|
|
88
|
+
this.emit('close');
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
let state = 'version';
|
|
92
|
+
let rfbMinor = 3; // negotiated minor version (3, 7, or 8)
|
|
93
|
+
let authTypeCount = 0;
|
|
94
|
+
let nameLen = 0;
|
|
95
|
+
let authTypePicked = 0;
|
|
96
|
+
/** Called by async VeNCrypt path to continue the synchronous state machine. */
|
|
97
|
+
const continueAfterAsyncAuth = () => {
|
|
98
|
+
state = 'server_init';
|
|
99
|
+
processBuf();
|
|
100
|
+
};
|
|
101
|
+
const processBuf = () => {
|
|
102
|
+
while (true) {
|
|
103
|
+
if (state === 'version') {
|
|
104
|
+
const nl = this._recvBuf.indexOf(0x0a);
|
|
105
|
+
if (nl === -1)
|
|
106
|
+
break;
|
|
107
|
+
const verStr = this._recvBuf.slice(0, nl + 1).toString('ascii');
|
|
108
|
+
this._recvBuf = this._recvBuf.slice(nl + 1);
|
|
109
|
+
if (!verStr.startsWith('RFB ')) {
|
|
110
|
+
reject(new Error('Not an RFB server'));
|
|
111
|
+
sock.destroy();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Parse "RFB 003.00x\n"
|
|
115
|
+
const m = verStr.match(/RFB (\d+)\.(\d+)/);
|
|
116
|
+
const serverMinor = m ? parseInt(m[2]) : 3;
|
|
117
|
+
rfbMinor = serverMinor >= 8 ? 8 : serverMinor >= 7 ? 7 : 3;
|
|
118
|
+
sock.write(`RFB 003.00${rfbMinor}\n`);
|
|
119
|
+
if (rfbMinor >= 7) {
|
|
120
|
+
state = 'auth37_count';
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
state = 'auth_type'; // RFB 3.3: server sends a single 4-byte type
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (state === 'auth37_count') {
|
|
127
|
+
if (this._recvBuf.length < 1)
|
|
128
|
+
break;
|
|
129
|
+
authTypeCount = this._recvBuf[0];
|
|
130
|
+
this._recvBuf = this._recvBuf.slice(1);
|
|
131
|
+
if (authTypeCount === 0) {
|
|
132
|
+
// Server sent error — read reason length+string next, but just fail
|
|
133
|
+
reject(new Error('VNC server rejected connection (no security types)'));
|
|
134
|
+
sock.destroy();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
state = 'auth37_types';
|
|
138
|
+
}
|
|
139
|
+
else if (state === 'auth37_types') {
|
|
140
|
+
if (this._recvBuf.length < authTypeCount)
|
|
141
|
+
break;
|
|
142
|
+
const serverTypes = [];
|
|
143
|
+
for (let i = 0; i < authTypeCount; i++)
|
|
144
|
+
serverTypes.push(this._recvBuf[i]);
|
|
145
|
+
this._recvBuf = this._recvBuf.slice(authTypeCount);
|
|
146
|
+
const chosen = (0, auth_1.pickAuthType)(serverTypes);
|
|
147
|
+
if (!chosen) {
|
|
148
|
+
reject(new Error(`No supported auth type (server offers: ${serverTypes.join(', ')})`));
|
|
149
|
+
sock.destroy();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
authTypePicked = chosen;
|
|
153
|
+
sock.write(Buffer.from([chosen]));
|
|
154
|
+
if (chosen === auth_1.AUTH_NONE) {
|
|
155
|
+
if (rfbMinor >= 8) {
|
|
156
|
+
state = 'auth_result38'; // 3.8 sends a result even for None auth
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// RFB 3.7 + None: no result sent, jump straight to ClientInit
|
|
160
|
+
sock.write(Buffer.from([1])); // shared flag (1 = shared session)
|
|
161
|
+
state = 'server_init';
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else if (chosen === auth_1.AUTH_VNC) {
|
|
165
|
+
state = 'auth_challenge';
|
|
166
|
+
}
|
|
167
|
+
else if (chosen === auth_1.AUTH_VENCRYPT) {
|
|
168
|
+
// Hand off to async VeNCrypt negotiator; sync loop exits here
|
|
169
|
+
this._handleVeNCrypt(sock, readExact, password, username)
|
|
170
|
+
.then(continueAfterAsyncAuth)
|
|
171
|
+
.catch((e) => { reject(e); sock.destroy(); });
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else if (state === 'auth_type') {
|
|
176
|
+
// RFB 3.3 — server sends a single 4-byte auth type
|
|
177
|
+
if (this._recvBuf.length < 4)
|
|
178
|
+
break;
|
|
179
|
+
const authType = this._recvBuf.readUInt32BE(0);
|
|
180
|
+
this._recvBuf = this._recvBuf.slice(4);
|
|
181
|
+
authTypePicked = authType;
|
|
182
|
+
if (authType === 0) {
|
|
183
|
+
reject(new Error('VNC server rejected connection'));
|
|
184
|
+
sock.destroy();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (authType === auth_1.AUTH_NONE) {
|
|
188
|
+
sock.write(Buffer.from([1])); // shared flag (1 = shared session)
|
|
189
|
+
state = 'server_init';
|
|
190
|
+
}
|
|
191
|
+
else if (authType === auth_1.AUTH_VNC) {
|
|
192
|
+
state = 'auth_challenge';
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
reject(new Error(`Unsupported VNC auth type: ${authType}`));
|
|
196
|
+
sock.destroy();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else if (state === 'auth_challenge') {
|
|
201
|
+
if (this._recvBuf.length < 16)
|
|
202
|
+
break;
|
|
203
|
+
const challenge = this._recvBuf.slice(0, 16);
|
|
204
|
+
this._recvBuf = this._recvBuf.slice(16);
|
|
205
|
+
if (!password) {
|
|
206
|
+
reject(new Error('VNC server requires a password'));
|
|
207
|
+
sock.destroy();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
sock.write((0, auth_1.vncDesResponse)(challenge, password));
|
|
211
|
+
state = rfbMinor >= 8 ? 'auth_result38' : 'auth_result';
|
|
212
|
+
}
|
|
213
|
+
else if (state === 'auth_result') {
|
|
214
|
+
// RFB 3.3 / 3.7 result
|
|
215
|
+
if (this._recvBuf.length < 4)
|
|
216
|
+
break;
|
|
217
|
+
const result = this._recvBuf.readUInt32BE(0);
|
|
218
|
+
this._recvBuf = this._recvBuf.slice(4);
|
|
219
|
+
if (result !== 0) {
|
|
220
|
+
reject(new Error('VNC authentication failed'));
|
|
221
|
+
sock.destroy();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
sock.write(Buffer.from([1])); // shared flag (1 = shared session)
|
|
225
|
+
state = 'server_init';
|
|
226
|
+
}
|
|
227
|
+
else if (state === 'auth_result38') {
|
|
228
|
+
// RFB 3.8 result (also includes reason string on failure)
|
|
229
|
+
if (this._recvBuf.length < 4)
|
|
230
|
+
break;
|
|
231
|
+
const result = this._recvBuf.readUInt32BE(0);
|
|
232
|
+
this._recvBuf = this._recvBuf.slice(4);
|
|
233
|
+
if (result !== 0) {
|
|
234
|
+
// Try to read the reason string length
|
|
235
|
+
if (this._recvBuf.length < 4)
|
|
236
|
+
break;
|
|
237
|
+
const rlen = this._recvBuf.readUInt32BE(0);
|
|
238
|
+
if (this._recvBuf.length < 4 + rlen)
|
|
239
|
+
break;
|
|
240
|
+
const reason = this._recvBuf.slice(4, 4 + rlen).toString('utf8');
|
|
241
|
+
this._recvBuf = this._recvBuf.slice(4 + rlen);
|
|
242
|
+
reject(new Error(`VNC authentication failed: ${reason}`));
|
|
243
|
+
sock.destroy();
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
sock.write(Buffer.from([1])); // shared flag (1 = shared session)
|
|
247
|
+
state = 'server_init';
|
|
248
|
+
}
|
|
249
|
+
else if (state === 'server_init') {
|
|
250
|
+
if (this._recvBuf.length < 24)
|
|
251
|
+
break;
|
|
252
|
+
this._width = this._recvBuf.readUInt16BE(0);
|
|
253
|
+
this._height = this._recvBuf.readUInt16BE(2);
|
|
254
|
+
const bpp = this._recvBuf[4];
|
|
255
|
+
this._bypp = bpp / 8;
|
|
256
|
+
nameLen = this._recvBuf.readUInt32BE(20);
|
|
257
|
+
this._recvBuf = this._recvBuf.slice(24);
|
|
258
|
+
state = 'server_name';
|
|
259
|
+
}
|
|
260
|
+
else if (state === 'server_name') {
|
|
261
|
+
if (this._recvBuf.length < nameLen)
|
|
262
|
+
break;
|
|
263
|
+
const name = this._recvBuf.slice(0, nameLen).toString('utf8');
|
|
264
|
+
this._recvBuf = this._recvBuf.slice(nameLen);
|
|
265
|
+
state = 'running';
|
|
266
|
+
this._sendSetPixelFormat();
|
|
267
|
+
this._sendSetEncodings([constants_1.ENC_RAW, constants_1.ENC_COPYRECT, constants_1.ENC_CURSOR]);
|
|
268
|
+
resolve({ name, width: this._width, height: this._height });
|
|
269
|
+
}
|
|
270
|
+
else if (state === 'running') {
|
|
271
|
+
if (!this._parseServerMessage())
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
sock.on('data', (chunk) => {
|
|
277
|
+
// Feed data to both the sync state machine and the async read queue
|
|
278
|
+
this._recvBuf = Buffer.concat([this._recvBuf, chunk]);
|
|
279
|
+
readBuf = Buffer.concat([readBuf, chunk]);
|
|
280
|
+
flushReadQueue();
|
|
281
|
+
if (state !== 'running' || !this._closed)
|
|
282
|
+
processBuf();
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
/** Request a framebuffer update. */
|
|
287
|
+
requestUpdate(x = 0, y = 0, w, h, incremental = 1) {
|
|
288
|
+
if (!this._sock || this._closed)
|
|
289
|
+
return;
|
|
290
|
+
const fw = w ?? this._width;
|
|
291
|
+
const fh = h ?? this._height;
|
|
292
|
+
const buf = Buffer.alloc(10);
|
|
293
|
+
buf[0] = 3;
|
|
294
|
+
buf[1] = incremental;
|
|
295
|
+
buf.writeUInt16BE(x, 2);
|
|
296
|
+
buf.writeUInt16BE(y, 4);
|
|
297
|
+
buf.writeUInt16BE(fw, 6);
|
|
298
|
+
buf.writeUInt16BE(fh, 8);
|
|
299
|
+
this._sock.write(buf);
|
|
300
|
+
}
|
|
301
|
+
/** Send a key event. */
|
|
302
|
+
sendKey(keysym, down) {
|
|
303
|
+
if (!this._sock || this._closed)
|
|
304
|
+
return;
|
|
305
|
+
const buf = Buffer.alloc(8);
|
|
306
|
+
buf[0] = 4;
|
|
307
|
+
buf[1] = down ? 1 : 0;
|
|
308
|
+
buf.writeUInt32BE(keysym, 4);
|
|
309
|
+
this._sock.write(buf);
|
|
310
|
+
}
|
|
311
|
+
/** Send a ClientCutText message (push local clipboard to remote). */
|
|
312
|
+
sendClientCutText(text) {
|
|
313
|
+
if (!this._sock || this._closed)
|
|
314
|
+
return;
|
|
315
|
+
const encoded = Buffer.from(text, 'latin1');
|
|
316
|
+
const buf = Buffer.alloc(8 + encoded.length);
|
|
317
|
+
buf[0] = 6; // ClientCutText
|
|
318
|
+
// buf[1..3] = padding (0)
|
|
319
|
+
buf.writeUInt32BE(encoded.length, 4);
|
|
320
|
+
encoded.copy(buf, 8);
|
|
321
|
+
this._sock.write(buf);
|
|
322
|
+
}
|
|
323
|
+
/** Send a pointer (mouse) event. */
|
|
324
|
+
sendMouse(x, y, buttonMask) {
|
|
325
|
+
if (!this._sock || this._closed)
|
|
326
|
+
return;
|
|
327
|
+
const buf = Buffer.alloc(6);
|
|
328
|
+
buf[0] = 5;
|
|
329
|
+
buf[1] = buttonMask;
|
|
330
|
+
buf.writeUInt16BE(x, 2);
|
|
331
|
+
buf.writeUInt16BE(y, 4);
|
|
332
|
+
this._sock.write(buf);
|
|
333
|
+
}
|
|
334
|
+
close() {
|
|
335
|
+
if (!this._closed) {
|
|
336
|
+
this._closed = true;
|
|
337
|
+
this._sock?.destroy();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// ── Private: VeNCrypt async negotiation ───────────────────────────────────
|
|
341
|
+
async _handleVeNCrypt(sock, readExact, password, username) {
|
|
342
|
+
const { stream, subType } = await (0, auth_1.negotiateVeNCrypt)(sock, readExact, password, username);
|
|
343
|
+
// If the upgraded stream is a TLS socket, swap it in
|
|
344
|
+
if (stream !== sock) {
|
|
345
|
+
this._sock = stream;
|
|
346
|
+
// Pipe new TLS data into _recvBuf
|
|
347
|
+
stream.on('data', (chunk) => {
|
|
348
|
+
this._recvBuf = Buffer.concat([this._recvBuf, chunk]);
|
|
349
|
+
this._runRunning();
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
// Inner VNC auth for TLSVNC / X509VNC
|
|
353
|
+
if (subType === auth_1.VENCRYPT_TLSVNC || subType === auth_1.VENCRYPT_X509VNC) {
|
|
354
|
+
// Server sends a 16-byte challenge
|
|
355
|
+
const challenge = await new Promise((res, rej) => {
|
|
356
|
+
const collect = (chunk) => {
|
|
357
|
+
this._recvBuf = Buffer.concat([this._recvBuf, chunk]);
|
|
358
|
+
if (this._recvBuf.length >= 16) {
|
|
359
|
+
stream.off('data', collect);
|
|
360
|
+
const ch = this._recvBuf.slice(0, 16);
|
|
361
|
+
this._recvBuf = this._recvBuf.slice(16);
|
|
362
|
+
res(ch);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
stream.on('data', collect);
|
|
366
|
+
setTimeout(() => rej(new Error('VeNCrypt VNC challenge timeout')), 10_000);
|
|
367
|
+
});
|
|
368
|
+
if (!password)
|
|
369
|
+
throw new Error('VeNCrypt VNC sub-auth requires a password');
|
|
370
|
+
stream.write((0, auth_1.vncDesResponse)(challenge, password));
|
|
371
|
+
}
|
|
372
|
+
// Read auth result (4 bytes, 0 = OK)
|
|
373
|
+
const resultBuf = await new Promise((res, rej) => {
|
|
374
|
+
const collect = (chunk) => {
|
|
375
|
+
this._recvBuf = Buffer.concat([this._recvBuf, chunk]);
|
|
376
|
+
if (this._recvBuf.length >= 4) {
|
|
377
|
+
stream.off('data', collect);
|
|
378
|
+
const r = this._recvBuf.slice(0, 4);
|
|
379
|
+
this._recvBuf = this._recvBuf.slice(4);
|
|
380
|
+
res(r);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
stream.on('data', collect);
|
|
384
|
+
setTimeout(() => rej(new Error('VeNCrypt auth result timeout')), 10_000);
|
|
385
|
+
});
|
|
386
|
+
const result = resultBuf.readUInt32BE(0);
|
|
387
|
+
if (result !== 0)
|
|
388
|
+
throw new Error('VeNCrypt authentication failed');
|
|
389
|
+
// Send ClientInit (shared flag = 1 = allow multiple viewers)
|
|
390
|
+
stream.write(Buffer.from([1]));
|
|
391
|
+
}
|
|
392
|
+
_runRunning() {
|
|
393
|
+
// eslint-disable-next-line no-constant-condition
|
|
394
|
+
while (true) {
|
|
395
|
+
if (!this._parseServerMessage())
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
// ── Private: pixel format + encodings ────────────────────────────────────
|
|
400
|
+
_sendSetPixelFormat() {
|
|
401
|
+
if (!this._sock)
|
|
402
|
+
return;
|
|
403
|
+
const buf = Buffer.alloc(20);
|
|
404
|
+
buf[0] = 0; // SetPixelFormat
|
|
405
|
+
// 3 padding bytes
|
|
406
|
+
buf[4] = 32; // bits-per-pixel
|
|
407
|
+
buf[5] = 24; // depth
|
|
408
|
+
buf[6] = 0; // big-endian flag (little-endian)
|
|
409
|
+
buf[7] = 1; // true-colour flag
|
|
410
|
+
buf.writeUInt16BE(255, 8); // red-max
|
|
411
|
+
buf.writeUInt16BE(255, 10); // green-max
|
|
412
|
+
buf.writeUInt16BE(255, 12); // blue-max
|
|
413
|
+
buf[14] = 0; // red-shift → byte 0 = R
|
|
414
|
+
buf[15] = 8; // green-shift → byte 1 = G
|
|
415
|
+
buf[16] = 16; // blue-shift → byte 2 = B
|
|
416
|
+
// byte 3 = padding (0)
|
|
417
|
+
this._sock.write(buf);
|
|
418
|
+
this._bypp = 4;
|
|
419
|
+
}
|
|
420
|
+
_sendSetEncodings(encodings) {
|
|
421
|
+
if (!this._sock)
|
|
422
|
+
return;
|
|
423
|
+
const buf = Buffer.alloc(4 + encodings.length * 4);
|
|
424
|
+
buf[0] = 2; // SetEncodings
|
|
425
|
+
buf.writeUInt16BE(encodings.length, 2);
|
|
426
|
+
for (let i = 0; i < encodings.length; i++)
|
|
427
|
+
buf.writeInt32BE(encodings[i], 4 + i * 4);
|
|
428
|
+
this._sock.write(buf);
|
|
429
|
+
}
|
|
430
|
+
// ── Private: incoming server messages ────────────────────────────────────
|
|
431
|
+
_parseServerMessage() {
|
|
432
|
+
if (this._recvBuf.length < 1)
|
|
433
|
+
return false;
|
|
434
|
+
const msgType = this._recvBuf[0];
|
|
435
|
+
if (msgType === 0)
|
|
436
|
+
return this._parseFBU();
|
|
437
|
+
if (msgType === 2) {
|
|
438
|
+
// Bell
|
|
439
|
+
this._recvBuf = this._recvBuf.slice(1);
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
if (msgType === 3) {
|
|
443
|
+
// ServerCutText — remote clipboard changed; forward to frontend
|
|
444
|
+
if (this._recvBuf.length < 8)
|
|
445
|
+
return false;
|
|
446
|
+
const len = this._recvBuf.readUInt32BE(4);
|
|
447
|
+
if (this._recvBuf.length < 8 + len)
|
|
448
|
+
return false;
|
|
449
|
+
const text = this._recvBuf.slice(8, 8 + len).toString('latin1');
|
|
450
|
+
this._recvBuf = this._recvBuf.slice(8 + len);
|
|
451
|
+
this.emit('clipboard', text);
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
this.emit('error', new Error(`Unknown RFB server message type: ${msgType}`));
|
|
455
|
+
this.close();
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
_parseFBU() {
|
|
459
|
+
// FramebufferUpdate header: type(1) + pad(1) + count(2) = 4 bytes
|
|
460
|
+
if (this._recvBuf.length < 4)
|
|
461
|
+
return false;
|
|
462
|
+
const rectCount = this._recvBuf.readUInt16BE(2);
|
|
463
|
+
let offset = 4;
|
|
464
|
+
// Accumulate all rects from this FBU before emitting so the session can
|
|
465
|
+
// compress them all in a single deflate operation (better ratio) and send
|
|
466
|
+
// them in one WebSocket message (far fewer round-trips on busy screens).
|
|
467
|
+
const rects = [];
|
|
468
|
+
for (let i = 0; i < rectCount; i++) {
|
|
469
|
+
if (this._recvBuf.length < offset + 12)
|
|
470
|
+
return false;
|
|
471
|
+
const x = this._recvBuf.readUInt16BE(offset);
|
|
472
|
+
const y = this._recvBuf.readUInt16BE(offset + 2);
|
|
473
|
+
const w = this._recvBuf.readUInt16BE(offset + 4);
|
|
474
|
+
const h = this._recvBuf.readUInt16BE(offset + 6);
|
|
475
|
+
const enc = this._recvBuf.readInt32BE(offset + 8);
|
|
476
|
+
offset += 12;
|
|
477
|
+
if (enc === constants_1.ENC_RAW) {
|
|
478
|
+
const pixelBytes = w * h * this._bypp;
|
|
479
|
+
if (this._recvBuf.length < offset + pixelBytes)
|
|
480
|
+
return false;
|
|
481
|
+
const data = Buffer.from(this._recvBuf.slice(offset, offset + pixelBytes));
|
|
482
|
+
offset += pixelBytes;
|
|
483
|
+
rects.push({ x, y, w, h, encoding: 'Raw', data });
|
|
484
|
+
}
|
|
485
|
+
else if (enc === constants_1.ENC_COPYRECT) {
|
|
486
|
+
if (this._recvBuf.length < offset + 4)
|
|
487
|
+
return false;
|
|
488
|
+
const data = Buffer.from(this._recvBuf.slice(offset, offset + 4));
|
|
489
|
+
offset += 4;
|
|
490
|
+
rects.push({ x, y, w, h, encoding: 'CopyRect', data });
|
|
491
|
+
}
|
|
492
|
+
else if (enc === constants_1.ENC_CURSOR) {
|
|
493
|
+
// Cursor pseudo-encoding: x=hotX, y=hotY, w/h=cursor size.
|
|
494
|
+
// Payload: [w*h*bypp] pixel bytes + [ceil(w/8)*h] bitmask bytes.
|
|
495
|
+
const maskRowBytes = Math.ceil(w / 8);
|
|
496
|
+
const pixelBytes = w * h * this._bypp;
|
|
497
|
+
const maskBytes = maskRowBytes * h;
|
|
498
|
+
const totalBytes = pixelBytes + maskBytes;
|
|
499
|
+
if (this._recvBuf.length < offset + totalBytes)
|
|
500
|
+
return false;
|
|
501
|
+
const pixelData = this._recvBuf.slice(offset, offset + pixelBytes);
|
|
502
|
+
const maskData = this._recvBuf.slice(offset + pixelBytes, offset + totalBytes);
|
|
503
|
+
offset += totalBytes;
|
|
504
|
+
// Convert to RGBA — our pixel format: R=byte0, G=byte1, B=byte2, pad=byte3.
|
|
505
|
+
// Alpha comes from the bitmask (MSB first per byte, one bit per pixel).
|
|
506
|
+
const rgba = Buffer.alloc(w * h * 4);
|
|
507
|
+
for (let py = 0; py < h; py++) {
|
|
508
|
+
for (let px = 0; px < w; px++) {
|
|
509
|
+
const pi = (py * w + px) * this._bypp;
|
|
510
|
+
const ri = (py * w + px) * 4;
|
|
511
|
+
const bit = (maskData[py * maskRowBytes + Math.floor(px / 8)] >> (7 - (px % 8))) & 1;
|
|
512
|
+
rgba[ri] = pixelData[pi];
|
|
513
|
+
rgba[ri + 1] = pixelData[pi + 1];
|
|
514
|
+
rgba[ri + 2] = pixelData[pi + 2];
|
|
515
|
+
rgba[ri + 3] = bit ? 255 : 0;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
this.emit('cursor', {
|
|
519
|
+
hotX: x, hotY: y,
|
|
520
|
+
width: w, height: h,
|
|
521
|
+
rgba: rgba.toString('base64'),
|
|
522
|
+
});
|
|
523
|
+
// Cursor is a pseudo-encoding — not added to rects[]
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
this.emit('error', new Error(`Unsupported FBU encoding: ${enc}`));
|
|
527
|
+
this.close();
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
this._recvBuf = this._recvBuf.slice(offset);
|
|
532
|
+
// Always emit 'fbu' even when rects is empty (cursor-only FBU).
|
|
533
|
+
// session.ts must receive this event to clear _pendingFuq; skipping it
|
|
534
|
+
// when rects.length === 0 causes a permanent pipeline deadlock.
|
|
535
|
+
this.emit('fbu', rects);
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
exports.VncBridge = VncBridge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;gBAClE,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5C,gEAAgE;QAChE,uEAAuE;QACvE,gEAAgE;QAChE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArdD,8BAqdC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFB protocol constants and X11 keysym mappings.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ENC_RAW = 0;
|
|
5
|
+
export declare const ENC_COPYRECT = 1;
|
|
6
|
+
export declare const ENC_HEXTILE = 5;
|
|
7
|
+
export declare const ENC_CURSOR = -239;
|
|
8
|
+
export declare const KEYSYM: Record<number, number>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* RFB protocol constants and X11 keysym mappings.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.KEYSYM = exports.ENC_CURSOR = exports.ENC_HEXTILE = exports.ENC_COPYRECT = exports.ENC_RAW = void 0;
|
|
7
|
+
// ── Encoding types ─────────────────────────────────────────────────────────
|
|
8
|
+
exports.ENC_RAW = 0;
|
|
9
|
+
exports.ENC_COPYRECT = 1;
|
|
10
|
+
exports.ENC_HEXTILE = 5; // parsed but not yet sent to browser
|
|
11
|
+
exports.ENC_CURSOR = -239; // RFB pseudo-encoding: cursor shape
|
|
12
|
+
// ── X11 keysym translations (JS keyCode → X11 keysym) ─────────────────────
|
|
13
|
+
exports.KEYSYM = {
|
|
14
|
+
8: 0xff08, // BackSpace
|
|
15
|
+
9: 0xff09, // Tab
|
|
16
|
+
13: 0xff0d, // Return
|
|
17
|
+
27: 0xff1b, // Escape
|
|
18
|
+
35: 0xff57, // End
|
|
19
|
+
36: 0xff50, // Home
|
|
20
|
+
37: 0xff51, // Left
|
|
21
|
+
38: 0xff52, // Up
|
|
22
|
+
39: 0xff53, // Right
|
|
23
|
+
40: 0xff54, // Down
|
|
24
|
+
45: 0xff63, // Insert
|
|
25
|
+
46: 0xffff, // Delete
|
|
26
|
+
112: 0xffbe, 113: 0xffbf, 114: 0xffc0, 115: 0xffc1, // F1–F4
|
|
27
|
+
116: 0xffc2, 117: 0xffc3, 118: 0xffc4, 119: 0xffc5, // F5–F8
|
|
28
|
+
120: 0xffc6, 121: 0xffc7, 122: 0xffc8, 123: 0xffc9, // F9–F12
|
|
29
|
+
16: 0xffe1, // Shift
|
|
30
|
+
17: 0xffe3, // Ctrl
|
|
31
|
+
18: 0xffe9, // Alt
|
|
32
|
+
91: 0xffeb, // Meta/Super
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/vnc/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8EAA8E;AAEjE,QAAA,OAAO,GAAQ,CAAC,CAAC;AACjB,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,WAAW,GAAI,CAAC,CAAC,CAAE,qCAAqC;AACxD,QAAA,UAAU,GAAK,CAAC,GAAG,CAAC,CAAC,oCAAoC;AAEtE,6EAA6E;AAEhE,QAAA,MAAM,GAA2B;IAC5C,CAAC,EAAG,MAAM,EAAE,YAAY;IACxB,CAAC,EAAG,MAAM,EAAE,MAAM;IAClB,EAAE,EAAE,MAAM,EAAE,SAAS;IACrB,EAAE,EAAE,MAAM,EAAE,SAAS;IACrB,EAAE,EAAE,MAAM,EAAE,MAAM;IAClB,EAAE,EAAE,MAAM,EAAE,OAAO;IACnB,EAAE,EAAE,MAAM,EAAE,OAAO;IACnB,EAAE,EAAE,MAAM,EAAE,KAAK;IACjB,EAAE,EAAE,MAAM,EAAE,QAAQ;IACpB,EAAE,EAAE,MAAM,EAAE,OAAO;IACnB,EAAE,EAAE,MAAM,EAAE,SAAS;IACrB,EAAE,EAAE,MAAM,EAAE,SAAS;IACrB,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ;IAC5D,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ;IAC5D,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS;IAC7D,EAAE,EAAE,MAAM,EAAE,QAAQ;IACpB,EAAE,EAAE,MAAM,EAAE,OAAO;IACnB,EAAE,EAAE,MAAM,EAAE,MAAM;IAClB,EAAE,EAAE,MAAM,EAAE,aAAa;CAC1B,CAAC"}
|
package/out/vnc/des.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-TypeScript DES single-block encrypt.
|
|
3
|
+
* Works on any Node / OpenSSL version (Node 22+ dropped DES from OpenSSL 3.0).
|
|
4
|
+
* Only the subset VNC auth needs: 8-byte key, 8-byte block, ECB, no padding.
|
|
5
|
+
*/
|
|
6
|
+
export declare function desEncrypt(block: Buffer, key: Buffer): Buffer;
|