@bitwarden/cli 2026.5.0 → 2026.6.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 ADDED
@@ -0,0 +1,68 @@
1
+ [![Github Workflow build on main](https://github.com/bitwarden/clients/actions/workflows/build-cli.yml/badge.svg?branch=main)](https://github.com/bitwarden/clients/actions/workflows/build-cli.yml?query=branch:main)
2
+
3
+ # Bitwarden Command-line Interface
4
+
5
+ [![Platforms](https://imgur.com/AnTLX0S.png "Platforms")](https://help.bitwarden.com/article/cli/#download--install)
6
+
7
+ The Bitwarden CLI is a powerful, full-featured command-line interface (CLI) tool to access and manage a Bitwarden vault. The CLI is written with TypeScript and Node.js and can be run on Windows, macOS, and Linux distributions.
8
+
9
+ ## Developer Documentation
10
+
11
+ Please refer to the [CLI section](https://contributing.bitwarden.com/getting-started/clients/cli/) of the [Contributing Documentation](https://contributing.bitwarden.com/) for build instructions, recommended tooling, code style tips, and lots of other great information to get you started.
12
+
13
+ ## User Documentation
14
+
15
+ ### Download/Install
16
+
17
+ You can install the Bitwarden CLI multiple different ways:
18
+
19
+ **NPM**
20
+
21
+ If you already have the Node.js runtime installed on your system, you can install the CLI using NPM. NPM makes it easy to keep your installation updated and should be the preferred installation method if you are already using Node.js.
22
+
23
+ ```bash
24
+ npm install -g @bitwarden/cli
25
+ ```
26
+
27
+ **Native Executable**
28
+
29
+ We provide natively packaged versions of the CLI for each platform which have no requirements on installing the Node.js runtime. You can obtain these from the [downloads section](https://help.bitwarden.com/article/cli/#download--install) in the documentation.
30
+
31
+ **Other Package Managers**
32
+
33
+ - [Chocolatey](https://chocolatey.org/packages/bitwarden-cli)
34
+ ```powershell
35
+ choco install bitwarden-cli
36
+ ```
37
+ - [Homebrew](https://formulae.brew.sh/formula/bitwarden-cli)
38
+ ```bash
39
+ brew install bitwarden-cli
40
+ ```
41
+ > ⚠️ The homebrew version is not recommended for all users.
42
+ >
43
+ > Homebrew pulls the CLI's GPL build and does not include device approval commands for Enterprise SSO customers.
44
+ - [Snap](https://snapcraft.io/bw)
45
+ ```bash
46
+ sudo snap install bw
47
+ ```
48
+
49
+ ### Help Command
50
+
51
+ The Bitwarden CLI is self-documented with `--help` content and examples for every command. You should start exploring the CLI by using the global `--help` option:
52
+
53
+ ```bash
54
+ bw --help
55
+ ```
56
+
57
+ This option will list all available commands that you can use with the CLI.
58
+
59
+ Additionally, you can run the `--help` option on a specific command to learn more about it:
60
+
61
+ ```bash
62
+ bw list --help
63
+ bw create --help
64
+ ```
65
+
66
+ ### Help Center
67
+
68
+ We provide detailed documentation and examples for using the CLI in our help center at https://help.bitwarden.com/article/cli/.
package/build/344.js ADDED
@@ -0,0 +1,537 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ exports.id = 344;
4
+ exports.ids = [344];
5
+ exports.modules = {
6
+
7
+ /***/ 53
8
+ (__unused_webpack_module, exports, __webpack_require__) {
9
+
10
+
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35
+ exports.req = exports.json = exports.toBuffer = void 0;
36
+ const http = __importStar(__webpack_require__(611));
37
+ const https = __importStar(__webpack_require__(692));
38
+ async function toBuffer(stream) {
39
+ let length = 0;
40
+ const chunks = [];
41
+ for await (const chunk of stream) {
42
+ length += chunk.length;
43
+ chunks.push(chunk);
44
+ }
45
+ return Buffer.concat(chunks, length);
46
+ }
47
+ exports.toBuffer = toBuffer;
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ async function json(stream) {
50
+ const buf = await toBuffer(stream);
51
+ const str = buf.toString('utf8');
52
+ try {
53
+ return JSON.parse(str);
54
+ }
55
+ catch (_err) {
56
+ const err = _err;
57
+ err.message += ` (input: ${str})`;
58
+ throw err;
59
+ }
60
+ }
61
+ exports.json = json;
62
+ function req(url, opts = {}) {
63
+ const href = typeof url === 'string' ? url : url.href;
64
+ const req = (href.startsWith('https:') ? https : http).request(url, opts);
65
+ const promise = new Promise((resolve, reject) => {
66
+ req
67
+ .once('response', resolve)
68
+ .once('error', reject)
69
+ .end();
70
+ });
71
+ req.then = promise.then.bind(promise);
72
+ return req;
73
+ }
74
+ exports.req = req;
75
+ //# sourceMappingURL=helpers.js.map
76
+
77
+ /***/ },
78
+
79
+ /***/ 112
80
+ (__unused_webpack_module, exports, __webpack_require__) {
81
+
82
+
83
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
84
+ if (k2 === undefined) k2 = k;
85
+ var desc = Object.getOwnPropertyDescriptor(m, k);
86
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
87
+ desc = { enumerable: true, get: function() { return m[k]; } };
88
+ }
89
+ Object.defineProperty(o, k2, desc);
90
+ }) : (function(o, m, k, k2) {
91
+ if (k2 === undefined) k2 = k;
92
+ o[k2] = m[k];
93
+ }));
94
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
95
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
96
+ }) : function(o, v) {
97
+ o["default"] = v;
98
+ });
99
+ var __importStar = (this && this.__importStar) || function (mod) {
100
+ if (mod && mod.__esModule) return mod;
101
+ var result = {};
102
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
103
+ __setModuleDefault(result, mod);
104
+ return result;
105
+ };
106
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
107
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
108
+ };
109
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
110
+ exports.Agent = void 0;
111
+ const net = __importStar(__webpack_require__(278));
112
+ const http = __importStar(__webpack_require__(611));
113
+ const https_1 = __webpack_require__(692);
114
+ __exportStar(__webpack_require__(53), exports);
115
+ const INTERNAL = Symbol('AgentBaseInternalState');
116
+ class Agent extends http.Agent {
117
+ constructor(opts) {
118
+ super(opts);
119
+ this[INTERNAL] = {};
120
+ }
121
+ /**
122
+ * Determine whether this is an `http` or `https` request.
123
+ */
124
+ isSecureEndpoint(options) {
125
+ if (options) {
126
+ // First check the `secureEndpoint` property explicitly, since this
127
+ // means that a parent `Agent` is "passing through" to this instance.
128
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
129
+ if (typeof options.secureEndpoint === 'boolean') {
130
+ return options.secureEndpoint;
131
+ }
132
+ // If no explicit `secure` endpoint, check if `protocol` property is
133
+ // set. This will usually be the case since using a full string URL
134
+ // or `URL` instance should be the most common usage.
135
+ if (typeof options.protocol === 'string') {
136
+ return options.protocol === 'https:';
137
+ }
138
+ }
139
+ // Finally, if no `protocol` property was set, then fall back to
140
+ // checking the stack trace of the current call stack, and try to
141
+ // detect the "https" module.
142
+ const { stack } = new Error();
143
+ if (typeof stack !== 'string')
144
+ return false;
145
+ return stack
146
+ .split('\n')
147
+ .some((l) => l.indexOf('(https.js:') !== -1 ||
148
+ l.indexOf('node:https:') !== -1);
149
+ }
150
+ // In order to support async signatures in `connect()` and Node's native
151
+ // connection pooling in `http.Agent`, the array of sockets for each origin
152
+ // has to be updated synchronously. This is so the length of the array is
153
+ // accurate when `addRequest()` is next called. We achieve this by creating a
154
+ // fake socket and adding it to `sockets[origin]` and incrementing
155
+ // `totalSocketCount`.
156
+ incrementSockets(name) {
157
+ // If `maxSockets` and `maxTotalSockets` are both Infinity then there is no
158
+ // need to create a fake socket because Node.js native connection pooling
159
+ // will never be invoked.
160
+ if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
161
+ return null;
162
+ }
163
+ // All instances of `sockets` are expected TypeScript errors. The
164
+ // alternative is to add it as a private property of this class but that
165
+ // will break TypeScript subclassing.
166
+ if (!this.sockets[name]) {
167
+ // @ts-expect-error `sockets` is readonly in `@types/node`
168
+ this.sockets[name] = [];
169
+ }
170
+ const fakeSocket = new net.Socket({ writable: false });
171
+ this.sockets[name].push(fakeSocket);
172
+ // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
173
+ this.totalSocketCount++;
174
+ return fakeSocket;
175
+ }
176
+ decrementSockets(name, socket) {
177
+ if (!this.sockets[name] || socket === null) {
178
+ return;
179
+ }
180
+ const sockets = this.sockets[name];
181
+ const index = sockets.indexOf(socket);
182
+ if (index !== -1) {
183
+ sockets.splice(index, 1);
184
+ // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
185
+ this.totalSocketCount--;
186
+ if (sockets.length === 0) {
187
+ // @ts-expect-error `sockets` is readonly in `@types/node`
188
+ delete this.sockets[name];
189
+ }
190
+ }
191
+ }
192
+ // In order to properly update the socket pool, we need to call `getName()` on
193
+ // the core `https.Agent` if it is a secureEndpoint.
194
+ getName(options) {
195
+ const secureEndpoint = this.isSecureEndpoint(options);
196
+ if (secureEndpoint) {
197
+ // @ts-expect-error `getName()` isn't defined in `@types/node`
198
+ return https_1.Agent.prototype.getName.call(this, options);
199
+ }
200
+ // @ts-expect-error `getName()` isn't defined in `@types/node`
201
+ return super.getName(options);
202
+ }
203
+ createSocket(req, options, cb) {
204
+ const connectOpts = {
205
+ ...options,
206
+ secureEndpoint: this.isSecureEndpoint(options),
207
+ };
208
+ const name = this.getName(connectOpts);
209
+ const fakeSocket = this.incrementSockets(name);
210
+ Promise.resolve()
211
+ .then(() => this.connect(req, connectOpts))
212
+ .then((socket) => {
213
+ this.decrementSockets(name, fakeSocket);
214
+ if (socket instanceof http.Agent) {
215
+ try {
216
+ // @ts-expect-error `addRequest()` isn't defined in `@types/node`
217
+ return socket.addRequest(req, connectOpts);
218
+ }
219
+ catch (err) {
220
+ return cb(err);
221
+ }
222
+ }
223
+ this[INTERNAL].currentSocket = socket;
224
+ // @ts-expect-error `createSocket()` isn't defined in `@types/node`
225
+ super.createSocket(req, options, cb);
226
+ }, (err) => {
227
+ this.decrementSockets(name, fakeSocket);
228
+ cb(err);
229
+ });
230
+ }
231
+ createConnection() {
232
+ const socket = this[INTERNAL].currentSocket;
233
+ this[INTERNAL].currentSocket = undefined;
234
+ if (!socket) {
235
+ throw new Error('No socket was returned in the `connect()` function');
236
+ }
237
+ return socket;
238
+ }
239
+ get defaultPort() {
240
+ return (this[INTERNAL].defaultPort ??
241
+ (this.protocol === 'https:' ? 443 : 80));
242
+ }
243
+ set defaultPort(v) {
244
+ if (this[INTERNAL]) {
245
+ this[INTERNAL].defaultPort = v;
246
+ }
247
+ }
248
+ get protocol() {
249
+ return (this[INTERNAL].protocol ??
250
+ (this.isSecureEndpoint() ? 'https:' : 'http:'));
251
+ }
252
+ set protocol(v) {
253
+ if (this[INTERNAL]) {
254
+ this[INTERNAL].protocol = v;
255
+ }
256
+ }
257
+ }
258
+ exports.Agent = Agent;
259
+ //# sourceMappingURL=index.js.map
260
+
261
+ /***/ },
262
+
263
+ /***/ 344
264
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
265
+
266
+ // ESM COMPAT FLAG
267
+ __webpack_require__.r(__webpack_exports__);
268
+
269
+ // EXPORTS
270
+ __webpack_require__.d(__webpack_exports__, {
271
+ HttpsProxyAgent: () => (/* binding */ HttpsProxyAgent)
272
+ });
273
+
274
+ // EXTERNAL MODULE: external "net"
275
+ var external_net_ = __webpack_require__(278);
276
+ // EXTERNAL MODULE: external "tls"
277
+ var external_tls_ = __webpack_require__(756);
278
+ // EXTERNAL MODULE: external "assert"
279
+ var external_assert_ = __webpack_require__(613);
280
+ // EXTERNAL MODULE: external "debug"
281
+ var external_debug_ = __webpack_require__(263);
282
+ // EXTERNAL MODULE: ../../node_modules/agent-base/dist/index.js
283
+ var dist = __webpack_require__(112);
284
+ // EXTERNAL MODULE: external "url"
285
+ var external_url_ = __webpack_require__(857);
286
+ ;// ../../node_modules/https-proxy-agent/dist/parse-proxy-response.js
287
+
288
+ const debug = external_debug_('https-proxy-agent:parse-proxy-response');
289
+ function parseProxyResponse(socket) {
290
+ return new Promise((resolve, reject) => {
291
+ // we need to buffer any HTTP traffic that happens with the proxy before we get
292
+ // the CONNECT response, so that if the response is anything other than an "200"
293
+ // response code, then we can re-play the "data" events on the socket once the
294
+ // HTTP parser is hooked up...
295
+ let buffersLength = 0;
296
+ const buffers = [];
297
+ function read() {
298
+ const b = socket.read();
299
+ if (b)
300
+ ondata(b);
301
+ else
302
+ socket.once('readable', read);
303
+ }
304
+ function cleanup() {
305
+ socket.removeListener('end', onend);
306
+ socket.removeListener('error', onerror);
307
+ socket.removeListener('readable', read);
308
+ }
309
+ function onend() {
310
+ cleanup();
311
+ debug('onend');
312
+ reject(new Error('Proxy connection ended before receiving CONNECT response'));
313
+ }
314
+ function onerror(err) {
315
+ cleanup();
316
+ debug('onerror %o', err);
317
+ reject(err);
318
+ }
319
+ function ondata(b) {
320
+ buffers.push(b);
321
+ buffersLength += b.length;
322
+ const buffered = Buffer.concat(buffers, buffersLength);
323
+ const endOfHeaders = buffered.indexOf('\r\n\r\n');
324
+ if (endOfHeaders === -1) {
325
+ // keep buffering
326
+ debug('have not received end of HTTP headers yet...');
327
+ read();
328
+ return;
329
+ }
330
+ const headerParts = buffered
331
+ .slice(0, endOfHeaders)
332
+ .toString('ascii')
333
+ .split('\r\n');
334
+ const firstLine = headerParts.shift();
335
+ if (!firstLine) {
336
+ socket.destroy();
337
+ return reject(new Error('No header received from proxy CONNECT response'));
338
+ }
339
+ const firstLineParts = firstLine.split(' ');
340
+ const statusCode = +firstLineParts[1];
341
+ const statusText = firstLineParts.slice(2).join(' ');
342
+ const headers = {};
343
+ for (const header of headerParts) {
344
+ if (!header)
345
+ continue;
346
+ const firstColon = header.indexOf(':');
347
+ if (firstColon === -1) {
348
+ socket.destroy();
349
+ return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
350
+ }
351
+ const key = header.slice(0, firstColon).toLowerCase();
352
+ const value = header.slice(firstColon + 1).trimStart();
353
+ const current = headers[key];
354
+ if (typeof current === 'string') {
355
+ headers[key] = [current, value];
356
+ }
357
+ else if (Array.isArray(current)) {
358
+ current.push(value);
359
+ }
360
+ else {
361
+ headers[key] = value;
362
+ }
363
+ }
364
+ debug('got proxy server response: %o %o', firstLine, headers);
365
+ cleanup();
366
+ resolve({
367
+ connect: {
368
+ statusCode,
369
+ statusText,
370
+ headers,
371
+ },
372
+ buffered,
373
+ });
374
+ }
375
+ socket.on('error', onerror);
376
+ socket.on('end', onend);
377
+ read();
378
+ });
379
+ }
380
+ //# sourceMappingURL=parse-proxy-response.js.map
381
+ ;// ../../node_modules/https-proxy-agent/dist/index.js
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+ const dist_debug = external_debug_('https-proxy-agent');
390
+ const setServernameFromNonIpHost = (options) => {
391
+ if (options.servername === undefined &&
392
+ options.host &&
393
+ !external_net_.isIP(options.host)) {
394
+ return {
395
+ ...options,
396
+ servername: options.host,
397
+ };
398
+ }
399
+ return options;
400
+ };
401
+ /**
402
+ * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
403
+ * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
404
+ *
405
+ * Outgoing HTTP requests are first tunneled through the proxy server using the
406
+ * `CONNECT` HTTP request method to establish a connection to the proxy server,
407
+ * and then the proxy server connects to the destination target and issues the
408
+ * HTTP request from the proxy server.
409
+ *
410
+ * `https:` requests have their socket connection upgraded to TLS once
411
+ * the connection to the proxy server has been established.
412
+ */
413
+ class HttpsProxyAgent extends dist.Agent {
414
+ constructor(proxy, opts) {
415
+ super(opts);
416
+ this.options = { path: undefined };
417
+ this.proxy = typeof proxy === 'string' ? new external_url_.URL(proxy) : proxy;
418
+ this.proxyHeaders = opts?.headers ?? {};
419
+ dist_debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
420
+ // Trim off the brackets from IPv6 addresses
421
+ const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
422
+ const port = this.proxy.port
423
+ ? parseInt(this.proxy.port, 10)
424
+ : this.proxy.protocol === 'https:'
425
+ ? 443
426
+ : 80;
427
+ this.connectOpts = {
428
+ // Attempt to negotiate http/1.1 for proxy servers that support http/2
429
+ ALPNProtocols: ['http/1.1'],
430
+ ...(opts ? omit(opts, 'headers') : null),
431
+ host,
432
+ port,
433
+ };
434
+ }
435
+ /**
436
+ * Called when the node-core HTTP client library is creating a
437
+ * new HTTP request.
438
+ */
439
+ async connect(req, opts) {
440
+ const { proxy } = this;
441
+ if (!opts.host) {
442
+ throw new TypeError('No "host" provided');
443
+ }
444
+ // Create a socket connection to the proxy server.
445
+ let socket;
446
+ if (proxy.protocol === 'https:') {
447
+ dist_debug('Creating `tls.Socket`: %o', this.connectOpts);
448
+ socket = external_tls_.connect(setServernameFromNonIpHost(this.connectOpts));
449
+ }
450
+ else {
451
+ dist_debug('Creating `net.Socket`: %o', this.connectOpts);
452
+ socket = external_net_.connect(this.connectOpts);
453
+ }
454
+ const headers = typeof this.proxyHeaders === 'function'
455
+ ? this.proxyHeaders()
456
+ : { ...this.proxyHeaders };
457
+ const host = external_net_.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
458
+ let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
459
+ // Inject the `Proxy-Authorization` header if necessary.
460
+ if (proxy.username || proxy.password) {
461
+ const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
462
+ headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;
463
+ }
464
+ headers.Host = `${host}:${opts.port}`;
465
+ if (!headers['Proxy-Connection']) {
466
+ headers['Proxy-Connection'] = this.keepAlive
467
+ ? 'Keep-Alive'
468
+ : 'close';
469
+ }
470
+ for (const name of Object.keys(headers)) {
471
+ payload += `${name}: ${headers[name]}\r\n`;
472
+ }
473
+ const proxyResponsePromise = parseProxyResponse(socket);
474
+ socket.write(`${payload}\r\n`);
475
+ const { connect, buffered } = await proxyResponsePromise;
476
+ req.emit('proxyConnect', connect);
477
+ this.emit('proxyConnect', connect, req);
478
+ if (connect.statusCode === 200) {
479
+ req.once('socket', resume);
480
+ if (opts.secureEndpoint) {
481
+ // The proxy is connecting to a TLS server, so upgrade
482
+ // this socket connection to a TLS connection.
483
+ dist_debug('Upgrading socket connection to TLS');
484
+ return external_tls_.connect({
485
+ ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'),
486
+ socket,
487
+ });
488
+ }
489
+ return socket;
490
+ }
491
+ // Some other status code that's not 200... need to re-play the HTTP
492
+ // header "data" events onto the socket once the HTTP machinery is
493
+ // attached so that the node core `http` can parse and handle the
494
+ // error status code.
495
+ // Close the original socket, and a new "fake" socket is returned
496
+ // instead, so that the proxy doesn't get the HTTP request
497
+ // written to it (which may contain `Authorization` headers or other
498
+ // sensitive data).
499
+ //
500
+ // See: https://hackerone.com/reports/541502
501
+ socket.destroy();
502
+ const fakeSocket = new external_net_.Socket({ writable: false });
503
+ fakeSocket.readable = true;
504
+ // Need to wait for the "socket" event to re-play the "data" events.
505
+ req.once('socket', (s) => {
506
+ dist_debug('Replaying proxy buffer for failed request');
507
+ external_assert_(s.listenerCount('data') > 0);
508
+ // Replay the "buffered" Buffer onto the fake `socket`, since at
509
+ // this point the HTTP module machinery has been hooked up for
510
+ // the user.
511
+ s.push(buffered);
512
+ s.push(null);
513
+ });
514
+ return fakeSocket;
515
+ }
516
+ }
517
+ HttpsProxyAgent.protocols = ['http', 'https'];
518
+ function resume(socket) {
519
+ socket.resume();
520
+ }
521
+ function omit(obj, ...keys) {
522
+ const ret = {};
523
+ let key;
524
+ for (key in obj) {
525
+ if (!keys.includes(key)) {
526
+ ret[key] = obj[key];
527
+ }
528
+ }
529
+ return ret;
530
+ }
531
+ //# sourceMappingURL=index.js.map
532
+
533
+ /***/ }
534
+
535
+ };
536
+ ;
537
+ //# sourceMappingURL=344.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"344.js","mappings":";;;;;;;;;AAAa;AACb;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA,0CAA0C,4BAA4B;AACtE,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,WAAW,GAAG,YAAY,GAAG,gBAAgB;AAC7C,0BAA0B,mBAAO,CAAC,GAAM;AACxC,2BAA2B,mBAAO,CAAC,GAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,IAAI;AACvC;AACA;AACA;AACA,YAAY;AACZ,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,WAAW;AACX,mC;;;;;;;ACjEa;AACb;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA,0CAA0C,4BAA4B;AACtE,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,aAAa;AACb,yBAAyB,mBAAO,CAAC,GAAK;AACtC,0BAA0B,mBAAO,CAAC,GAAM;AACxC,gBAAgB,mBAAO,CAAC,GAAO;AAC/B,aAAa,mBAAO,CAAC,EAAW;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,iBAAiB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,iC;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjLgC;AAChC,cAAc,eAAW;AAClB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA4F,OAAO;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gD;;AC7F2B;AACA;AACC;AACI;AACG;AACT;AACqC;AAC/D,MAAM,UAAK,GAAG,eAAW;AACzB;AACA;AACA;AACA,SAAS,kBAAQ;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,8BAA8B,UAAK;AAC1C;AACA;AACA,yBAAyB;AACzB,qDAAqD,iBAAG;AACxD;AACA,QAAQ,UAAK;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,UAAK;AACjB,qBAAqB,qBAAW;AAChC;AACA;AACA,YAAY,UAAK;AACjB,qBAAqB,qBAAW;AAChC;AACA;AACA;AACA,gBAAgB;AAChB,qBAAqB,oBAAU,kBAAkB,UAAU;AAC3D,iCAAiC,KAAK,GAAG,WAAW;AACpD;AACA;AACA,4BAA4B,mCAAmC,GAAG,mCAAmC;AACrG,sDAAsD,qCAAqC;AAC3F;AACA,0BAA0B,KAAK,GAAG,UAAU;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,KAAK,IAAI,cAAc;AACjD;AACA,qCAAqC,kBAAkB;AACvD,wBAAwB,QAAQ;AAChC,gBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAK;AACrB,uBAAuB,qBAAW;AAClC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,oBAAU,GAAG,iBAAiB;AAC7D;AACA;AACA;AACA,YAAY,UAAK;AACjB,YAAY,gBAAM;AAClB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iC","sources":["webpack://@bitwarden/cli/../../node_modules/agent-base/dist/helpers.js","webpack://@bitwarden/cli/../../node_modules/agent-base/dist/index.js","webpack://@bitwarden/cli/../../node_modules/https-proxy-agent/dist/parse-proxy-response.js","webpack://@bitwarden/cli/../../node_modules/https-proxy-agent/dist/index.js"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.req = exports.json = exports.toBuffer = void 0;\nconst http = __importStar(require(\"http\"));\nconst https = __importStar(require(\"https\"));\nasync function toBuffer(stream) {\n let length = 0;\n const chunks = [];\n for await (const chunk of stream) {\n length += chunk.length;\n chunks.push(chunk);\n }\n return Buffer.concat(chunks, length);\n}\nexports.toBuffer = toBuffer;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nasync function json(stream) {\n const buf = await toBuffer(stream);\n const str = buf.toString('utf8');\n try {\n return JSON.parse(str);\n }\n catch (_err) {\n const err = _err;\n err.message += ` (input: ${str})`;\n throw err;\n }\n}\nexports.json = json;\nfunction req(url, opts = {}) {\n const href = typeof url === 'string' ? url : url.href;\n const req = (href.startsWith('https:') ? https : http).request(url, opts);\n const promise = new Promise((resolve, reject) => {\n req\n .once('response', resolve)\n .once('error', reject)\n .end();\n });\n req.then = promise.then.bind(promise);\n return req;\n}\nexports.req = req;\n//# sourceMappingURL=helpers.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Agent = void 0;\nconst net = __importStar(require(\"net\"));\nconst http = __importStar(require(\"http\"));\nconst https_1 = require(\"https\");\n__exportStar(require(\"./helpers\"), exports);\nconst INTERNAL = Symbol('AgentBaseInternalState');\nclass Agent extends http.Agent {\n constructor(opts) {\n super(opts);\n this[INTERNAL] = {};\n }\n /**\n * Determine whether this is an `http` or `https` request.\n */\n isSecureEndpoint(options) {\n if (options) {\n // First check the `secureEndpoint` property explicitly, since this\n // means that a parent `Agent` is \"passing through\" to this instance.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof options.secureEndpoint === 'boolean') {\n return options.secureEndpoint;\n }\n // If no explicit `secure` endpoint, check if `protocol` property is\n // set. This will usually be the case since using a full string URL\n // or `URL` instance should be the most common usage.\n if (typeof options.protocol === 'string') {\n return options.protocol === 'https:';\n }\n }\n // Finally, if no `protocol` property was set, then fall back to\n // checking the stack trace of the current call stack, and try to\n // detect the \"https\" module.\n const { stack } = new Error();\n if (typeof stack !== 'string')\n return false;\n return stack\n .split('\\n')\n .some((l) => l.indexOf('(https.js:') !== -1 ||\n l.indexOf('node:https:') !== -1);\n }\n // In order to support async signatures in `connect()` and Node's native\n // connection pooling in `http.Agent`, the array of sockets for each origin\n // has to be updated synchronously. This is so the length of the array is\n // accurate when `addRequest()` is next called. We achieve this by creating a\n // fake socket and adding it to `sockets[origin]` and incrementing\n // `totalSocketCount`.\n incrementSockets(name) {\n // If `maxSockets` and `maxTotalSockets` are both Infinity then there is no\n // need to create a fake socket because Node.js native connection pooling\n // will never be invoked.\n if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {\n return null;\n }\n // All instances of `sockets` are expected TypeScript errors. The\n // alternative is to add it as a private property of this class but that\n // will break TypeScript subclassing.\n if (!this.sockets[name]) {\n // @ts-expect-error `sockets` is readonly in `@types/node`\n this.sockets[name] = [];\n }\n const fakeSocket = new net.Socket({ writable: false });\n this.sockets[name].push(fakeSocket);\n // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`\n this.totalSocketCount++;\n return fakeSocket;\n }\n decrementSockets(name, socket) {\n if (!this.sockets[name] || socket === null) {\n return;\n }\n const sockets = this.sockets[name];\n const index = sockets.indexOf(socket);\n if (index !== -1) {\n sockets.splice(index, 1);\n // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`\n this.totalSocketCount--;\n if (sockets.length === 0) {\n // @ts-expect-error `sockets` is readonly in `@types/node`\n delete this.sockets[name];\n }\n }\n }\n // In order to properly update the socket pool, we need to call `getName()` on\n // the core `https.Agent` if it is a secureEndpoint.\n getName(options) {\n const secureEndpoint = this.isSecureEndpoint(options);\n if (secureEndpoint) {\n // @ts-expect-error `getName()` isn't defined in `@types/node`\n return https_1.Agent.prototype.getName.call(this, options);\n }\n // @ts-expect-error `getName()` isn't defined in `@types/node`\n return super.getName(options);\n }\n createSocket(req, options, cb) {\n const connectOpts = {\n ...options,\n secureEndpoint: this.isSecureEndpoint(options),\n };\n const name = this.getName(connectOpts);\n const fakeSocket = this.incrementSockets(name);\n Promise.resolve()\n .then(() => this.connect(req, connectOpts))\n .then((socket) => {\n this.decrementSockets(name, fakeSocket);\n if (socket instanceof http.Agent) {\n try {\n // @ts-expect-error `addRequest()` isn't defined in `@types/node`\n return socket.addRequest(req, connectOpts);\n }\n catch (err) {\n return cb(err);\n }\n }\n this[INTERNAL].currentSocket = socket;\n // @ts-expect-error `createSocket()` isn't defined in `@types/node`\n super.createSocket(req, options, cb);\n }, (err) => {\n this.decrementSockets(name, fakeSocket);\n cb(err);\n });\n }\n createConnection() {\n const socket = this[INTERNAL].currentSocket;\n this[INTERNAL].currentSocket = undefined;\n if (!socket) {\n throw new Error('No socket was returned in the `connect()` function');\n }\n return socket;\n }\n get defaultPort() {\n return (this[INTERNAL].defaultPort ??\n (this.protocol === 'https:' ? 443 : 80));\n }\n set defaultPort(v) {\n if (this[INTERNAL]) {\n this[INTERNAL].defaultPort = v;\n }\n }\n get protocol() {\n return (this[INTERNAL].protocol ??\n (this.isSecureEndpoint() ? 'https:' : 'http:'));\n }\n set protocol(v) {\n if (this[INTERNAL]) {\n this[INTERNAL].protocol = v;\n }\n }\n}\nexports.Agent = Agent;\n//# sourceMappingURL=index.js.map","import createDebug from 'debug';\nconst debug = createDebug('https-proxy-agent:parse-proxy-response');\nexport function parseProxyResponse(socket) {\n return new Promise((resolve, reject) => {\n // we need to buffer any HTTP traffic that happens with the proxy before we get\n // the CONNECT response, so that if the response is anything other than an \"200\"\n // response code, then we can re-play the \"data\" events on the socket once the\n // HTTP parser is hooked up...\n let buffersLength = 0;\n const buffers = [];\n function read() {\n const b = socket.read();\n if (b)\n ondata(b);\n else\n socket.once('readable', read);\n }\n function cleanup() {\n socket.removeListener('end', onend);\n socket.removeListener('error', onerror);\n socket.removeListener('readable', read);\n }\n function onend() {\n cleanup();\n debug('onend');\n reject(new Error('Proxy connection ended before receiving CONNECT response'));\n }\n function onerror(err) {\n cleanup();\n debug('onerror %o', err);\n reject(err);\n }\n function ondata(b) {\n buffers.push(b);\n buffersLength += b.length;\n const buffered = Buffer.concat(buffers, buffersLength);\n const endOfHeaders = buffered.indexOf('\\r\\n\\r\\n');\n if (endOfHeaders === -1) {\n // keep buffering\n debug('have not received end of HTTP headers yet...');\n read();\n return;\n }\n const headerParts = buffered\n .slice(0, endOfHeaders)\n .toString('ascii')\n .split('\\r\\n');\n const firstLine = headerParts.shift();\n if (!firstLine) {\n socket.destroy();\n return reject(new Error('No header received from proxy CONNECT response'));\n }\n const firstLineParts = firstLine.split(' ');\n const statusCode = +firstLineParts[1];\n const statusText = firstLineParts.slice(2).join(' ');\n const headers = {};\n for (const header of headerParts) {\n if (!header)\n continue;\n const firstColon = header.indexOf(':');\n if (firstColon === -1) {\n socket.destroy();\n return reject(new Error(`Invalid header from proxy CONNECT response: \"${header}\"`));\n }\n const key = header.slice(0, firstColon).toLowerCase();\n const value = header.slice(firstColon + 1).trimStart();\n const current = headers[key];\n if (typeof current === 'string') {\n headers[key] = [current, value];\n }\n else if (Array.isArray(current)) {\n current.push(value);\n }\n else {\n headers[key] = value;\n }\n }\n debug('got proxy server response: %o %o', firstLine, headers);\n cleanup();\n resolve({\n connect: {\n statusCode,\n statusText,\n headers,\n },\n buffered,\n });\n }\n socket.on('error', onerror);\n socket.on('end', onend);\n read();\n });\n}\n//# sourceMappingURL=parse-proxy-response.js.map","import * as net from 'net';\nimport * as tls from 'tls';\nimport assert from 'assert';\nimport createDebug from 'debug';\nimport { Agent } from 'agent-base';\nimport { URL } from 'url';\nimport { parseProxyResponse } from './parse-proxy-response.js';\nconst debug = createDebug('https-proxy-agent');\nconst setServernameFromNonIpHost = (options) => {\n if (options.servername === undefined &&\n options.host &&\n !net.isIP(options.host)) {\n return {\n ...options,\n servername: options.host,\n };\n }\n return options;\n};\n/**\n * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to\n * the specified \"HTTP(s) proxy server\" in order to proxy HTTPS requests.\n *\n * Outgoing HTTP requests are first tunneled through the proxy server using the\n * `CONNECT` HTTP request method to establish a connection to the proxy server,\n * and then the proxy server connects to the destination target and issues the\n * HTTP request from the proxy server.\n *\n * `https:` requests have their socket connection upgraded to TLS once\n * the connection to the proxy server has been established.\n */\nexport class HttpsProxyAgent extends Agent {\n constructor(proxy, opts) {\n super(opts);\n this.options = { path: undefined };\n this.proxy = typeof proxy === 'string' ? new URL(proxy) : proxy;\n this.proxyHeaders = opts?.headers ?? {};\n debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);\n // Trim off the brackets from IPv6 addresses\n const host = (this.proxy.hostname || this.proxy.host).replace(/^\\[|\\]$/g, '');\n const port = this.proxy.port\n ? parseInt(this.proxy.port, 10)\n : this.proxy.protocol === 'https:'\n ? 443\n : 80;\n this.connectOpts = {\n // Attempt to negotiate http/1.1 for proxy servers that support http/2\n ALPNProtocols: ['http/1.1'],\n ...(opts ? omit(opts, 'headers') : null),\n host,\n port,\n };\n }\n /**\n * Called when the node-core HTTP client library is creating a\n * new HTTP request.\n */\n async connect(req, opts) {\n const { proxy } = this;\n if (!opts.host) {\n throw new TypeError('No \"host\" provided');\n }\n // Create a socket connection to the proxy server.\n let socket;\n if (proxy.protocol === 'https:') {\n debug('Creating `tls.Socket`: %o', this.connectOpts);\n socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));\n }\n else {\n debug('Creating `net.Socket`: %o', this.connectOpts);\n socket = net.connect(this.connectOpts);\n }\n const headers = typeof this.proxyHeaders === 'function'\n ? this.proxyHeaders()\n : { ...this.proxyHeaders };\n const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;\n let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\\r\\n`;\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.username || proxy.password) {\n const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;\n headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;\n }\n headers.Host = `${host}:${opts.port}`;\n if (!headers['Proxy-Connection']) {\n headers['Proxy-Connection'] = this.keepAlive\n ? 'Keep-Alive'\n : 'close';\n }\n for (const name of Object.keys(headers)) {\n payload += `${name}: ${headers[name]}\\r\\n`;\n }\n const proxyResponsePromise = parseProxyResponse(socket);\n socket.write(`${payload}\\r\\n`);\n const { connect, buffered } = await proxyResponsePromise;\n req.emit('proxyConnect', connect);\n this.emit('proxyConnect', connect, req);\n if (connect.statusCode === 200) {\n req.once('socket', resume);\n if (opts.secureEndpoint) {\n // The proxy is connecting to a TLS server, so upgrade\n // this socket connection to a TLS connection.\n debug('Upgrading socket connection to TLS');\n return tls.connect({\n ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'),\n socket,\n });\n }\n return socket;\n }\n // Some other status code that's not 200... need to re-play the HTTP\n // header \"data\" events onto the socket once the HTTP machinery is\n // attached so that the node core `http` can parse and handle the\n // error status code.\n // Close the original socket, and a new \"fake\" socket is returned\n // instead, so that the proxy doesn't get the HTTP request\n // written to it (which may contain `Authorization` headers or other\n // sensitive data).\n //\n // See: https://hackerone.com/reports/541502\n socket.destroy();\n const fakeSocket = new net.Socket({ writable: false });\n fakeSocket.readable = true;\n // Need to wait for the \"socket\" event to re-play the \"data\" events.\n req.once('socket', (s) => {\n debug('Replaying proxy buffer for failed request');\n assert(s.listenerCount('data') > 0);\n // Replay the \"buffered\" Buffer onto the fake `socket`, since at\n // this point the HTTP module machinery has been hooked up for\n // the user.\n s.push(buffered);\n s.push(null);\n });\n return fakeSocket;\n }\n}\nHttpsProxyAgent.protocols = ['http', 'https'];\nfunction resume(socket) {\n socket.resume();\n}\nfunction omit(obj, ...keys) {\n const ret = {};\n let key;\n for (key in obj) {\n if (!keys.includes(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n}\n//# sourceMappingURL=index.js.map"],"names":[],"sourceRoot":""}