@zukhruf/ssh 0.0.0-stage → 0.8.29

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.
Files changed (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1123 -2
  3. package/dist/address.d.ts +8 -0
  4. package/dist/address.d.ts.map +1 -0
  5. package/dist/address.js +15 -0
  6. package/dist/address.js.map +1 -0
  7. package/dist/agent.d.ts +35 -0
  8. package/dist/agent.d.ts.map +1 -0
  9. package/dist/agent.js +288 -0
  10. package/dist/agent.js.map +1 -0
  11. package/dist/channel-stream.d.ts +16 -0
  12. package/dist/channel-stream.d.ts.map +1 -0
  13. package/dist/channel-stream.js +102 -0
  14. package/dist/channel-stream.js.map +1 -0
  15. package/dist/client.d.ts +114 -0
  16. package/dist/client.d.ts.map +1 -0
  17. package/dist/client.js +587 -0
  18. package/dist/client.js.map +1 -0
  19. package/dist/config.d.ts +82 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +255 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/control/control-client.d.ts +12 -0
  24. package/dist/control/control-client.d.ts.map +1 -0
  25. package/dist/control/control-client.js +156 -0
  26. package/dist/control/control-client.js.map +1 -0
  27. package/dist/control/control-master.d.ts +12 -0
  28. package/dist/control/control-master.d.ts.map +1 -0
  29. package/dist/control/control-master.js +101 -0
  30. package/dist/control/control-master.js.map +1 -0
  31. package/dist/control/control-stream.d.ts +29 -0
  32. package/dist/control/control-stream.d.ts.map +1 -0
  33. package/dist/control/control-stream.js +54 -0
  34. package/dist/control/control-stream.js.map +1 -0
  35. package/dist/control/messages.d.ts +38 -0
  36. package/dist/control/messages.d.ts.map +1 -0
  37. package/dist/control/messages.js +92 -0
  38. package/dist/control/messages.js.map +1 -0
  39. package/dist/control/serve-dial.d.ts +11 -0
  40. package/dist/control/serve-dial.d.ts.map +1 -0
  41. package/dist/control/serve-dial.js +47 -0
  42. package/dist/control/serve-dial.js.map +1 -0
  43. package/dist/control/serve-session.d.ts +11 -0
  44. package/dist/control/serve-session.d.ts.map +1 -0
  45. package/dist/control/serve-session.js +78 -0
  46. package/dist/control/serve-session.js.map +1 -0
  47. package/dist/control/wire.d.ts +41 -0
  48. package/dist/control/wire.d.ts.map +1 -0
  49. package/dist/control/wire.js +100 -0
  50. package/dist/control/wire.js.map +1 -0
  51. package/dist/control.d.ts +4 -0
  52. package/dist/control.d.ts.map +1 -0
  53. package/dist/control.js +4 -0
  54. package/dist/control.js.map +1 -0
  55. package/dist/dial-route.d.ts +14 -0
  56. package/dist/dial-route.d.ts.map +1 -0
  57. package/dist/dial-route.js +87 -0
  58. package/dist/dial-route.js.map +1 -0
  59. package/dist/host-key-algorithms.d.ts +7 -0
  60. package/dist/host-key-algorithms.d.ts.map +1 -0
  61. package/dist/host-key-algorithms.js +16 -0
  62. package/dist/host-key-algorithms.js.map +1 -0
  63. package/dist/host-key-policy.d.ts +22 -0
  64. package/dist/host-key-policy.d.ts.map +1 -0
  65. package/dist/host-key-policy.js +72 -0
  66. package/dist/host-key-policy.js.map +1 -0
  67. package/dist/identities.d.ts +18 -0
  68. package/dist/identities.d.ts.map +1 -0
  69. package/dist/identities.js +81 -0
  70. package/dist/identities.js.map +1 -0
  71. package/dist/index.d.ts +9 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +8 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/knownhosts.d.ts +33 -0
  76. package/dist/knownhosts.d.ts.map +1 -0
  77. package/dist/knownhosts.js +241 -0
  78. package/dist/knownhosts.js.map +1 -0
  79. package/dist/match-pattern.d.ts +3 -0
  80. package/dist/match-pattern.d.ts.map +1 -0
  81. package/dist/match-pattern.js +18 -0
  82. package/dist/match-pattern.js.map +1 -0
  83. package/dist/private-key.d.ts +42 -0
  84. package/dist/private-key.d.ts.map +1 -0
  85. package/dist/private-key.js +100 -0
  86. package/dist/private-key.js.map +1 -0
  87. package/dist/prompt.d.ts +6 -0
  88. package/dist/prompt.d.ts.map +1 -0
  89. package/dist/prompt.js +2 -0
  90. package/dist/prompt.js.map +1 -0
  91. package/dist/proxy-command.d.ts +33 -0
  92. package/dist/proxy-command.d.ts.map +1 -0
  93. package/dist/proxy-command.js +121 -0
  94. package/dist/proxy-command.js.map +1 -0
  95. package/dist/proxy-jump.d.ts +19 -0
  96. package/dist/proxy-jump.d.ts.map +1 -0
  97. package/dist/proxy-jump.js +63 -0
  98. package/dist/proxy-jump.js.map +1 -0
  99. package/dist/public-key.d.ts +22 -0
  100. package/dist/public-key.d.ts.map +1 -0
  101. package/dist/public-key.js +102 -0
  102. package/dist/public-key.js.map +1 -0
  103. package/dist/remote-listener.d.ts +14 -0
  104. package/dist/remote-listener.d.ts.map +1 -0
  105. package/dist/remote-listener.js +39 -0
  106. package/dist/remote-listener.js.map +1 -0
  107. package/dist/server-alive-check.d.ts +36 -0
  108. package/dist/server-alive-check.d.ts.map +1 -0
  109. package/dist/server-alive-check.js +103 -0
  110. package/dist/server-alive-check.js.map +1 -0
  111. package/dist/server.d.ts +114 -0
  112. package/dist/server.d.ts.map +1 -0
  113. package/dist/server.js +460 -0
  114. package/dist/server.js.map +1 -0
  115. package/dist/session.d.ts +97 -0
  116. package/dist/session.d.ts.map +1 -0
  117. package/dist/session.js +193 -0
  118. package/dist/session.js.map +1 -0
  119. package/dist/ssh-g.d.ts +19 -0
  120. package/dist/ssh-g.d.ts.map +1 -0
  121. package/dist/ssh-g.js +67 -0
  122. package/dist/ssh-g.js.map +1 -0
  123. package/dist/ssh2-agent-forwarding.d.ts +51 -0
  124. package/dist/ssh2-agent-forwarding.d.ts.map +1 -0
  125. package/dist/ssh2-agent-forwarding.js +56 -0
  126. package/dist/ssh2-agent-forwarding.js.map +1 -0
  127. package/dist/ssh2-channel-open-failure.d.ts +28 -0
  128. package/dist/ssh2-channel-open-failure.d.ts.map +1 -0
  129. package/dist/ssh2-channel-open-failure.js +35 -0
  130. package/dist/ssh2-channel-open-failure.js.map +1 -0
  131. package/dist/ssh2-keepalive-request.d.ts +31 -0
  132. package/dist/ssh2-keepalive-request.d.ts.map +1 -0
  133. package/dist/ssh2-keepalive-request.js +6 -0
  134. package/dist/ssh2-keepalive-request.js.map +1 -0
  135. package/dist/ssh2-server-channel.d.ts +63 -0
  136. package/dist/ssh2-server-channel.d.ts.map +1 -0
  137. package/dist/ssh2-server-channel.js +309 -0
  138. package/dist/ssh2-server-channel.js.map +1 -0
  139. package/package.json +75 -4
@@ -0,0 +1,309 @@
1
+ /**
2
+ * Every use of the internals of ssh2 1.17.0 by the server. ssh2 is pinned
3
+ * exactly; re-check each line below on a version bump.
4
+ *
5
+ * Why: ssh2 expects a session request to be answered inside its event. Its
6
+ * accept and reject do nothing after a client EOF (`session._ending`) or once
7
+ * `session._channel` exists (lib/server.js:847, :856, :919, :943), and data
8
+ * that comes before `session._channel` exists is dropped (lib/server.js:737-747,
9
+ * :1026-1027). ServerSession.requests() answers later, so this module opens
10
+ * the channel of an exec or shell at once, keeps its data, and sends the reply
11
+ * when the caller decides.
12
+ *
13
+ * - lib/server.js:188-212: Session, `_chanInfo.outgoing.{id,state}`, `_channel`.
14
+ * - lib/server.js:916-965: what accept of shell and exec does: a
15
+ * `new Channel(connection, session._chanInfo, { server: true })`, its
16
+ * `subtype`, and `session._channel`.
17
+ * - lib/server.js:236-255: the keepalive timer that a 'ready' listener starts.
18
+ * - lib/Channel.js:86, :289: the Channel class and its export.
19
+ * - lib/Channel.js:142-143, :268-273: the end of a server channel sends EOF
20
+ * and CLOSE at once (onFinish), so the peer cannot answer after it; this
21
+ * module makes it a half-close.
22
+ * - lib/Channel.js:248-266: exit() sends only while `outgoing.state` is
23
+ * 'open', so not after EOF; this module sends exit-status itself.
24
+ * - lib/protocol/Protocol.js:393-419: channelSuccess(id), channelFailure(id);
25
+ * :1675, :1699: exitStatus(id, status), exitSignal(id, name, coreDumped,
26
+ * message), which refuses a name outside RFC 4254 §6.10 (:1714).
27
+ * - `connection._protocol`: the Protocol object of a server connection
28
+ * (lib/server.js:263).
29
+ * - lib/protocol/Protocol.js:1699-1750: the packet of exitSignal, which this
30
+ * module writes itself to send a name such as SIG@openssh.com, through
31
+ * `_packetRW.write.{allocStart,alloc,finalize}` and utils.js:343
32
+ * `sendPacket`.
33
+ * - lib/protocol/handlers.js:3-16: the shared table of message handlers;
34
+ * handlers.misc.js:1001-1241: its CHANNEL_REQUEST handler drops a whole
35
+ * pty-req at a terminal mode that constants.js:252 does not name, such as
36
+ * IUTF8 (handlers.misc.js:1097-1116), then calls
37
+ * `protocol._handlers.CHANNEL_REQUEST(protocol, recipient, type, wantReply,
38
+ * data)`. This module parses a pty-req of a ServerConn itself, before that
39
+ * handler.
40
+ */
41
+ import { createRequire } from 'node:module';
42
+ function isChannelModule(value) {
43
+ return (typeof value === 'object' &&
44
+ value !== null &&
45
+ 'Channel' in value &&
46
+ typeof value.Channel === 'function');
47
+ }
48
+ const load = createRequire(import.meta.url);
49
+ const channelModule = load('ssh2/lib/Channel.js');
50
+ if (!isChannelModule(channelModule)) {
51
+ throw new Error('ssh: ssh2/lib/Channel.js exports no Channel class');
52
+ }
53
+ const { Channel } = channelModule;
54
+ const utilities = load('ssh2/lib/protocol/utils.js');
55
+ if (typeof utilities !== 'object' ||
56
+ utilities === null ||
57
+ !('sendPacket' in utilities) ||
58
+ typeof utilities.sendPacket !== 'function') {
59
+ throw new Error('ssh: ssh2/lib/protocol/utils.js exports no sendPacket');
60
+ }
61
+ const { sendPacket } = utilities;
62
+ const constants = load('ssh2/lib/protocol/constants.js');
63
+ if (typeof constants !== 'object' ||
64
+ constants === null ||
65
+ !('TERMINAL_MODE' in constants) ||
66
+ typeof constants.TERMINAL_MODE !== 'object' ||
67
+ constants.TERMINAL_MODE === null) {
68
+ throw new Error('ssh: ssh2/lib/protocol/constants.js has no TERMINAL_MODE');
69
+ }
70
+ const channelRequest = 98;
71
+ const ttyOpEnd = 0;
72
+ /** RFC 4254 §8: opcodes 160 to 255 are not defined, and end the parsing. */
73
+ const firstUndefinedOpcode = 160;
74
+ /** The names of the terminal modes by opcode: ssh2's table of RFC 4254 §8, and IUTF8 of RFC 8160. */
75
+ const modeNames = new Map([
76
+ ...Object.entries(constants.TERMINAL_MODE).flatMap(([name, opcode]) => typeof opcode === 'number' && opcode !== ttyOpEnd ? [[opcode, name]] : []),
77
+ [42, 'IUTF8'],
78
+ ]);
79
+ const messageHandlers = load('ssh2/lib/protocol/handlers.js');
80
+ if (!isHandlerTable(messageHandlers)) {
81
+ throw new Error('ssh: ssh2/lib/protocol/handlers.js is not a handler table');
82
+ }
83
+ const ssh2ChannelRequest = messageHandlers[channelRequest];
84
+ if (ssh2ChannelRequest === undefined) {
85
+ throw new Error('ssh: ssh2 has no CHANNEL_REQUEST handler');
86
+ }
87
+ const ownProtocols = new WeakSet();
88
+ messageHandlers[channelRequest] = (protocol, payload) => {
89
+ if (ownProtocols.has(protocol)) {
90
+ const pty = parsePtyRequest(payload);
91
+ if (pty !== undefined) {
92
+ protocol._handlers.CHANNEL_REQUEST?.(protocol, pty.recipient, 'pty-req', pty.wantReply, pty.info);
93
+ return undefined;
94
+ }
95
+ }
96
+ return ssh2ChannelRequest(protocol, payload);
97
+ };
98
+ function isHandlerTable(value) {
99
+ return Array.isArray(value) && typeof value[channelRequest] === 'function';
100
+ }
101
+ /** Reads the fields of RFC 4251 §5 from a payload; undefined once a field runs past its end. */
102
+ class PayloadReader {
103
+ #payload;
104
+ #offset;
105
+ constructor(payload, offset) {
106
+ this.#payload = payload;
107
+ this.#offset = offset;
108
+ }
109
+ get done() {
110
+ return this.#offset >= this.#payload.length;
111
+ }
112
+ byte() {
113
+ const value = this.#payload[this.#offset];
114
+ this.#offset += 1;
115
+ return value;
116
+ }
117
+ uint32() {
118
+ const start = this.#offset;
119
+ if (start + 4 > this.#payload.length)
120
+ return undefined;
121
+ this.#offset += 4;
122
+ return this.#payload.readUInt32BE(start);
123
+ }
124
+ bytes() {
125
+ const length = this.uint32();
126
+ const start = this.#offset;
127
+ if (length === undefined || start + length > this.#payload.length) {
128
+ return undefined;
129
+ }
130
+ this.#offset += length;
131
+ return this.#payload.subarray(start, start + length);
132
+ }
133
+ }
134
+ /** A pty-req (RFC 4254 §6.2), with the modes that have a name; undefined for another request, or a malformed one, which ssh2 then handles. */
135
+ function parsePtyRequest(payload) {
136
+ const reader = new PayloadReader(payload, 1);
137
+ const recipient = reader.uint32();
138
+ if (reader.bytes()?.toString('latin1') !== 'pty-req')
139
+ return undefined;
140
+ const wantReply = reader.byte();
141
+ const term = reader.bytes()?.toString('utf8');
142
+ const cols = reader.uint32();
143
+ const rows = reader.uint32();
144
+ const width = reader.uint32();
145
+ const height = reader.uint32();
146
+ const encodedModes = reader.bytes();
147
+ if (recipient === undefined ||
148
+ wantReply === undefined ||
149
+ term === undefined ||
150
+ cols === undefined ||
151
+ rows === undefined ||
152
+ width === undefined ||
153
+ height === undefined ||
154
+ encodedModes === undefined) {
155
+ return undefined;
156
+ }
157
+ return {
158
+ recipient,
159
+ wantReply: wantReply !== 0,
160
+ info: { term, cols, rows, width, height, modes: parseModes(encodedModes) },
161
+ };
162
+ }
163
+ /** RFC 4254 §8: an opcode and a uint32 value each, up to TTY_OP_END or an opcode of 160 or more. A mode with no name is skipped. */
164
+ function parseModes(encoded) {
165
+ const reader = new PayloadReader(encoded, 0);
166
+ const modes = [];
167
+ while (!reader.done) {
168
+ const opcode = reader.byte();
169
+ if (opcode === undefined ||
170
+ opcode === ttyOpEnd ||
171
+ opcode >= firstUndefinedOpcode) {
172
+ break;
173
+ }
174
+ const value = reader.uint32();
175
+ if (value === undefined)
176
+ break;
177
+ const name = modeNames.get(opcode);
178
+ if (name !== undefined)
179
+ modes.push([name, value]);
180
+ }
181
+ return Object.fromEntries(modes);
182
+ }
183
+ /** Makes ssh2 give each pty-req of this connection with its modes, also one with a mode that ssh2 does not name. */
184
+ export function parseTerminalModes(connection) {
185
+ ownProtocols.add(connection._protocol);
186
+ }
187
+ /**
188
+ * Sends the replies of the requests of one session channel in the order of the
189
+ * requests (RFC 4254 §5.4), whatever order the caller answers them in.
190
+ */
191
+ export class SessionReplies {
192
+ #connection;
193
+ #session;
194
+ #pending = [];
195
+ constructor(connection, session) {
196
+ this.#connection = connection;
197
+ this.#session = session;
198
+ }
199
+ /** A slot for one request; its first call sends the reply. A request with no reply wanted gets a slot that sends nothing. */
200
+ reserve(wantReply) {
201
+ if (!wantReply)
202
+ return () => { };
203
+ const slot = {};
204
+ this.#pending.push(slot);
205
+ return (success) => {
206
+ if (slot.success !== undefined)
207
+ return;
208
+ slot.success = success;
209
+ this.#flush();
210
+ };
211
+ }
212
+ #flush() {
213
+ const protocol = this.#connection._protocol;
214
+ const { id, state } = this.#session._chanInfo.outgoing;
215
+ while (this.#pending[0]?.success !== undefined) {
216
+ const slot = this.#pending.shift();
217
+ if (state === 'closing' || state === 'closed')
218
+ continue;
219
+ if (slot?.success)
220
+ protocol.channelSuccess(id);
221
+ else
222
+ protocol.channelFailure(id);
223
+ }
224
+ }
225
+ }
226
+ /** The channel of an exec or shell request, opened before the reply so that no data is lost. undefined when the session already has one. */
227
+ export function openCommandChannel(connection, session) {
228
+ if (session._channel !== undefined)
229
+ return undefined;
230
+ const channel = new Channel(connection, session._chanInfo, {
231
+ server: true,
232
+ });
233
+ session._channel = channel;
234
+ return channel;
235
+ }
236
+ /** After a refused exec or shell, the session can take another. */
237
+ export function dropCommandChannel(session) {
238
+ session._channel = undefined;
239
+ }
240
+ /** exit-status or exit-signal, also after EOF (RFC 4254 §6.10 allows it), then SSH_MSG_CHANNEL_CLOSE. */
241
+ export function exitCommandChannel(connection, session, channel, status) {
242
+ const { id, state } = session._chanInfo.outgoing;
243
+ if (state === 'open' || state === 'eof') {
244
+ if (typeof status === 'number') {
245
+ connection._protocol.exitStatus(id, status);
246
+ }
247
+ else {
248
+ sendExitSignal(connection._protocol, id, status);
249
+ }
250
+ }
251
+ channel.close();
252
+ }
253
+ /**
254
+ * RFC 4254 §6.10 exit-signal, as ssh2's Protocol.exitSignal writes it, with
255
+ * any name: ssh2 refuses a name outside the list of RFC 4254, such as
256
+ * SIG@openssh.com, which OpenSSH's sshd sends.
257
+ */
258
+ function sendExitSignal(protocol, id, status) {
259
+ const fields = [
260
+ uint32(id),
261
+ sshString(Buffer.from('exit-signal', 'latin1')),
262
+ Buffer.of(0),
263
+ sshString(Buffer.from(status.signal, 'latin1')),
264
+ Buffer.of(status.coreDumped ? 1 : 0),
265
+ sshString(Buffer.from(status.errorMessage, 'utf8')),
266
+ sshString(Buffer.alloc(0)),
267
+ ];
268
+ const body = Buffer.concat([Buffer.of(channelRequest), ...fields]);
269
+ const writer = protocol._packetRW.write;
270
+ const packet = writer.alloc(body.length);
271
+ body.copy(packet, writer.allocStart);
272
+ Reflect.apply(sendPacket, undefined, [protocol, writer.finalize(packet)]);
273
+ }
274
+ function uint32(value) {
275
+ const bytes = Buffer.alloc(4);
276
+ bytes.writeUInt32BE(value);
277
+ return bytes;
278
+ }
279
+ function sshString(value) {
280
+ return Buffer.concat([uint32(value.length), value]);
281
+ }
282
+ /**
283
+ * The end of the channel sends only EOF, as a half-close (RFC 4254 §5.3);
284
+ * CLOSE follows once the peer sent EOF too. ssh2 sends both at the end.
285
+ */
286
+ export function halfClosing(channel) {
287
+ channel.removeAllListeners('finish');
288
+ channel.removeAllListeners('prefinish');
289
+ const ended = { reading: false, writing: false };
290
+ const closeWhenBothEnded = () => {
291
+ if (ended.reading && ended.writing)
292
+ channel.close();
293
+ };
294
+ channel.once('finish', () => {
295
+ channel.eof();
296
+ ended.writing = true;
297
+ closeWhenBothEnded();
298
+ });
299
+ channel.once('end', () => {
300
+ ended.reading = true;
301
+ closeWhenBothEnded();
302
+ });
303
+ return channel;
304
+ }
305
+ /** ssh2 starts a keepalive timer at 'ready'; the server has no timer (ADR 0011). */
306
+ export function removeKeepalive(connection) {
307
+ connection.removeAllListeners('ready');
308
+ }
309
+ //# sourceMappingURL=ssh2-server-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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AI,KAAK,CAAC,OAAO;YAAE,OAAO,CAAC,KAAK,EAAE,CAAC;IACtD,CAAC,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;QAC1B,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACrB,kBAAkB,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;QACvB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACrB,kBAAkB,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,UAAsB;IACpD,UAAU,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,77 @@
1
1
  {
2
2
  "name": "@zukhruf/ssh",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.8.29",
4
+ "description": "An SSH client and server that run inside the Node process: a client connects to an SSH server, runs commands in sessions, and dials sockets and ports on the remote host. After Go's `golang.org/x/crypto/ssh`, on ssh2.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/JanuaryLabs/zukhruf",
9
+ "directory": "packages/ssh"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/JanuaryLabs/zukhruf/issues"
13
+ },
14
+ "homepage": "https://github.com/JanuaryLabs/zukhruf/tree/main/packages/ssh#readme",
15
+ "keywords": [
16
+ "ssh",
17
+ "ssh-client",
18
+ "ssh-server",
19
+ "openssh",
20
+ "ssh2",
21
+ "known-hosts",
22
+ "ssh-agent",
23
+ "port-forwarding"
24
+ ],
25
+ "type": "module",
26
+ "exports": {
27
+ "./package.json": "./package.json",
28
+ ".": {
29
+ "@zukhruf/source": "./src/index.ts",
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js",
32
+ "default": "./dist/index.js"
33
+ },
34
+ "./agent": {
35
+ "@zukhruf/source": "./src/agent.ts",
36
+ "types": "./dist/agent.d.ts",
37
+ "import": "./dist/agent.js",
38
+ "default": "./dist/agent.js"
39
+ },
40
+ "./knownhosts": {
41
+ "@zukhruf/source": "./src/knownhosts.ts",
42
+ "types": "./dist/knownhosts.d.ts",
43
+ "import": "./dist/knownhosts.js",
44
+ "default": "./dist/knownhosts.js"
45
+ },
46
+ "./config": {
47
+ "@zukhruf/source": "./src/config.ts",
48
+ "types": "./dist/config.d.ts",
49
+ "import": "./dist/config.js",
50
+ "default": "./dist/config.js"
51
+ },
52
+ "./control": {
53
+ "@zukhruf/source": "./src/control.ts",
54
+ "types": "./dist/control.d.ts",
55
+ "import": "./dist/control.js",
56
+ "default": "./dist/control.js"
57
+ }
58
+ },
59
+ "files": [
60
+ "dist",
61
+ "!dist/spec/**",
62
+ "!**/*.tsbuildinfo",
63
+ "!**/*.test.*"
64
+ ],
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "dependencies": {
69
+ "@zukhruf/async": "^0.8.29",
70
+ "ssh2": "1.17.0"
71
+ },
72
+ "devDependencies": {
73
+ "@sinonjs/fake-timers": "15.4.0",
74
+ "@types/ssh2": "^1.15.6",
75
+ "@zukhruf/fs": "^0.8.29"
76
+ }
77
+ }