@php-wasm/web 3.0.45 → 3.0.51
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/index.cjs +13 -13
- package/index.cjs.map +1 -1
- package/index.js +664 -673
- package/index.js.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/tls/extensions/65281_renegotiation_info.d.ts +23 -0
- package/lib/tls/extensions/parse-extensions.d.ts +9 -0
- package/lib/tls/extensions/types.d.ts +1 -0
- package/package.json +18 -16
- package/lib/fetch-with-cors-proxy.d.ts +0 -1
- package/lib/firewall-interference-error.d.ts +0 -13
package/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { LatestSupportedPHPVersion as
|
|
2
|
-
import { consumeAPI as
|
|
3
|
-
import { concatArrayBuffers as
|
|
4
|
-
import { logger as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { LatestSupportedPHPVersion as j, FSHelpers as w, loadPHPRuntime as me, __private__dont__use as k } from "@php-wasm/universal";
|
|
2
|
+
import { consumeAPI as mt, exposeAPI as gt } from "@php-wasm/universal";
|
|
3
|
+
import { concatArrayBuffers as R, concatUint8Arrays as u, Semaphore as ge, joinPaths as ie, basename as Ie } from "@php-wasm/util";
|
|
4
|
+
import { logger as U } from "@php-wasm/logger";
|
|
5
|
+
import { fetchWithCorsProxy as Ke } from "@php-wasm/web-service-worker";
|
|
6
|
+
import { FirewallInterferenceError as Kt, fetchWithCorsProxy as Dt } from "@php-wasm/web-service-worker";
|
|
7
|
+
import { createMemoizedFetch as De } from "@wp-playground/common";
|
|
8
|
+
import { journalFSEvents as We, normalizeFilesystemOperations as be } from "@php-wasm/fs-journal";
|
|
9
|
+
async function Pe(i = j) {
|
|
9
10
|
switch (i) {
|
|
10
11
|
case "8.5":
|
|
11
12
|
return (await import("@php-wasm/web-8-5")).getPHPLoaderModule();
|
|
@@ -27,10 +28,10 @@ async function De(i = O) {
|
|
|
27
28
|
function f(i) {
|
|
28
29
|
return Object.fromEntries(Object.entries(i).map(([e, t]) => [t, e]));
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function K(i) {
|
|
31
32
|
return new Uint8Array([i >> 8 & 255, i & 255]);
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function L(i) {
|
|
34
35
|
return new Uint8Array([
|
|
35
36
|
i >> 16 & 255,
|
|
36
37
|
i >> 8 & 255,
|
|
@@ -41,7 +42,7 @@ function V(i) {
|
|
|
41
42
|
const e = new ArrayBuffer(8);
|
|
42
43
|
return new DataView(e).setBigUint64(0, BigInt(i), !1), new Uint8Array(e);
|
|
43
44
|
}
|
|
44
|
-
class
|
|
45
|
+
class m {
|
|
45
46
|
constructor(e) {
|
|
46
47
|
this.offset = 0, this.buffer = e, this.view = new DataView(e);
|
|
47
48
|
}
|
|
@@ -65,7 +66,7 @@ class g {
|
|
|
65
66
|
return this.offset >= this.buffer.byteLength;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
class
|
|
69
|
+
class M {
|
|
69
70
|
constructor(e) {
|
|
70
71
|
this.offset = 0, this.buffer = new ArrayBuffer(e), this.uint8Array = new Uint8Array(this.buffer), this.view = new DataView(this.buffer);
|
|
71
72
|
}
|
|
@@ -82,7 +83,7 @@ class v {
|
|
|
82
83
|
this.uint8Array.set(e, this.offset), this.offset += e.length;
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
const
|
|
86
|
+
const D = {
|
|
86
87
|
server_name: 0,
|
|
87
88
|
max_fragment_length: 1,
|
|
88
89
|
client_certificate_url: 2,
|
|
@@ -135,34 +136,35 @@ const P = {
|
|
|
135
136
|
signature_algorithms_cert: 50,
|
|
136
137
|
key_share: 51,
|
|
137
138
|
transparency_info: 52,
|
|
138
|
-
connection_id: 54
|
|
139
|
-
|
|
139
|
+
connection_id: 54,
|
|
140
|
+
renegotiation_info: 65281
|
|
141
|
+
}, Re = f(D), _e = {
|
|
140
142
|
host_name: 0
|
|
141
|
-
},
|
|
142
|
-
class
|
|
143
|
+
}, Be = f(_e);
|
|
144
|
+
class ae {
|
|
143
145
|
static decodeFromClient(e) {
|
|
144
146
|
const t = new DataView(e.buffer);
|
|
145
|
-
let
|
|
146
|
-
const
|
|
147
|
-
|
|
147
|
+
let n = 0;
|
|
148
|
+
const r = t.getUint16(n);
|
|
149
|
+
n += 2;
|
|
148
150
|
const s = [];
|
|
149
|
-
for (;
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
const S = e.slice(
|
|
155
|
-
switch (
|
|
151
|
+
for (; n < r + 2; ) {
|
|
152
|
+
const _ = e[n];
|
|
153
|
+
n += 1;
|
|
154
|
+
const a = t.getUint16(n);
|
|
155
|
+
n += 2;
|
|
156
|
+
const S = e.slice(n, n + a);
|
|
157
|
+
switch (n += a, _) {
|
|
156
158
|
case _e.host_name:
|
|
157
159
|
s.push({
|
|
158
|
-
name_type:
|
|
160
|
+
name_type: Be[_],
|
|
159
161
|
name: {
|
|
160
162
|
host_name: new TextDecoder().decode(S)
|
|
161
163
|
}
|
|
162
164
|
});
|
|
163
165
|
break;
|
|
164
166
|
default:
|
|
165
|
-
throw new Error(`Unsupported name type ${
|
|
167
|
+
throw new Error(`Unsupported name type ${_}`);
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
return { server_name_list: s };
|
|
@@ -183,11 +185,80 @@ class oe {
|
|
|
183
185
|
throw new Error(
|
|
184
186
|
"Encoding non-empty lists for ClientHello is not supported yet. Only empty lists meant for ServerHello are supported today."
|
|
185
187
|
);
|
|
186
|
-
const t = new
|
|
187
|
-
return t.writeUint16(
|
|
188
|
+
const t = new M(4);
|
|
189
|
+
return t.writeUint16(D.server_name), t.writeUint16(0), t.uint8Array;
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
|
-
const
|
|
192
|
+
const oe = {
|
|
193
|
+
uncompressed: 0,
|
|
194
|
+
ansiX962_compressed_prime: 1,
|
|
195
|
+
ansiX962_compressed_char2: 2
|
|
196
|
+
}, z = f(oe);
|
|
197
|
+
class ce {
|
|
198
|
+
/**
|
|
199
|
+
* +--------------------------------------------------+
|
|
200
|
+
* | Payload Length [2B] |
|
|
201
|
+
* +--------------------------------------------------+
|
|
202
|
+
* | EC Point Formats Length [1B] |
|
|
203
|
+
* +--------------------------------------------------+
|
|
204
|
+
* | EC Point Format 1 [1B] |
|
|
205
|
+
* +--------------------------------------------------+
|
|
206
|
+
* | EC Point Format 2 [1B] |
|
|
207
|
+
* +--------------------------------------------------+
|
|
208
|
+
* | ... |
|
|
209
|
+
* +--------------------------------------------------+
|
|
210
|
+
* | EC Point Format n [1B] |
|
|
211
|
+
* +--------------------------------------------------+
|
|
212
|
+
*/
|
|
213
|
+
static decodeFromClient(e) {
|
|
214
|
+
const t = new m(e.buffer), n = t.readUint8(), r = [];
|
|
215
|
+
for (let s = 0; s < n; s++) {
|
|
216
|
+
const _ = t.readUint8();
|
|
217
|
+
_ in z && r.push(z[_]);
|
|
218
|
+
}
|
|
219
|
+
return r;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Encode the ec_point_formats extension
|
|
223
|
+
*
|
|
224
|
+
* +--------------------------------------------------+
|
|
225
|
+
* | Extension Type (ec_point_formats) [2B] |
|
|
226
|
+
* | 0x00 0x0B |
|
|
227
|
+
* +--------------------------------------------------+
|
|
228
|
+
* | Body Length [2B] |
|
|
229
|
+
* +--------------------------------------------------+
|
|
230
|
+
* | EC Point Format Length [1B] |
|
|
231
|
+
* +--------------------------------------------------+
|
|
232
|
+
* | EC Point Format [1B] |
|
|
233
|
+
* +--------------------------------------------------+
|
|
234
|
+
*/
|
|
235
|
+
static encodeForClient(e) {
|
|
236
|
+
const t = new M(6);
|
|
237
|
+
return t.writeUint16(D.ec_point_formats), t.writeUint16(2), t.writeUint8(1), t.writeUint8(oe[e]), t.uint8Array;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const Se = {
|
|
241
|
+
decodeFromClient(i) {
|
|
242
|
+
const e = i[0] ?? 0;
|
|
243
|
+
return {
|
|
244
|
+
renegotiatedConnection: i.slice(1, 1 + e)
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* For an initial connection (not a renegotiation), the server responds
|
|
249
|
+
* with an empty renegotiated_connection field.
|
|
250
|
+
*/
|
|
251
|
+
encodeForClient() {
|
|
252
|
+
const i = D.renegotiation_info, e = new Uint8Array([0]);
|
|
253
|
+
return new Uint8Array([
|
|
254
|
+
i >> 8 & 255,
|
|
255
|
+
i & 255,
|
|
256
|
+
0,
|
|
257
|
+
e.length,
|
|
258
|
+
...e
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
261
|
+
}, Ce = {
|
|
191
262
|
TLS1_CK_PSK_WITH_RC4_128_SHA: 138,
|
|
192
263
|
TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA: 139,
|
|
193
264
|
TLS1_CK_PSK_WITH_AES_128_CBC_SHA: 140,
|
|
@@ -390,14 +461,14 @@ const ce = {
|
|
|
390
461
|
TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305: 52396,
|
|
391
462
|
TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305: 52397,
|
|
392
463
|
TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305: 52398
|
|
393
|
-
},
|
|
464
|
+
}, Y = f(Ce), Ae = {
|
|
394
465
|
secp256r1: 23,
|
|
395
466
|
secp384r1: 24,
|
|
396
467
|
secp521r1: 25,
|
|
397
468
|
x25519: 29,
|
|
398
469
|
x448: 30
|
|
399
|
-
},
|
|
400
|
-
class
|
|
470
|
+
}, Z = f(Ae);
|
|
471
|
+
class Ue {
|
|
401
472
|
/**
|
|
402
473
|
* +--------------------------------------------------+
|
|
403
474
|
* | Payload Length [2B] |
|
|
@@ -414,14 +485,14 @@ class Pe {
|
|
|
414
485
|
* +--------------------------------------------------+
|
|
415
486
|
*/
|
|
416
487
|
static decodeFromClient(e) {
|
|
417
|
-
const t = new
|
|
488
|
+
const t = new m(e.buffer);
|
|
418
489
|
t.readUint16();
|
|
419
|
-
const
|
|
490
|
+
const n = [];
|
|
420
491
|
for (; !t.isFinished(); ) {
|
|
421
|
-
const
|
|
422
|
-
|
|
492
|
+
const r = t.readUint16();
|
|
493
|
+
r in Z && n.push(Z[r]);
|
|
423
494
|
}
|
|
424
|
-
return
|
|
495
|
+
return n;
|
|
425
496
|
}
|
|
426
497
|
/**
|
|
427
498
|
* +--------------------------------------------------+
|
|
@@ -434,64 +505,16 @@ class Pe {
|
|
|
434
505
|
* +--------------------------------------------------+
|
|
435
506
|
*/
|
|
436
507
|
static encodeForClient(e) {
|
|
437
|
-
const t = new
|
|
438
|
-
return t.writeUint16(
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
const Ce = {
|
|
442
|
-
uncompressed: 0,
|
|
443
|
-
ansiX962_compressed_prime: 1,
|
|
444
|
-
ansiX962_compressed_char2: 2
|
|
445
|
-
}, X = f(Ce);
|
|
446
|
-
class Re {
|
|
447
|
-
/**
|
|
448
|
-
* +--------------------------------------------------+
|
|
449
|
-
* | Payload Length [2B] |
|
|
450
|
-
* +--------------------------------------------------+
|
|
451
|
-
* | EC Point Formats Length [1B] |
|
|
452
|
-
* +--------------------------------------------------+
|
|
453
|
-
* | EC Point Format 1 [1B] |
|
|
454
|
-
* +--------------------------------------------------+
|
|
455
|
-
* | EC Point Format 2 [1B] |
|
|
456
|
-
* +--------------------------------------------------+
|
|
457
|
-
* | ... |
|
|
458
|
-
* +--------------------------------------------------+
|
|
459
|
-
* | EC Point Format n [1B] |
|
|
460
|
-
* +--------------------------------------------------+
|
|
461
|
-
*/
|
|
462
|
-
static decodeFromClient(e) {
|
|
463
|
-
const t = new g(e.buffer), r = t.readUint8(), n = [];
|
|
464
|
-
for (let s = 0; s < r; s++) {
|
|
465
|
-
const a = t.readUint8();
|
|
466
|
-
a in X && n.push(X[a]);
|
|
467
|
-
}
|
|
468
|
-
return n;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Encode the ec_point_formats extension
|
|
472
|
-
*
|
|
473
|
-
* +--------------------------------------------------+
|
|
474
|
-
* | Extension Type (ec_point_formats) [2B] |
|
|
475
|
-
* | 0x00 0x0B |
|
|
476
|
-
* +--------------------------------------------------+
|
|
477
|
-
* | Body Length [2B] |
|
|
478
|
-
* +--------------------------------------------------+
|
|
479
|
-
* | EC Point Format Length [1B] |
|
|
480
|
-
* +--------------------------------------------------+
|
|
481
|
-
* | EC Point Format [1B] |
|
|
482
|
-
* +--------------------------------------------------+
|
|
483
|
-
*/
|
|
484
|
-
static encodeForClient(e) {
|
|
485
|
-
const t = new v(6);
|
|
486
|
-
return t.writeUint16(P.ec_point_formats), t.writeUint16(2), t.writeUint8(1), t.writeUint8(Ce[e]), t.uint8Array;
|
|
508
|
+
const t = new M(6);
|
|
509
|
+
return t.writeUint16(D.supported_groups), t.writeUint16(2), t.writeUint16(Ae[e]), t.uint8Array;
|
|
487
510
|
}
|
|
488
511
|
}
|
|
489
|
-
const
|
|
512
|
+
const G = {
|
|
490
513
|
anonymous: 0,
|
|
491
514
|
rsa: 1,
|
|
492
515
|
dsa: 2,
|
|
493
516
|
ecdsa: 3
|
|
494
|
-
},
|
|
517
|
+
}, J = f(G), $ = {
|
|
495
518
|
none: 0,
|
|
496
519
|
md5: 1,
|
|
497
520
|
sha1: 2,
|
|
@@ -499,8 +522,8 @@ const j = {
|
|
|
499
522
|
sha256: 4,
|
|
500
523
|
sha384: 5,
|
|
501
524
|
sha512: 6
|
|
502
|
-
},
|
|
503
|
-
class
|
|
525
|
+
}, X = f($);
|
|
526
|
+
class Me {
|
|
504
527
|
/**
|
|
505
528
|
* Binary layout:
|
|
506
529
|
*
|
|
@@ -517,23 +540,23 @@ class Be {
|
|
|
517
540
|
* +------------------------------------+
|
|
518
541
|
*/
|
|
519
542
|
static decodeFromClient(e) {
|
|
520
|
-
const t = new
|
|
543
|
+
const t = new m(e.buffer);
|
|
521
544
|
t.readUint16();
|
|
522
|
-
const
|
|
545
|
+
const n = [];
|
|
523
546
|
for (; !t.isFinished(); ) {
|
|
524
|
-
const
|
|
525
|
-
if (
|
|
526
|
-
if (!
|
|
527
|
-
|
|
547
|
+
const r = t.readUint8(), s = t.readUint8();
|
|
548
|
+
if (J[s]) {
|
|
549
|
+
if (!X[r]) {
|
|
550
|
+
U.warn(`Unknown hash algorithm: ${r}`);
|
|
528
551
|
continue;
|
|
529
552
|
}
|
|
530
|
-
|
|
531
|
-
algorithm:
|
|
532
|
-
hash:
|
|
553
|
+
n.push({
|
|
554
|
+
algorithm: J[s],
|
|
555
|
+
hash: X[r]
|
|
533
556
|
});
|
|
534
557
|
}
|
|
535
558
|
}
|
|
536
|
-
return
|
|
559
|
+
return n;
|
|
537
560
|
}
|
|
538
561
|
/**
|
|
539
562
|
* +--------------------------------------------------+
|
|
@@ -547,47 +570,48 @@ class Be {
|
|
|
547
570
|
* +--------------------------------------------------+
|
|
548
571
|
*/
|
|
549
572
|
static encodeforClient(e, t) {
|
|
550
|
-
const
|
|
551
|
-
return
|
|
573
|
+
const n = new M(6);
|
|
574
|
+
return n.writeUint16(D.signature_algorithms), n.writeUint16(2), n.writeUint8($[e]), n.writeUint8(G[t]), n.uint8Array;
|
|
552
575
|
}
|
|
553
576
|
}
|
|
554
577
|
const Q = {
|
|
555
|
-
server_name:
|
|
556
|
-
signature_algorithms:
|
|
557
|
-
supported_groups:
|
|
558
|
-
ec_point_formats:
|
|
578
|
+
server_name: ae,
|
|
579
|
+
signature_algorithms: Me,
|
|
580
|
+
supported_groups: Ue,
|
|
581
|
+
ec_point_formats: ce,
|
|
582
|
+
renegotiation_info: Se
|
|
559
583
|
};
|
|
560
|
-
function
|
|
561
|
-
const e = new
|
|
584
|
+
function ve(i) {
|
|
585
|
+
const e = new m(i.buffer), t = [];
|
|
562
586
|
for (; !e.isFinished(); ) {
|
|
563
|
-
const
|
|
587
|
+
const n = e.offset, r = e.readUint16(), s = Re[r], _ = e.readUint16(), a = e.readUint8Array(_);
|
|
564
588
|
if (!(s in Q))
|
|
565
589
|
continue;
|
|
566
590
|
const S = Q[s];
|
|
567
591
|
t.push({
|
|
568
592
|
type: s,
|
|
569
|
-
data: S.decodeFromClient(
|
|
570
|
-
raw: i.slice(
|
|
593
|
+
data: S.decodeFromClient(a),
|
|
594
|
+
raw: i.slice(n, n + 4 + _)
|
|
571
595
|
});
|
|
572
596
|
}
|
|
573
597
|
return t;
|
|
574
598
|
}
|
|
575
|
-
async function q(i, e, t,
|
|
576
|
-
const
|
|
599
|
+
async function q(i, e, t, n) {
|
|
600
|
+
const r = R([e, t]), s = await crypto.subtle.importKey(
|
|
577
601
|
"raw",
|
|
578
602
|
i,
|
|
579
603
|
{ name: "HMAC", hash: { name: "SHA-256" } },
|
|
580
604
|
!1,
|
|
581
605
|
["sign"]
|
|
582
606
|
);
|
|
583
|
-
let
|
|
584
|
-
const
|
|
585
|
-
for (;
|
|
586
|
-
|
|
587
|
-
const c =
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
return
|
|
607
|
+
let _ = r;
|
|
608
|
+
const a = [];
|
|
609
|
+
for (; R(a).byteLength < n; ) {
|
|
610
|
+
_ = await ee(s, _);
|
|
611
|
+
const c = R([_, r]), A = await ee(s, c);
|
|
612
|
+
a.push(A);
|
|
613
|
+
}
|
|
614
|
+
return R(a).slice(0, n);
|
|
591
615
|
}
|
|
592
616
|
async function ee(i, e) {
|
|
593
617
|
return await crypto.subtle.sign(
|
|
@@ -596,12 +620,12 @@ async function ee(i, e) {
|
|
|
596
620
|
e
|
|
597
621
|
);
|
|
598
622
|
}
|
|
599
|
-
const
|
|
623
|
+
const xe = {
|
|
600
624
|
Null: 0
|
|
601
|
-
},
|
|
625
|
+
}, he = {
|
|
602
626
|
Warning: 1,
|
|
603
627
|
Fatal: 2
|
|
604
|
-
},
|
|
628
|
+
}, le = f(he), ue = {
|
|
605
629
|
CloseNotify: 0,
|
|
606
630
|
UnexpectedMessage: 10,
|
|
607
631
|
BadRecordMac: 20,
|
|
@@ -627,12 +651,12 @@ const Me = {
|
|
|
627
651
|
UserCanceled: 90,
|
|
628
652
|
NoRenegotiation: 100,
|
|
629
653
|
UnsupportedExtension: 110
|
|
630
|
-
},
|
|
654
|
+
}, He = f(ue), C = {
|
|
631
655
|
ChangeCipherSpec: 20,
|
|
632
656
|
Alert: 21,
|
|
633
657
|
Handshake: 22,
|
|
634
658
|
ApplicationData: 23
|
|
635
|
-
},
|
|
659
|
+
}, d = {
|
|
636
660
|
HelloRequest: 0,
|
|
637
661
|
ClientHello: 1,
|
|
638
662
|
ServerHello: 2,
|
|
@@ -653,9 +677,9 @@ const Me = {
|
|
|
653
677
|
}, ke = {
|
|
654
678
|
secp256r1: 23
|
|
655
679
|
};
|
|
656
|
-
class
|
|
680
|
+
class F extends Error {
|
|
657
681
|
}
|
|
658
|
-
const
|
|
682
|
+
const B = new Uint8Array([3, 3]), Fe = crypto.subtle.generateKey(
|
|
659
683
|
{
|
|
660
684
|
name: "ECDH",
|
|
661
685
|
namedCurve: "P-256"
|
|
@@ -666,7 +690,7 @@ const U = new Uint8Array([3, 3]), qe = crypto.subtle.generateKey(
|
|
|
666
690
|
["deriveKey", "deriveBits"]
|
|
667
691
|
// Key usage
|
|
668
692
|
);
|
|
669
|
-
class
|
|
693
|
+
class qe {
|
|
670
694
|
constructor() {
|
|
671
695
|
this.receivedRecordSequenceNumber = 0, this.sentRecordSequenceNumber = 0, this.closed = !1, this.receivedBytesBuffer = new Uint8Array(), this.receivedTLSRecords = [], this.partialTLSMessages = {}, this.handshakeMessages = [], this.MAX_CHUNK_SIZE = 1024 * 16, this.clientEnd = {
|
|
672
696
|
// We don't need to chunk the encrypted data.
|
|
@@ -739,41 +763,41 @@ class Fe {
|
|
|
739
763
|
* https://datatracker.ietf.org/doc/html/rfc5246#section-7.4
|
|
740
764
|
*/
|
|
741
765
|
async TLSHandshake(e, t) {
|
|
742
|
-
const
|
|
743
|
-
|
|
766
|
+
const n = await this.readNextHandshakeMessage(
|
|
767
|
+
d.ClientHello
|
|
744
768
|
);
|
|
745
|
-
if (!
|
|
769
|
+
if (!n.body.cipher_suites.length)
|
|
746
770
|
throw new Error(
|
|
747
771
|
"Client did not propose any supported cipher suites."
|
|
748
772
|
);
|
|
749
|
-
const
|
|
773
|
+
const r = crypto.getRandomValues(new Uint8Array(32));
|
|
750
774
|
await this.writeTLSRecord(
|
|
751
775
|
C.Handshake,
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
776
|
+
I.serverHello(
|
|
777
|
+
n.body,
|
|
778
|
+
r,
|
|
779
|
+
xe.Null
|
|
756
780
|
)
|
|
757
781
|
), await this.writeTLSRecord(
|
|
758
782
|
C.Handshake,
|
|
759
|
-
|
|
783
|
+
I.certificate(t)
|
|
760
784
|
);
|
|
761
|
-
const s = await
|
|
762
|
-
|
|
763
|
-
|
|
785
|
+
const s = await Fe, _ = n.body.random, a = await I.ECDHEServerKeyExchange(
|
|
786
|
+
_,
|
|
787
|
+
r,
|
|
764
788
|
s,
|
|
765
789
|
e
|
|
766
790
|
);
|
|
767
|
-
await this.writeTLSRecord(C.Handshake,
|
|
791
|
+
await this.writeTLSRecord(C.Handshake, a), await this.writeTLSRecord(
|
|
768
792
|
C.Handshake,
|
|
769
|
-
|
|
793
|
+
I.serverHelloDone()
|
|
770
794
|
);
|
|
771
795
|
const S = await this.readNextHandshakeMessage(
|
|
772
|
-
|
|
796
|
+
d.ClientKeyExchange
|
|
773
797
|
);
|
|
774
798
|
await this.readNextMessage(C.ChangeCipherSpec), this.sessionKeys = await this.deriveSessionKeys({
|
|
775
|
-
clientRandom:
|
|
776
|
-
serverRandom:
|
|
799
|
+
clientRandom: _,
|
|
800
|
+
serverRandom: r,
|
|
777
801
|
serverPrivateKey: s.privateKey,
|
|
778
802
|
clientPublicKey: await crypto.subtle.importKey(
|
|
779
803
|
"raw",
|
|
@@ -782,12 +806,12 @@ class Fe {
|
|
|
782
806
|
!1,
|
|
783
807
|
[]
|
|
784
808
|
)
|
|
785
|
-
}), await this.readNextHandshakeMessage(
|
|
809
|
+
}), await this.readNextHandshakeMessage(d.Finished), await this.writeTLSRecord(
|
|
786
810
|
C.ChangeCipherSpec,
|
|
787
|
-
|
|
811
|
+
I.changeCipherSpec()
|
|
788
812
|
), await this.writeTLSRecord(
|
|
789
813
|
C.Handshake,
|
|
790
|
-
await
|
|
814
|
+
await I.createFinishedMessage(
|
|
791
815
|
this.handshakeMessages,
|
|
792
816
|
this.sessionKeys.masterSecret
|
|
793
817
|
)
|
|
@@ -800,33 +824,33 @@ class Fe {
|
|
|
800
824
|
async deriveSessionKeys({
|
|
801
825
|
clientRandom: e,
|
|
802
826
|
serverRandom: t,
|
|
803
|
-
serverPrivateKey:
|
|
804
|
-
clientPublicKey:
|
|
827
|
+
serverPrivateKey: n,
|
|
828
|
+
clientPublicKey: r
|
|
805
829
|
}) {
|
|
806
830
|
const s = await crypto.subtle.deriveBits(
|
|
807
831
|
{
|
|
808
832
|
name: "ECDH",
|
|
809
|
-
public:
|
|
833
|
+
public: r
|
|
810
834
|
},
|
|
811
|
-
|
|
835
|
+
n,
|
|
812
836
|
256
|
|
813
837
|
// Length of the derived secret (256 bits for P-256)
|
|
814
|
-
),
|
|
838
|
+
), _ = new Uint8Array(
|
|
815
839
|
await q(
|
|
816
840
|
s,
|
|
817
841
|
new TextEncoder().encode("master secret"),
|
|
818
842
|
u([e, t]),
|
|
819
843
|
48
|
|
820
844
|
)
|
|
821
|
-
),
|
|
822
|
-
|
|
845
|
+
), a = await q(
|
|
846
|
+
_,
|
|
823
847
|
new TextEncoder().encode("key expansion"),
|
|
824
848
|
u([t, e]),
|
|
825
849
|
// Client key, server key, client IV, server IV
|
|
826
850
|
40
|
|
827
|
-
), S = new
|
|
851
|
+
), S = new m(a), c = S.readUint8Array(16), A = S.readUint8Array(16), h = S.readUint8Array(4), l = S.readUint8Array(4);
|
|
828
852
|
return {
|
|
829
|
-
masterSecret:
|
|
853
|
+
masterSecret: _,
|
|
830
854
|
clientWriteKey: await crypto.subtle.importKey(
|
|
831
855
|
"raw",
|
|
832
856
|
c,
|
|
@@ -836,13 +860,13 @@ class Fe {
|
|
|
836
860
|
),
|
|
837
861
|
serverWriteKey: await crypto.subtle.importKey(
|
|
838
862
|
"raw",
|
|
839
|
-
|
|
863
|
+
A,
|
|
840
864
|
{ name: "AES-GCM" },
|
|
841
865
|
!1,
|
|
842
866
|
["encrypt", "decrypt"]
|
|
843
867
|
),
|
|
844
|
-
clientIV:
|
|
845
|
-
serverIV:
|
|
868
|
+
clientIV: h,
|
|
869
|
+
serverIV: l
|
|
846
870
|
};
|
|
847
871
|
}
|
|
848
872
|
async readNextHandshakeMessage(e) {
|
|
@@ -852,41 +876,41 @@ class Fe {
|
|
|
852
876
|
return t;
|
|
853
877
|
}
|
|
854
878
|
async readNextMessage(e) {
|
|
855
|
-
let t,
|
|
879
|
+
let t, n = !1;
|
|
856
880
|
do
|
|
857
|
-
t = await this.readNextTLSRecord(e),
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
while (r === !1);
|
|
861
|
-
const n = T.TLSMessage(
|
|
881
|
+
t = await this.readNextTLSRecord(e), n = await this.accumulateUntilMessageIsComplete(t);
|
|
882
|
+
while (n === !1);
|
|
883
|
+
const r = T.TLSMessage(
|
|
862
884
|
t.type,
|
|
863
|
-
|
|
885
|
+
n
|
|
864
886
|
);
|
|
865
|
-
return t.type === C.Handshake && this.handshakeMessages.push(t.fragment),
|
|
887
|
+
return t.type === C.Handshake && this.handshakeMessages.push(t.fragment), r;
|
|
866
888
|
}
|
|
867
889
|
async readNextTLSRecord(e) {
|
|
868
890
|
for (; ; ) {
|
|
869
|
-
for (let
|
|
870
|
-
const S = this.receivedTLSRecords[
|
|
891
|
+
for (let a = 0; a < this.receivedTLSRecords.length; a++) {
|
|
892
|
+
const S = this.receivedTLSRecords[a];
|
|
871
893
|
if (S.type === e)
|
|
872
|
-
return this.receivedTLSRecords.splice(
|
|
894
|
+
return this.receivedTLSRecords.splice(a, 1), S;
|
|
873
895
|
}
|
|
874
|
-
const t = await this.pollBytes(5),
|
|
875
|
-
type:
|
|
896
|
+
const t = await this.pollBytes(5), n = t[3] << 8 | t[4], r = t[0], s = await this.pollBytes(n), _ = {
|
|
897
|
+
type: r,
|
|
876
898
|
version: {
|
|
877
899
|
major: t[1],
|
|
878
900
|
minor: t[2]
|
|
879
901
|
},
|
|
880
|
-
length:
|
|
881
|
-
fragment: this.sessionKeys &&
|
|
902
|
+
length: n,
|
|
903
|
+
fragment: this.sessionKeys && r !== C.ChangeCipherSpec ? await this.decryptData(r, s) : s
|
|
882
904
|
};
|
|
883
|
-
if (
|
|
884
|
-
const
|
|
885
|
-
throw new
|
|
886
|
-
|
|
905
|
+
if (_.type === C.Alert) {
|
|
906
|
+
const a = _.fragment[0], S = _.fragment[1], c = le[a], A = He[S];
|
|
907
|
+
throw a === he.Warning && S === ue.CloseNotify ? new F(
|
|
908
|
+
"TLS connection closed by peer (CloseNotify)"
|
|
909
|
+
) : new Error(
|
|
910
|
+
`TLS alert received: ${c} ${A}`
|
|
887
911
|
);
|
|
888
912
|
}
|
|
889
|
-
this.receivedTLSRecords.push(
|
|
913
|
+
this.receivedTLSRecords.push(_);
|
|
890
914
|
}
|
|
891
915
|
}
|
|
892
916
|
/**
|
|
@@ -895,12 +919,12 @@ class Fe {
|
|
|
895
919
|
*/
|
|
896
920
|
async pollBytes(e) {
|
|
897
921
|
for (; this.receivedBytesBuffer.length < e; ) {
|
|
898
|
-
const { value:
|
|
899
|
-
if (
|
|
900
|
-
throw await this.close(), new
|
|
922
|
+
const { value: n, done: r } = await this.clientUpstreamReader.read();
|
|
923
|
+
if (r)
|
|
924
|
+
throw await this.close(), new F("TLS connection closed");
|
|
901
925
|
if (this.receivedBytesBuffer = u([
|
|
902
926
|
this.receivedBytesBuffer,
|
|
903
|
-
|
|
927
|
+
n
|
|
904
928
|
]), this.receivedBytesBuffer.length >= e)
|
|
905
929
|
break;
|
|
906
930
|
await new Promise((s) => setTimeout(s, 100));
|
|
@@ -921,7 +945,7 @@ class Fe {
|
|
|
921
945
|
this.serverUpstreamWriter.write(e.body);
|
|
922
946
|
}
|
|
923
947
|
} catch (e) {
|
|
924
|
-
if (e instanceof
|
|
948
|
+
if (e instanceof F)
|
|
925
949
|
return;
|
|
926
950
|
throw e;
|
|
927
951
|
}
|
|
@@ -931,16 +955,16 @@ class Fe {
|
|
|
931
955
|
* the AES-GCM algorithm.
|
|
932
956
|
*/
|
|
933
957
|
async decryptData(e, t) {
|
|
934
|
-
const
|
|
958
|
+
const n = this.sessionKeys.clientIV, r = t.slice(0, 8), s = new Uint8Array([...n, ...r]), _ = await crypto.subtle.decrypt(
|
|
935
959
|
{
|
|
936
960
|
name: "AES-GCM",
|
|
937
961
|
iv: s,
|
|
938
962
|
additionalData: new Uint8Array([
|
|
939
963
|
...V(this.receivedRecordSequenceNumber),
|
|
940
964
|
e,
|
|
941
|
-
...
|
|
965
|
+
...B,
|
|
942
966
|
// Payload length without IV and tag
|
|
943
|
-
...
|
|
967
|
+
...K(t.length - 8 - 16)
|
|
944
968
|
]),
|
|
945
969
|
tagLength: 128
|
|
946
970
|
},
|
|
@@ -948,7 +972,7 @@ class Fe {
|
|
|
948
972
|
// Payload without the explicit IV
|
|
949
973
|
t.slice(8)
|
|
950
974
|
);
|
|
951
|
-
return ++this.receivedRecordSequenceNumber, new Uint8Array(
|
|
975
|
+
return ++this.receivedRecordSequenceNumber, new Uint8Array(_);
|
|
952
976
|
}
|
|
953
977
|
async accumulateUntilMessageIsComplete(e) {
|
|
954
978
|
this.partialTLSMessages[e.type] = u([
|
|
@@ -960,8 +984,8 @@ class Fe {
|
|
|
960
984
|
case C.Handshake: {
|
|
961
985
|
if (t.length < 4)
|
|
962
986
|
return !1;
|
|
963
|
-
const
|
|
964
|
-
if (t.length < 3 +
|
|
987
|
+
const n = t[1] << 8 | t[2];
|
|
988
|
+
if (t.length < 3 + n)
|
|
965
989
|
return !1;
|
|
966
990
|
break;
|
|
967
991
|
}
|
|
@@ -987,35 +1011,35 @@ class Fe {
|
|
|
987
1011
|
*/
|
|
988
1012
|
async writeTLSRecord(e, t) {
|
|
989
1013
|
e === C.Handshake && this.handshakeMessages.push(t), this.sessionKeys && e !== C.ChangeCipherSpec && (t = await this.encryptData(e, t));
|
|
990
|
-
const
|
|
991
|
-
s[0] = e, s[1] =
|
|
992
|
-
const
|
|
993
|
-
this.clientDownstreamWriter.write(
|
|
1014
|
+
const n = B, r = t.length, s = new Uint8Array(5);
|
|
1015
|
+
s[0] = e, s[1] = n[0], s[2] = n[1], s[3] = r >> 8 & 255, s[4] = r & 255;
|
|
1016
|
+
const _ = u([s, t]);
|
|
1017
|
+
this.clientDownstreamWriter.write(_);
|
|
994
1018
|
}
|
|
995
1019
|
/**
|
|
996
1020
|
* Encrypts data in a TLS 1.2-compliant manner using
|
|
997
1021
|
* the AES-GCM algorithm.
|
|
998
1022
|
*/
|
|
999
1023
|
async encryptData(e, t) {
|
|
1000
|
-
const
|
|
1024
|
+
const n = this.sessionKeys.serverIV, r = crypto.getRandomValues(new Uint8Array(8)), s = new Uint8Array([...n, ...r]), _ = new Uint8Array([
|
|
1001
1025
|
...V(this.sentRecordSequenceNumber),
|
|
1002
1026
|
e,
|
|
1003
|
-
...
|
|
1027
|
+
...B,
|
|
1004
1028
|
// Payload length without IV and tag
|
|
1005
|
-
...
|
|
1006
|
-
]),
|
|
1029
|
+
...K(t.length)
|
|
1030
|
+
]), a = await crypto.subtle.encrypt(
|
|
1007
1031
|
{
|
|
1008
1032
|
name: "AES-GCM",
|
|
1009
1033
|
iv: s,
|
|
1010
|
-
additionalData:
|
|
1034
|
+
additionalData: _,
|
|
1011
1035
|
tagLength: 128
|
|
1012
1036
|
},
|
|
1013
1037
|
this.sessionKeys.serverWriteKey,
|
|
1014
1038
|
t
|
|
1015
1039
|
);
|
|
1016
1040
|
return ++this.sentRecordSequenceNumber, u([
|
|
1017
|
-
|
|
1018
|
-
new Uint8Array(
|
|
1041
|
+
r,
|
|
1042
|
+
new Uint8Array(a)
|
|
1019
1043
|
]);
|
|
1020
1044
|
}
|
|
1021
1045
|
}
|
|
@@ -1058,14 +1082,14 @@ class T {
|
|
|
1058
1082
|
* https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4
|
|
1059
1083
|
*/
|
|
1060
1084
|
static parseCipherSuites(e) {
|
|
1061
|
-
const t = new
|
|
1085
|
+
const t = new m(e);
|
|
1062
1086
|
t.readUint16();
|
|
1063
|
-
const
|
|
1087
|
+
const n = [];
|
|
1064
1088
|
for (; !t.isFinished(); ) {
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1089
|
+
const r = t.readUint16();
|
|
1090
|
+
r in Y && n.push(Y[r]);
|
|
1067
1091
|
}
|
|
1068
|
-
return
|
|
1092
|
+
return n;
|
|
1069
1093
|
}
|
|
1070
1094
|
static applicationData(e) {
|
|
1071
1095
|
return {
|
|
@@ -1082,25 +1106,25 @@ class T {
|
|
|
1082
1106
|
static alert(e) {
|
|
1083
1107
|
return {
|
|
1084
1108
|
type: C.Alert,
|
|
1085
|
-
level:
|
|
1086
|
-
description:
|
|
1109
|
+
level: le[e[0]],
|
|
1110
|
+
description: He[e[1]]
|
|
1087
1111
|
};
|
|
1088
1112
|
}
|
|
1089
1113
|
static clientHandshake(e) {
|
|
1090
|
-
const t = e[0],
|
|
1114
|
+
const t = e[0], n = e[1] << 16 | e[2] << 8 | e[3], r = e.slice(4);
|
|
1091
1115
|
let s;
|
|
1092
1116
|
switch (t) {
|
|
1093
|
-
case
|
|
1117
|
+
case d.HelloRequest:
|
|
1094
1118
|
s = T.clientHelloRequestPayload();
|
|
1095
1119
|
break;
|
|
1096
|
-
case
|
|
1097
|
-
s = T.clientHelloPayload(
|
|
1120
|
+
case d.ClientHello:
|
|
1121
|
+
s = T.clientHelloPayload(r);
|
|
1098
1122
|
break;
|
|
1099
|
-
case
|
|
1100
|
-
s = T.clientKeyExchangePayload(
|
|
1123
|
+
case d.ClientKeyExchange:
|
|
1124
|
+
s = T.clientKeyExchangePayload(r);
|
|
1101
1125
|
break;
|
|
1102
|
-
case
|
|
1103
|
-
s = T.clientFinishedPayload(
|
|
1126
|
+
case d.Finished:
|
|
1127
|
+
s = T.clientFinishedPayload(r);
|
|
1104
1128
|
break;
|
|
1105
1129
|
default:
|
|
1106
1130
|
throw new Error(`Invalid handshake type ${t}`);
|
|
@@ -1108,7 +1132,7 @@ class T {
|
|
|
1108
1132
|
return {
|
|
1109
1133
|
type: C.Handshake,
|
|
1110
1134
|
msg_type: t,
|
|
1111
|
-
length:
|
|
1135
|
+
length: n,
|
|
1112
1136
|
body: s
|
|
1113
1137
|
};
|
|
1114
1138
|
}
|
|
@@ -1156,7 +1180,7 @@ class T {
|
|
|
1156
1180
|
* +------+------+---------------------------+
|
|
1157
1181
|
*/
|
|
1158
1182
|
static clientHelloPayload(e) {
|
|
1159
|
-
const t = new
|
|
1183
|
+
const t = new m(e.buffer), n = {
|
|
1160
1184
|
client_version: t.readUint8Array(2),
|
|
1161
1185
|
/**
|
|
1162
1186
|
* Technically this consists of a GMT timestamp
|
|
@@ -1164,20 +1188,20 @@ class T {
|
|
|
1164
1188
|
* parse this further.
|
|
1165
1189
|
*/
|
|
1166
1190
|
random: t.readUint8Array(32)
|
|
1167
|
-
},
|
|
1168
|
-
|
|
1191
|
+
}, r = t.readUint8();
|
|
1192
|
+
n.session_id = t.readUint8Array(r);
|
|
1169
1193
|
const s = t.readUint16();
|
|
1170
|
-
|
|
1194
|
+
n.cipher_suites = T.parseCipherSuites(
|
|
1171
1195
|
t.readUint8Array(s).buffer
|
|
1172
1196
|
);
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
|
|
1197
|
+
const _ = t.readUint8();
|
|
1198
|
+
n.compression_methods = t.readUint8Array(
|
|
1199
|
+
_
|
|
1176
1200
|
);
|
|
1177
|
-
const
|
|
1178
|
-
return
|
|
1179
|
-
t.readUint8Array(
|
|
1180
|
-
),
|
|
1201
|
+
const a = t.readUint16();
|
|
1202
|
+
return n.extensions = ve(
|
|
1203
|
+
t.readUint8Array(a)
|
|
1204
|
+
), n;
|
|
1181
1205
|
}
|
|
1182
1206
|
/**
|
|
1183
1207
|
* Binary layout:
|
|
@@ -1208,19 +1232,19 @@ function Oe(i) {
|
|
|
1208
1232
|
}
|
|
1209
1233
|
});
|
|
1210
1234
|
}
|
|
1211
|
-
class
|
|
1235
|
+
class I {
|
|
1212
1236
|
static certificate(e) {
|
|
1213
1237
|
const t = [];
|
|
1214
1238
|
for (const s of e)
|
|
1215
|
-
t.push(
|
|
1216
|
-
const
|
|
1217
|
-
...
|
|
1218
|
-
...
|
|
1239
|
+
t.push(L(s.byteLength)), t.push(new Uint8Array(s));
|
|
1240
|
+
const n = u(t), r = new Uint8Array([
|
|
1241
|
+
...L(n.byteLength),
|
|
1242
|
+
...n
|
|
1219
1243
|
]);
|
|
1220
1244
|
return new Uint8Array([
|
|
1221
|
-
|
|
1222
|
-
...
|
|
1223
|
-
...
|
|
1245
|
+
d.Certificate,
|
|
1246
|
+
...L(r.length),
|
|
1247
|
+
...r
|
|
1224
1248
|
]);
|
|
1225
1249
|
}
|
|
1226
1250
|
/*
|
|
@@ -1256,38 +1280,38 @@ class K {
|
|
|
1256
1280
|
* @param rsaPrivateKey - RSA private key for signing
|
|
1257
1281
|
* @returns
|
|
1258
1282
|
*/
|
|
1259
|
-
static async ECDHEServerKeyExchange(e, t,
|
|
1283
|
+
static async ECDHEServerKeyExchange(e, t, n, r) {
|
|
1260
1284
|
const s = new Uint8Array(
|
|
1261
|
-
await crypto.subtle.exportKey("raw",
|
|
1262
|
-
),
|
|
1285
|
+
await crypto.subtle.exportKey("raw", n.publicKey)
|
|
1286
|
+
), _ = new Uint8Array([
|
|
1263
1287
|
// Curve type (1 byte)
|
|
1264
1288
|
Ne.NamedCurve,
|
|
1265
1289
|
// Curve name (2 bytes)
|
|
1266
|
-
...
|
|
1290
|
+
...K(ke.secp256r1),
|
|
1267
1291
|
// Public key length (1 byte)
|
|
1268
1292
|
s.byteLength,
|
|
1269
1293
|
// Public key (65 bytes, uncompressed format)
|
|
1270
1294
|
...s
|
|
1271
|
-
]),
|
|
1295
|
+
]), a = await crypto.subtle.sign(
|
|
1272
1296
|
{
|
|
1273
1297
|
name: "RSASSA-PKCS1-v1_5",
|
|
1274
1298
|
hash: "SHA-256"
|
|
1275
1299
|
},
|
|
1276
|
-
|
|
1277
|
-
new Uint8Array([...e, ...t, ...
|
|
1278
|
-
), S = new Uint8Array(
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
]),
|
|
1282
|
-
...
|
|
1300
|
+
r,
|
|
1301
|
+
new Uint8Array([...e, ...t, ..._])
|
|
1302
|
+
), S = new Uint8Array(a), c = new Uint8Array([
|
|
1303
|
+
$.sha256,
|
|
1304
|
+
G.rsa
|
|
1305
|
+
]), A = new Uint8Array([
|
|
1306
|
+
..._,
|
|
1283
1307
|
...c,
|
|
1284
|
-
...
|
|
1308
|
+
...K(S.length),
|
|
1285
1309
|
...S
|
|
1286
1310
|
]);
|
|
1287
1311
|
return new Uint8Array([
|
|
1288
|
-
|
|
1289
|
-
...
|
|
1290
|
-
...
|
|
1312
|
+
d.ServerKeyExchange,
|
|
1313
|
+
...L(A.length),
|
|
1314
|
+
...A
|
|
1291
1315
|
]);
|
|
1292
1316
|
}
|
|
1293
1317
|
/**
|
|
@@ -1328,32 +1352,38 @@ class K {
|
|
|
1328
1352
|
* | Other Extensions... |
|
|
1329
1353
|
* +------------------------------------+
|
|
1330
1354
|
*/
|
|
1331
|
-
static serverHello(e, t,
|
|
1332
|
-
const
|
|
1333
|
-
switch (
|
|
1355
|
+
static serverHello(e, t, n) {
|
|
1356
|
+
const r = e.extensions.map((a) => {
|
|
1357
|
+
switch (a.type) {
|
|
1334
1358
|
case "server_name":
|
|
1335
|
-
return
|
|
1359
|
+
return ae.encodeForClient();
|
|
1360
|
+
case "ec_point_formats":
|
|
1361
|
+
return ce.encodeForClient(
|
|
1362
|
+
"uncompressed"
|
|
1363
|
+
);
|
|
1364
|
+
case "renegotiation_info":
|
|
1365
|
+
return Se.encodeForClient();
|
|
1336
1366
|
}
|
|
1337
|
-
}).filter((
|
|
1367
|
+
}).filter((a) => a !== void 0), s = u(r), _ = new Uint8Array([
|
|
1338
1368
|
// Version field – 0x03, 0x03 means TLS 1.2
|
|
1339
|
-
...
|
|
1369
|
+
...B,
|
|
1340
1370
|
...t,
|
|
1341
1371
|
e.session_id.length,
|
|
1342
1372
|
...e.session_id,
|
|
1343
|
-
...
|
|
1344
|
-
|
|
1373
|
+
...K(Ce.TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256),
|
|
1374
|
+
n,
|
|
1345
1375
|
// Extensions length (2 bytes)
|
|
1346
|
-
...
|
|
1376
|
+
...K(s.length),
|
|
1347
1377
|
...s
|
|
1348
1378
|
]);
|
|
1349
1379
|
return new Uint8Array([
|
|
1350
|
-
|
|
1351
|
-
...
|
|
1352
|
-
...
|
|
1380
|
+
d.ServerHello,
|
|
1381
|
+
...L(_.length),
|
|
1382
|
+
..._
|
|
1353
1383
|
]);
|
|
1354
1384
|
}
|
|
1355
1385
|
static serverHelloDone() {
|
|
1356
|
-
return new Uint8Array([
|
|
1386
|
+
return new Uint8Array([d.ServerHelloDone, ...L(0)]);
|
|
1357
1387
|
}
|
|
1358
1388
|
/**
|
|
1359
1389
|
* Server finished message.
|
|
@@ -1374,22 +1404,22 @@ class K {
|
|
|
1374
1404
|
* the string "server finished".
|
|
1375
1405
|
*/
|
|
1376
1406
|
static async createFinishedMessage(e, t) {
|
|
1377
|
-
const
|
|
1407
|
+
const n = await crypto.subtle.digest(
|
|
1378
1408
|
"SHA-256",
|
|
1379
1409
|
u(e)
|
|
1380
|
-
),
|
|
1410
|
+
), r = new Uint8Array(
|
|
1381
1411
|
await q(
|
|
1382
1412
|
t,
|
|
1383
1413
|
new TextEncoder().encode("server finished"),
|
|
1384
|
-
|
|
1414
|
+
n,
|
|
1385
1415
|
// verify_data length. TLS 1.2 specifies 12 bytes for verify_data
|
|
1386
1416
|
12
|
|
1387
1417
|
)
|
|
1388
1418
|
);
|
|
1389
1419
|
return new Uint8Array([
|
|
1390
|
-
|
|
1391
|
-
...
|
|
1392
|
-
...
|
|
1420
|
+
d.Finished,
|
|
1421
|
+
...L(r.length),
|
|
1422
|
+
...r
|
|
1393
1423
|
]);
|
|
1394
1424
|
}
|
|
1395
1425
|
static changeCipherSpec() {
|
|
@@ -1399,24 +1429,24 @@ class K {
|
|
|
1399
1429
|
function je(i, e) {
|
|
1400
1430
|
return Ge.generateCertificate(i, e);
|
|
1401
1431
|
}
|
|
1402
|
-
function
|
|
1432
|
+
function Ht(i) {
|
|
1403
1433
|
return `-----BEGIN CERTIFICATE-----
|
|
1404
|
-
${
|
|
1405
|
-
|
|
1434
|
+
${Ee(
|
|
1435
|
+
de(i.buffer)
|
|
1406
1436
|
)}
|
|
1407
1437
|
-----END CERTIFICATE-----`;
|
|
1408
1438
|
}
|
|
1409
|
-
async function
|
|
1439
|
+
async function dt(i) {
|
|
1410
1440
|
const e = await crypto.subtle.exportKey("pkcs8", i);
|
|
1411
1441
|
return `-----BEGIN PRIVATE KEY-----
|
|
1412
|
-
${
|
|
1413
|
-
|
|
1442
|
+
${Ee(
|
|
1443
|
+
de(e)
|
|
1414
1444
|
)}
|
|
1415
1445
|
-----END PRIVATE KEY-----`;
|
|
1416
1446
|
}
|
|
1417
1447
|
class Ge {
|
|
1418
1448
|
static async generateCertificate(e, t) {
|
|
1419
|
-
const
|
|
1449
|
+
const n = await crypto.subtle.generateKey(
|
|
1420
1450
|
{
|
|
1421
1451
|
name: "RSASSA-PKCS1-v1_5",
|
|
1422
1452
|
hash: "SHA-256",
|
|
@@ -1426,22 +1456,22 @@ class Ge {
|
|
|
1426
1456
|
!0,
|
|
1427
1457
|
// extractable
|
|
1428
1458
|
["sign", "verify"]
|
|
1429
|
-
),
|
|
1459
|
+
), r = await this.signingRequest(
|
|
1430
1460
|
e,
|
|
1431
|
-
|
|
1461
|
+
n.publicKey
|
|
1432
1462
|
), s = await this.sign(
|
|
1433
|
-
|
|
1434
|
-
(t == null ? void 0 : t.privateKey) ??
|
|
1463
|
+
r,
|
|
1464
|
+
(t == null ? void 0 : t.privateKey) ?? n.privateKey
|
|
1435
1465
|
);
|
|
1436
1466
|
return {
|
|
1437
|
-
keyPair:
|
|
1467
|
+
keyPair: n,
|
|
1438
1468
|
certificate: s,
|
|
1439
|
-
tbsCertificate:
|
|
1469
|
+
tbsCertificate: r,
|
|
1440
1470
|
tbsDescription: e
|
|
1441
1471
|
};
|
|
1442
1472
|
}
|
|
1443
1473
|
static async sign(e, t) {
|
|
1444
|
-
const
|
|
1474
|
+
const n = await crypto.subtle.sign(
|
|
1445
1475
|
{
|
|
1446
1476
|
name: "RSASSA-PKCS1-v1_5",
|
|
1447
1477
|
hash: "SHA-256"
|
|
@@ -1452,12 +1482,12 @@ class Ge {
|
|
|
1452
1482
|
return o.sequence([
|
|
1453
1483
|
new Uint8Array(e.buffer),
|
|
1454
1484
|
this.signatureAlgorithm("sha256WithRSAEncryption"),
|
|
1455
|
-
o.bitString(new Uint8Array(
|
|
1485
|
+
o.bitString(new Uint8Array(n))
|
|
1456
1486
|
]);
|
|
1457
1487
|
}
|
|
1458
1488
|
static async signingRequest(e, t) {
|
|
1459
|
-
const
|
|
1460
|
-
return e.keyUsage &&
|
|
1489
|
+
const n = [];
|
|
1490
|
+
return e.keyUsage && n.push(this.keyUsage(e.keyUsage)), e.extKeyUsage && n.push(this.extKeyUsage(e.extKeyUsage)), e.subjectAltNames && n.push(this.subjectAltName(e.subjectAltNames)), e.nsCertType && n.push(this.nsCertType(e.nsCertType)), e.basicConstraints && n.push(
|
|
1461
1491
|
this.basicConstraints(e.basicConstraints)
|
|
1462
1492
|
), o.sequence([
|
|
1463
1493
|
this.version(e.version),
|
|
@@ -1467,7 +1497,7 @@ class Ge {
|
|
|
1467
1497
|
this.validity(e.validity),
|
|
1468
1498
|
this.distinguishedName(e.subject),
|
|
1469
1499
|
await this.subjectPublicKeyInfo(t),
|
|
1470
|
-
this.extensions(
|
|
1500
|
+
this.extensions(n)
|
|
1471
1501
|
]);
|
|
1472
1502
|
}
|
|
1473
1503
|
static version(e = 2) {
|
|
@@ -1481,7 +1511,7 @@ class Ge {
|
|
|
1481
1511
|
}
|
|
1482
1512
|
static signatureAlgorithm(e = "sha256WithRSAEncryption") {
|
|
1483
1513
|
return o.sequence([
|
|
1484
|
-
o.objectIdentifier(
|
|
1514
|
+
o.objectIdentifier(p(e)),
|
|
1485
1515
|
o.null()
|
|
1486
1516
|
]);
|
|
1487
1517
|
}
|
|
@@ -1493,16 +1523,16 @@ class Ge {
|
|
|
1493
1523
|
}
|
|
1494
1524
|
static distinguishedName(e) {
|
|
1495
1525
|
const t = [];
|
|
1496
|
-
for (const [
|
|
1526
|
+
for (const [n, r] of Object.entries(e)) {
|
|
1497
1527
|
const s = [
|
|
1498
|
-
o.objectIdentifier(
|
|
1528
|
+
o.objectIdentifier(p(n))
|
|
1499
1529
|
];
|
|
1500
|
-
switch (
|
|
1530
|
+
switch (n) {
|
|
1501
1531
|
case "countryName":
|
|
1502
|
-
s.push(o.printableString(
|
|
1532
|
+
s.push(o.printableString(r));
|
|
1503
1533
|
break;
|
|
1504
1534
|
default:
|
|
1505
|
-
s.push(o.utf8String(
|
|
1535
|
+
s.push(o.utf8String(r));
|
|
1506
1536
|
}
|
|
1507
1537
|
t.push(o.set([o.sequence(s)]));
|
|
1508
1538
|
}
|
|
@@ -1511,13 +1541,13 @@ class Ge {
|
|
|
1511
1541
|
static validity(e) {
|
|
1512
1542
|
return o.sequence([
|
|
1513
1543
|
o.ASN1(
|
|
1514
|
-
|
|
1544
|
+
H.UTCTime,
|
|
1515
1545
|
new TextEncoder().encode(
|
|
1516
1546
|
ne((e == null ? void 0 : e.notBefore) ?? /* @__PURE__ */ new Date())
|
|
1517
1547
|
)
|
|
1518
1548
|
),
|
|
1519
1549
|
o.ASN1(
|
|
1520
|
-
|
|
1550
|
+
H.UTCTime,
|
|
1521
1551
|
new TextEncoder().encode(
|
|
1522
1552
|
ne(
|
|
1523
1553
|
(e == null ? void 0 : e.notAfter) ?? Ve(/* @__PURE__ */ new Date(), 10)
|
|
@@ -1530,18 +1560,18 @@ class Ge {
|
|
|
1530
1560
|
ca: e = !0,
|
|
1531
1561
|
pathLenConstraint: t = void 0
|
|
1532
1562
|
}) {
|
|
1533
|
-
const
|
|
1534
|
-
return t !== void 0 &&
|
|
1563
|
+
const n = [o.boolean(e)];
|
|
1564
|
+
return t !== void 0 && n.push(
|
|
1535
1565
|
o.integer(new Uint8Array([t]))
|
|
1536
1566
|
), o.sequence([
|
|
1537
|
-
o.objectIdentifier(
|
|
1538
|
-
o.octetString(o.sequence(
|
|
1567
|
+
o.objectIdentifier(p("basicConstraints")),
|
|
1568
|
+
o.octetString(o.sequence(n))
|
|
1539
1569
|
]);
|
|
1540
1570
|
}
|
|
1541
1571
|
static keyUsage(e) {
|
|
1542
1572
|
const t = new Uint8Array([0]);
|
|
1543
1573
|
return e != null && e.digitalSignature && (t[0] |= 1), e != null && e.nonRepudiation && (t[0] |= 2), e != null && e.keyEncipherment && (t[0] |= 4), e != null && e.dataEncipherment && (t[0] |= 8), e != null && e.keyAgreement && (t[0] |= 16), e != null && e.keyCertSign && (t[0] |= 32), e != null && e.cRLSign && (t[0] |= 64), e != null && e.encipherOnly && (t[0] |= 128), e != null && e.decipherOnly && (t[0] |= 64), o.sequence([
|
|
1544
|
-
o.objectIdentifier(
|
|
1574
|
+
o.objectIdentifier(p("keyUsage")),
|
|
1545
1575
|
o.boolean(!0),
|
|
1546
1576
|
// Critical
|
|
1547
1577
|
o.octetString(o.bitString(t))
|
|
@@ -1549,13 +1579,13 @@ class Ge {
|
|
|
1549
1579
|
}
|
|
1550
1580
|
static extKeyUsage(e = {}) {
|
|
1551
1581
|
return o.sequence([
|
|
1552
|
-
o.objectIdentifier(
|
|
1582
|
+
o.objectIdentifier(p("extKeyUsage")),
|
|
1553
1583
|
o.boolean(!0),
|
|
1554
1584
|
// Critical
|
|
1555
1585
|
o.octetString(
|
|
1556
1586
|
o.sequence(
|
|
1557
|
-
Object.entries(e).map(([t,
|
|
1558
|
-
|
|
1587
|
+
Object.entries(e).map(([t, n]) => n ? o.objectIdentifier(
|
|
1588
|
+
p(t)
|
|
1559
1589
|
) : o.null())
|
|
1560
1590
|
)
|
|
1561
1591
|
)
|
|
@@ -1564,25 +1594,25 @@ class Ge {
|
|
|
1564
1594
|
static nsCertType(e) {
|
|
1565
1595
|
const t = new Uint8Array([0]);
|
|
1566
1596
|
return e.client && (t[0] |= 1), e.server && (t[0] |= 2), e.email && (t[0] |= 4), e.objsign && (t[0] |= 8), e.sslCA && (t[0] |= 16), e.emailCA && (t[0] |= 32), e.objCA && (t[0] |= 64), o.sequence([
|
|
1567
|
-
o.objectIdentifier(
|
|
1597
|
+
o.objectIdentifier(p("nsCertType")),
|
|
1568
1598
|
o.octetString(t)
|
|
1569
1599
|
]);
|
|
1570
1600
|
}
|
|
1571
1601
|
static subjectAltName(e) {
|
|
1572
|
-
var s,
|
|
1573
|
-
const t = ((s = e.dnsNames) == null ? void 0 : s.map((
|
|
1574
|
-
const S = o.ia5String(
|
|
1602
|
+
var s, _;
|
|
1603
|
+
const t = ((s = e.dnsNames) == null ? void 0 : s.map((a) => {
|
|
1604
|
+
const S = o.ia5String(a);
|
|
1575
1605
|
return o.contextSpecific(2, S);
|
|
1576
|
-
})) || [],
|
|
1577
|
-
const S = o.ia5String(
|
|
1606
|
+
})) || [], n = ((_ = e.ipAddresses) == null ? void 0 : _.map((a) => {
|
|
1607
|
+
const S = o.ia5String(a);
|
|
1578
1608
|
return o.contextSpecific(7, S);
|
|
1579
|
-
})) || [],
|
|
1580
|
-
o.sequence([...t, ...
|
|
1609
|
+
})) || [], r = o.octetString(
|
|
1610
|
+
o.sequence([...t, ...n])
|
|
1581
1611
|
);
|
|
1582
1612
|
return o.sequence([
|
|
1583
|
-
o.objectIdentifier(
|
|
1613
|
+
o.objectIdentifier(p("subjectAltName")),
|
|
1584
1614
|
o.boolean(!0),
|
|
1585
|
-
|
|
1615
|
+
r
|
|
1586
1616
|
]);
|
|
1587
1617
|
}
|
|
1588
1618
|
}
|
|
@@ -1696,13 +1726,13 @@ const $e = {
|
|
|
1696
1726
|
"1.3.6.1.5.5.7.3.4": "emailProtection",
|
|
1697
1727
|
"1.3.6.1.5.5.7.3.8": "timeStamping"
|
|
1698
1728
|
};
|
|
1699
|
-
function
|
|
1729
|
+
function p(i) {
|
|
1700
1730
|
for (const [e, t] of Object.entries($e))
|
|
1701
1731
|
if (t === i)
|
|
1702
1732
|
return e;
|
|
1703
1733
|
throw new Error(`OID not found for name: ${i}`);
|
|
1704
1734
|
}
|
|
1705
|
-
const
|
|
1735
|
+
const te = 32, H = {
|
|
1706
1736
|
Boolean: 1,
|
|
1707
1737
|
Integer: 2,
|
|
1708
1738
|
BitString: 3,
|
|
@@ -1710,8 +1740,8 @@ const re = 32, d = {
|
|
|
1710
1740
|
Null: 5,
|
|
1711
1741
|
OID: 6,
|
|
1712
1742
|
Utf8String: 12,
|
|
1713
|
-
Sequence: 16 |
|
|
1714
|
-
Set: 17 |
|
|
1743
|
+
Sequence: 16 | te,
|
|
1744
|
+
Set: 17 | te,
|
|
1715
1745
|
PrintableString: 19,
|
|
1716
1746
|
IA5String: 22,
|
|
1717
1747
|
UTCTime: 23
|
|
@@ -1723,91 +1753,91 @@ class o {
|
|
|
1723
1753
|
return new Uint8Array([e]);
|
|
1724
1754
|
{
|
|
1725
1755
|
let t = e;
|
|
1726
|
-
const
|
|
1756
|
+
const n = [];
|
|
1727
1757
|
for (; t > 0; )
|
|
1728
|
-
|
|
1729
|
-
const
|
|
1730
|
-
s[0] = 128 |
|
|
1731
|
-
for (let
|
|
1732
|
-
s[
|
|
1758
|
+
n.unshift(t & 255), t >>= 8;
|
|
1759
|
+
const r = n.length, s = new Uint8Array(1 + r);
|
|
1760
|
+
s[0] = 128 | r;
|
|
1761
|
+
for (let _ = 0; _ < r; _++)
|
|
1762
|
+
s[_ + 1] = n[_];
|
|
1733
1763
|
return s;
|
|
1734
1764
|
}
|
|
1735
1765
|
}
|
|
1736
1766
|
static ASN1(e, t) {
|
|
1737
|
-
const
|
|
1738
|
-
return
|
|
1767
|
+
const n = o.length_(t.length), r = new Uint8Array(1 + n.length + t.length);
|
|
1768
|
+
return r[0] = e, r.set(n, 1), r.set(t, 1 + n.length), r;
|
|
1739
1769
|
}
|
|
1740
1770
|
static integer(e) {
|
|
1741
1771
|
if (e[0] > 127) {
|
|
1742
1772
|
const t = new Uint8Array(e.length + 1);
|
|
1743
1773
|
t[0] = 0, t.set(e, 1), e = t;
|
|
1744
1774
|
}
|
|
1745
|
-
return o.ASN1(
|
|
1775
|
+
return o.ASN1(H.Integer, e);
|
|
1746
1776
|
}
|
|
1747
1777
|
static bitString(e) {
|
|
1748
|
-
const t = new Uint8Array([0]),
|
|
1749
|
-
return
|
|
1778
|
+
const t = new Uint8Array([0]), n = new Uint8Array(t.length + e.length);
|
|
1779
|
+
return n.set(t), n.set(e, t.length), o.ASN1(H.BitString, n);
|
|
1750
1780
|
}
|
|
1751
1781
|
static octetString(e) {
|
|
1752
|
-
return o.ASN1(
|
|
1782
|
+
return o.ASN1(H.OctetString, e);
|
|
1753
1783
|
}
|
|
1754
1784
|
static null() {
|
|
1755
|
-
return o.ASN1(
|
|
1785
|
+
return o.ASN1(H.Null, new Uint8Array(0));
|
|
1756
1786
|
}
|
|
1757
1787
|
static objectIdentifier(e) {
|
|
1758
|
-
const t = e.split(".").map(Number),
|
|
1788
|
+
const t = e.split(".").map(Number), r = [t[0] * 40 + t[1]];
|
|
1759
1789
|
for (let s = 2; s < t.length; s++) {
|
|
1760
|
-
let
|
|
1761
|
-
const
|
|
1790
|
+
let _ = t[s];
|
|
1791
|
+
const a = [];
|
|
1762
1792
|
do
|
|
1763
|
-
|
|
1764
|
-
while (
|
|
1765
|
-
for (let S = 0; S <
|
|
1766
|
-
|
|
1767
|
-
|
|
1793
|
+
a.unshift(_ & 127), _ >>= 7;
|
|
1794
|
+
while (_ > 0);
|
|
1795
|
+
for (let S = 0; S < a.length - 1; S++)
|
|
1796
|
+
a[S] |= 128;
|
|
1797
|
+
r.push(...a);
|
|
1768
1798
|
}
|
|
1769
|
-
return o.ASN1(
|
|
1799
|
+
return o.ASN1(H.OID, new Uint8Array(r));
|
|
1770
1800
|
}
|
|
1771
1801
|
static utf8String(e) {
|
|
1772
1802
|
const t = new TextEncoder().encode(e);
|
|
1773
|
-
return o.ASN1(
|
|
1803
|
+
return o.ASN1(H.Utf8String, t);
|
|
1774
1804
|
}
|
|
1775
1805
|
static printableString(e) {
|
|
1776
1806
|
const t = new TextEncoder().encode(e);
|
|
1777
|
-
return o.ASN1(
|
|
1807
|
+
return o.ASN1(H.PrintableString, t);
|
|
1778
1808
|
}
|
|
1779
1809
|
static sequence(e) {
|
|
1780
|
-
return o.ASN1(
|
|
1810
|
+
return o.ASN1(H.Sequence, u(e));
|
|
1781
1811
|
}
|
|
1782
1812
|
static set(e) {
|
|
1783
|
-
return o.ASN1(
|
|
1813
|
+
return o.ASN1(H.Set, u(e));
|
|
1784
1814
|
}
|
|
1785
1815
|
static ia5String(e) {
|
|
1786
1816
|
const t = new TextEncoder().encode(e);
|
|
1787
|
-
return o.ASN1(
|
|
1817
|
+
return o.ASN1(H.IA5String, t);
|
|
1788
1818
|
}
|
|
1789
|
-
static contextSpecific(e, t,
|
|
1790
|
-
const
|
|
1791
|
-
return o.ASN1(
|
|
1819
|
+
static contextSpecific(e, t, n = !1) {
|
|
1820
|
+
const r = (n ? 160 : 128) | e;
|
|
1821
|
+
return o.ASN1(r, t);
|
|
1792
1822
|
}
|
|
1793
1823
|
static boolean(e) {
|
|
1794
1824
|
return o.ASN1(
|
|
1795
|
-
|
|
1825
|
+
H.Boolean,
|
|
1796
1826
|
new Uint8Array([e ? 255 : 0])
|
|
1797
1827
|
);
|
|
1798
1828
|
}
|
|
1799
1829
|
}
|
|
1800
|
-
function
|
|
1830
|
+
function de(i) {
|
|
1801
1831
|
return btoa(String.fromCodePoint(...new Uint8Array(i)));
|
|
1802
1832
|
}
|
|
1803
|
-
function
|
|
1833
|
+
function Ee(i) {
|
|
1804
1834
|
var e;
|
|
1805
1835
|
return ((e = i.match(/.{1,64}/g)) == null ? void 0 : e.join(`
|
|
1806
1836
|
`)) || i;
|
|
1807
1837
|
}
|
|
1808
1838
|
function ne(i) {
|
|
1809
|
-
const e = i.getUTCFullYear().toString().substr(2), t = b(i.getUTCMonth() + 1),
|
|
1810
|
-
return `${e}${t}${
|
|
1839
|
+
const e = i.getUTCFullYear().toString().substr(2), t = b(i.getUTCMonth() + 1), n = b(i.getUTCDate()), r = b(i.getUTCHours()), s = b(i.getUTCMinutes()), _ = b(i.getUTCSeconds());
|
|
1840
|
+
return `${e}${t}${n}${r}${s}${_}Z`;
|
|
1811
1841
|
}
|
|
1812
1842
|
function b(i) {
|
|
1813
1843
|
return i.toString().padStart(2, "0");
|
|
@@ -1816,85 +1846,46 @@ function Ve(i, e) {
|
|
|
1816
1846
|
const t = new Date(i);
|
|
1817
1847
|
return t.setUTCFullYear(t.getUTCFullYear() + e), t;
|
|
1818
1848
|
}
|
|
1819
|
-
class ze extends
|
|
1820
|
-
constructor(e, t, r) {
|
|
1821
|
-
super(
|
|
1822
|
-
`Could not fetch ${e} – your network appears to be blocking this request (HTTP ${t}). This often happens on school, university, or corporate networks. Try switching to a different network or using a VPN.`
|
|
1823
|
-
), this.name = "FirewallInterferenceError", this.url = e, this.status = t, this.statusText = r;
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
const Ye = "X-Playground-Cors-Proxy";
|
|
1827
|
-
async function Xe(i, e, t, r) {
|
|
1828
|
-
var c;
|
|
1829
|
-
let n = typeof i == "string" ? new Request(i, e) : i;
|
|
1830
|
-
const s = r ? new URL(r) : null;
|
|
1831
|
-
let a = s ? new URL(n.url, s) : new URL(n.url);
|
|
1832
|
-
if (a.protocol === "http:") {
|
|
1833
|
-
a.protocol = "https:";
|
|
1834
|
-
const h = a.toString();
|
|
1835
|
-
n = await $(n, { url: h }), a = new URL(h);
|
|
1836
|
-
}
|
|
1837
|
-
if (!t)
|
|
1838
|
-
return await fetch(n);
|
|
1839
|
-
if (s && a.protocol === s.protocol && a.hostname === s.hostname && a.port === s.port && a.pathname.startsWith(s.pathname))
|
|
1840
|
-
return await fetch(n);
|
|
1841
|
-
const [_, S] = await me(n);
|
|
1842
|
-
try {
|
|
1843
|
-
return await fetch(_);
|
|
1844
|
-
} catch {
|
|
1845
|
-
const l = ((c = new Headers(S.headers).get("x-cors-proxy-allowed-request-headers")) == null ? void 0 : c.split(",")) || [], A = l.includes("authorization") || l.includes("cookie"), H = await $(S, {
|
|
1846
|
-
url: `${t}${n.url}`,
|
|
1847
|
-
...A && { credentials: "include" }
|
|
1848
|
-
}), p = await fetch(H, e);
|
|
1849
|
-
if (!p.headers.has(Ye))
|
|
1850
|
-
throw new ze(
|
|
1851
|
-
n.url,
|
|
1852
|
-
p.status,
|
|
1853
|
-
p.statusText
|
|
1854
|
-
);
|
|
1855
|
-
return p;
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
class Ze extends TransformStream {
|
|
1849
|
+
class ze extends TransformStream {
|
|
1859
1850
|
constructor() {
|
|
1860
|
-
let e = new Uint8Array(0), t = "SCAN_CHUNK_SIZE",
|
|
1851
|
+
let e = new Uint8Array(0), t = "SCAN_CHUNK_SIZE", n = 0;
|
|
1861
1852
|
super({
|
|
1862
|
-
transform(
|
|
1863
|
-
for (e = u([e,
|
|
1853
|
+
transform(r, s) {
|
|
1854
|
+
for (e = u([e, r]); e.length > 0; )
|
|
1864
1855
|
if (t === "SCAN_CHUNK_SIZE") {
|
|
1865
1856
|
if (e.length < 3)
|
|
1866
1857
|
return;
|
|
1867
|
-
let
|
|
1868
|
-
for (;
|
|
1869
|
-
const c = e[
|
|
1858
|
+
let _ = 0;
|
|
1859
|
+
for (; _ < e.length; ) {
|
|
1860
|
+
const c = e[_];
|
|
1870
1861
|
if (!(c >= 48 && c <= 57 || // 0-9
|
|
1871
1862
|
c >= 97 && c <= 102 || // a-f
|
|
1872
1863
|
c >= 65 && c <= 70)) break;
|
|
1873
|
-
|
|
1864
|
+
_++;
|
|
1874
1865
|
}
|
|
1875
|
-
if (
|
|
1866
|
+
if (_ === 0)
|
|
1876
1867
|
throw new Error("Invalid chunk size format");
|
|
1877
|
-
if (e.length <
|
|
1868
|
+
if (e.length < _ + 2)
|
|
1878
1869
|
return;
|
|
1879
|
-
if (e[
|
|
1880
|
-
e[
|
|
1870
|
+
if (e[_] !== 13 || // \r
|
|
1871
|
+
e[_ + 1] !== 10)
|
|
1881
1872
|
throw new Error(
|
|
1882
1873
|
"Invalid chunk size format. Expected CRLF after chunk size"
|
|
1883
1874
|
);
|
|
1884
|
-
const
|
|
1885
|
-
e.slice(0,
|
|
1886
|
-
), S = parseInt(
|
|
1887
|
-
if (e = e.slice(
|
|
1875
|
+
const a = new TextDecoder().decode(
|
|
1876
|
+
e.slice(0, _)
|
|
1877
|
+
), S = parseInt(a, 16);
|
|
1878
|
+
if (e = e.slice(_ + 2), S === 0) {
|
|
1888
1879
|
t = "SCAN_FINAL_CHUNK", s.terminate();
|
|
1889
1880
|
return;
|
|
1890
1881
|
}
|
|
1891
|
-
|
|
1882
|
+
n = S, t = "SCAN_CHUNK_DATA";
|
|
1892
1883
|
} else if (t === "SCAN_CHUNK_DATA") {
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1884
|
+
const _ = Math.min(
|
|
1885
|
+
n,
|
|
1895
1886
|
e.length
|
|
1896
|
-
),
|
|
1897
|
-
e = e.slice(
|
|
1887
|
+
), a = e.slice(0, _);
|
|
1888
|
+
e = e.slice(_), n -= _, s.enqueue(a), n === 0 && (t = "SCAN_CHUNK_TRAILER");
|
|
1898
1889
|
} else if (t === "SCAN_CHUNK_TRAILER") {
|
|
1899
1890
|
if (e.length < 2)
|
|
1900
1891
|
return;
|
|
@@ -1908,17 +1899,17 @@ class Ze extends TransformStream {
|
|
|
1908
1899
|
});
|
|
1909
1900
|
}
|
|
1910
1901
|
}
|
|
1911
|
-
const
|
|
1902
|
+
const Ye = (i, e) => ({
|
|
1912
1903
|
...i,
|
|
1913
1904
|
websocket: {
|
|
1914
|
-
url: (t,
|
|
1915
|
-
host:
|
|
1916
|
-
port:
|
|
1905
|
+
url: (t, n, r) => `ws://playground.internal/?${new URLSearchParams({
|
|
1906
|
+
host: n,
|
|
1907
|
+
port: r
|
|
1917
1908
|
}).toString()}`,
|
|
1918
1909
|
subprotocol: "binary",
|
|
1919
|
-
decorator: () => class extends
|
|
1920
|
-
constructor(t,
|
|
1921
|
-
super(t,
|
|
1910
|
+
decorator: () => class extends Ze {
|
|
1911
|
+
constructor(t, n) {
|
|
1912
|
+
super(t, n, {
|
|
1922
1913
|
CAroot: e.CAroot,
|
|
1923
1914
|
corsProxyUrl: e.corsProxyUrl
|
|
1924
1915
|
});
|
|
@@ -1926,18 +1917,18 @@ const Je = (i, e) => ({
|
|
|
1926
1917
|
}
|
|
1927
1918
|
}
|
|
1928
1919
|
});
|
|
1929
|
-
class
|
|
1920
|
+
class Ze {
|
|
1930
1921
|
constructor(e, t, {
|
|
1931
|
-
CAroot:
|
|
1932
|
-
corsProxyUrl:
|
|
1922
|
+
CAroot: n,
|
|
1923
|
+
corsProxyUrl: r,
|
|
1933
1924
|
outputType: s = "messages"
|
|
1934
1925
|
} = {}) {
|
|
1935
1926
|
this.CONNECTING = 0, this.OPEN = 1, this.CLOSING = 2, this.CLOSED = 3, this.readyState = this.CONNECTING, this.binaryType = "blob", this.bufferedAmount = 0, this.extensions = "", this.protocol = "ws", this.host = "", this.port = 0, this.listeners = /* @__PURE__ */ new Map(), this.clientUpstream = new TransformStream(), this.clientUpstreamWriter = this.clientUpstream.writable.getWriter(), this.clientDownstream = new TransformStream(), this.fetchInitiated = !1, this.bufferedBytesFromClient = new Uint8Array(0), this.url = e, this.options = t;
|
|
1936
|
-
const
|
|
1937
|
-
this.host =
|
|
1927
|
+
const _ = new URL(e);
|
|
1928
|
+
this.host = _.searchParams.get("host"), this.port = parseInt(_.searchParams.get("port"), 10), this.binaryType = "arraybuffer", this.corsProxyUrl = r, this.CAroot = n, s === "messages" && this.clientDownstream.readable.pipeTo(
|
|
1938
1929
|
new WritableStream({
|
|
1939
|
-
write: (
|
|
1940
|
-
this.emit("message", { data:
|
|
1930
|
+
write: (a) => {
|
|
1931
|
+
this.emit("message", { data: a });
|
|
1941
1932
|
},
|
|
1942
1933
|
abort: () => {
|
|
1943
1934
|
this.emit("error", new Error("ECONNREFUSED")), this.close();
|
|
@@ -1953,10 +1944,10 @@ class Qe {
|
|
|
1953
1944
|
this.addEventListener(e, t);
|
|
1954
1945
|
}
|
|
1955
1946
|
once(e, t) {
|
|
1956
|
-
const
|
|
1957
|
-
t(
|
|
1947
|
+
const n = (r) => {
|
|
1948
|
+
t(r), this.removeEventListener(e, n);
|
|
1958
1949
|
};
|
|
1959
|
-
this.addEventListener(e,
|
|
1950
|
+
this.addEventListener(e, n);
|
|
1960
1951
|
}
|
|
1961
1952
|
addEventListener(e, t) {
|
|
1962
1953
|
this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t);
|
|
@@ -1965,15 +1956,15 @@ class Qe {
|
|
|
1965
1956
|
this.removeEventListener(e, t);
|
|
1966
1957
|
}
|
|
1967
1958
|
removeEventListener(e, t) {
|
|
1968
|
-
const
|
|
1969
|
-
|
|
1959
|
+
const n = this.listeners.get(e);
|
|
1960
|
+
n && n.delete(t);
|
|
1970
1961
|
}
|
|
1971
1962
|
emit(e, t = {}) {
|
|
1972
1963
|
e === "message" ? this.onmessage(t) : e === "close" ? this.onclose(t) : e === "error" ? this.onerror(t) : e === "open" && this.onopen(t);
|
|
1973
|
-
const
|
|
1974
|
-
if (
|
|
1975
|
-
for (const
|
|
1976
|
-
|
|
1964
|
+
const n = this.listeners.get(e);
|
|
1965
|
+
if (n)
|
|
1966
|
+
for (const r of n)
|
|
1967
|
+
r(t);
|
|
1977
1968
|
}
|
|
1978
1969
|
// Default event handlers that can be overridden by the user
|
|
1979
1970
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -1997,7 +1988,7 @@ class Qe {
|
|
|
1997
1988
|
switch (this.bufferedBytesFromClient = u([
|
|
1998
1989
|
this.bufferedBytesFromClient,
|
|
1999
1990
|
new Uint8Array(e)
|
|
2000
|
-
]),
|
|
1991
|
+
]), Xe(this.port, this.bufferedBytesFromClient)) {
|
|
2001
1992
|
case !1:
|
|
2002
1993
|
return;
|
|
2003
1994
|
case "other":
|
|
@@ -2026,34 +2017,34 @@ class Qe {
|
|
|
2026
2017
|
issuer: this.CAroot.tbsDescription.subject
|
|
2027
2018
|
},
|
|
2028
2019
|
this.CAroot.keyPair
|
|
2029
|
-
), t = new
|
|
2020
|
+
), t = new qe();
|
|
2030
2021
|
this.clientUpstream.readable.pipeTo(t.clientEnd.upstream.writable).catch(() => {
|
|
2031
2022
|
}), t.clientEnd.downstream.readable.pipeTo(this.clientDownstream.writable).catch(() => {
|
|
2032
2023
|
}), await t.TLSHandshake(e.keyPair.privateKey, [
|
|
2033
2024
|
e.certificate,
|
|
2034
2025
|
this.CAroot.certificate
|
|
2035
2026
|
]);
|
|
2036
|
-
const
|
|
2027
|
+
const n = await y.parseHttpRequest(
|
|
2037
2028
|
t.serverEnd.upstream.readable,
|
|
2038
2029
|
this.host,
|
|
2039
2030
|
"https"
|
|
2040
2031
|
);
|
|
2041
2032
|
try {
|
|
2042
|
-
await
|
|
2043
|
-
|
|
2033
|
+
await y.fetchRawResponseBytes(
|
|
2034
|
+
n,
|
|
2044
2035
|
this.corsProxyUrl
|
|
2045
2036
|
).pipeTo(t.serverEnd.downstream.writable);
|
|
2046
2037
|
} catch {
|
|
2047
2038
|
}
|
|
2048
2039
|
}
|
|
2049
2040
|
async fetchOverHTTP() {
|
|
2050
|
-
const e = await
|
|
2041
|
+
const e = await y.parseHttpRequest(
|
|
2051
2042
|
this.clientUpstream.readable,
|
|
2052
2043
|
this.host,
|
|
2053
2044
|
"http"
|
|
2054
2045
|
);
|
|
2055
2046
|
try {
|
|
2056
|
-
await
|
|
2047
|
+
await y.fetchRawResponseBytes(
|
|
2057
2048
|
e,
|
|
2058
2049
|
this.corsProxyUrl
|
|
2059
2050
|
).pipeTo(this.clientDownstream.writable);
|
|
@@ -2064,7 +2055,7 @@ class Qe {
|
|
|
2064
2055
|
this.emit("message", { data: new Uint8Array(0) }), this.readyState = this.CLOSING, this.emit("close"), this.readyState = this.CLOSED;
|
|
2065
2056
|
}
|
|
2066
2057
|
}
|
|
2067
|
-
const
|
|
2058
|
+
const Je = [
|
|
2068
2059
|
"GET",
|
|
2069
2060
|
"POST",
|
|
2070
2061
|
"HEAD",
|
|
@@ -2074,62 +2065,62 @@ const et = [
|
|
|
2074
2065
|
"PUT",
|
|
2075
2066
|
"TRACE"
|
|
2076
2067
|
];
|
|
2077
|
-
function
|
|
2068
|
+
function Xe(i, e) {
|
|
2078
2069
|
if (e.length < 8)
|
|
2079
2070
|
return !1;
|
|
2080
2071
|
if (i === 443 && e[0] === C.Handshake && // TLS versions between 1.0 and 1.2
|
|
2081
2072
|
e[1] === 3 && e[2] >= 1 && e[2] <= 3)
|
|
2082
2073
|
return "tls";
|
|
2083
|
-
const
|
|
2074
|
+
const n = new TextDecoder("latin1", {
|
|
2084
2075
|
fatal: !0
|
|
2085
2076
|
}).decode(e);
|
|
2086
|
-
return
|
|
2087
|
-
(s) =>
|
|
2077
|
+
return Je.some(
|
|
2078
|
+
(s) => n.startsWith(s + " ")
|
|
2088
2079
|
) ? "http" : "other";
|
|
2089
2080
|
}
|
|
2090
|
-
class
|
|
2081
|
+
class y {
|
|
2091
2082
|
/**
|
|
2092
2083
|
* Streams a HTTP response including the status line and headers.
|
|
2093
2084
|
*/
|
|
2094
2085
|
static fetchRawResponseBytes(e, t) {
|
|
2095
2086
|
return new ReadableStream({
|
|
2096
|
-
async start(
|
|
2097
|
-
var
|
|
2098
|
-
let
|
|
2087
|
+
async start(n) {
|
|
2088
|
+
var a;
|
|
2089
|
+
let r;
|
|
2099
2090
|
try {
|
|
2100
|
-
|
|
2091
|
+
r = await Ke(
|
|
2101
2092
|
e,
|
|
2102
2093
|
void 0,
|
|
2103
2094
|
t
|
|
2104
2095
|
);
|
|
2105
2096
|
} catch (S) {
|
|
2106
|
-
|
|
2097
|
+
n.enqueue(
|
|
2107
2098
|
new TextEncoder().encode(
|
|
2108
2099
|
`HTTP/1.1 400 Bad Request\r
|
|
2109
2100
|
Content-Length: 0\r
|
|
2110
2101
|
\r
|
|
2111
2102
|
`
|
|
2112
2103
|
)
|
|
2113
|
-
),
|
|
2104
|
+
), n.error(S);
|
|
2114
2105
|
return;
|
|
2115
2106
|
}
|
|
2116
|
-
|
|
2117
|
-
const s = (
|
|
2107
|
+
n.enqueue(y.headersAsBytes(r));
|
|
2108
|
+
const s = (a = r.body) == null ? void 0 : a.getReader();
|
|
2118
2109
|
if (!s) {
|
|
2119
|
-
|
|
2110
|
+
n.close();
|
|
2120
2111
|
return;
|
|
2121
2112
|
}
|
|
2122
|
-
const
|
|
2113
|
+
const _ = new TextEncoder();
|
|
2123
2114
|
for (; ; ) {
|
|
2124
2115
|
const { done: S, value: c } = await s.read();
|
|
2125
|
-
if (c && (
|
|
2126
|
-
|
|
2116
|
+
if (c && (n.enqueue(
|
|
2117
|
+
_.encode(`${c.length.toString(16)}\r
|
|
2127
2118
|
`)
|
|
2128
|
-
),
|
|
2119
|
+
), n.enqueue(c), n.enqueue(_.encode(`\r
|
|
2129
2120
|
`))), S) {
|
|
2130
|
-
|
|
2121
|
+
n.enqueue(_.encode(`0\r
|
|
2131
2122
|
\r
|
|
2132
|
-
`)),
|
|
2123
|
+
`)), n.close();
|
|
2133
2124
|
return;
|
|
2134
2125
|
}
|
|
2135
2126
|
}
|
|
@@ -2137,14 +2128,14 @@ Content-Length: 0\r
|
|
|
2137
2128
|
});
|
|
2138
2129
|
}
|
|
2139
2130
|
static headersAsBytes(e) {
|
|
2140
|
-
const t = `HTTP/1.1 ${e.status} ${e.statusText}`,
|
|
2141
|
-
e.headers.forEach((
|
|
2142
|
-
|
|
2143
|
-
}), delete
|
|
2144
|
-
const
|
|
2145
|
-
for (const [
|
|
2146
|
-
|
|
2147
|
-
const s = [t, ...
|
|
2131
|
+
const t = `HTTP/1.1 ${e.status} ${e.statusText}`, n = {};
|
|
2132
|
+
e.headers.forEach((_, a) => {
|
|
2133
|
+
n[a.toLowerCase()] = _;
|
|
2134
|
+
}), delete n["content-length"], n["transfer-encoding"] = "chunked";
|
|
2135
|
+
const r = [];
|
|
2136
|
+
for (const [_, a] of Object.entries(n))
|
|
2137
|
+
r.push(`${_}: ${a}`);
|
|
2138
|
+
const s = [t, ...r].join(`\r
|
|
2148
2139
|
`) + `\r
|
|
2149
2140
|
\r
|
|
2150
2141
|
`;
|
|
@@ -2154,57 +2145,57 @@ Content-Length: 0\r
|
|
|
2154
2145
|
* Parses a raw, streamed HTTP request into a Request object
|
|
2155
2146
|
* with known headers and a readable body stream.
|
|
2156
2147
|
*/
|
|
2157
|
-
static async parseHttpRequest(e, t,
|
|
2158
|
-
let
|
|
2159
|
-
const
|
|
2160
|
-
for (;
|
|
2161
|
-
const { done: x, value:
|
|
2148
|
+
static async parseHttpRequest(e, t, n) {
|
|
2149
|
+
let r = new Uint8Array(0), s = !1, _ = -1;
|
|
2150
|
+
const a = e.getReader();
|
|
2151
|
+
for (; _ === -1; ) {
|
|
2152
|
+
const { done: x, value: P } = await a.read();
|
|
2162
2153
|
if (x) {
|
|
2163
2154
|
s = !0;
|
|
2164
2155
|
break;
|
|
2165
2156
|
}
|
|
2166
|
-
|
|
2167
|
-
|
|
2157
|
+
r = u([r, P]), _ = Qe(
|
|
2158
|
+
r,
|
|
2168
2159
|
new Uint8Array([13, 10, 13, 10])
|
|
2169
2160
|
);
|
|
2170
2161
|
}
|
|
2171
|
-
|
|
2172
|
-
const S =
|
|
2173
|
-
|
|
2162
|
+
a.releaseLock();
|
|
2163
|
+
const S = r.slice(0, _), c = y.parseRequestHeaders(S), A = c.headers.get("Transfer-Encoding") !== null ? "chunked" : "content-length", h = c.headers.get("Content-Length") !== null ? parseInt(c.headers.get("Content-Length"), 10) : void 0, l = r.slice(
|
|
2164
|
+
_ + 4
|
|
2174
2165
|
/* Skip \r\n\r\n */
|
|
2175
2166
|
);
|
|
2176
|
-
let
|
|
2167
|
+
let E;
|
|
2177
2168
|
if (c.method !== "GET") {
|
|
2178
2169
|
const x = e.getReader();
|
|
2179
|
-
let
|
|
2180
|
-
const
|
|
2170
|
+
let P = l.length, N = l.slice(-6);
|
|
2171
|
+
const pe = new TextEncoder().encode(`0\r
|
|
2181
2172
|
\r
|
|
2182
2173
|
`);
|
|
2183
|
-
|
|
2174
|
+
E = new ReadableStream({
|
|
2184
2175
|
async start(W) {
|
|
2185
|
-
|
|
2176
|
+
l.length > 0 && W.enqueue(l), s && W.close();
|
|
2186
2177
|
},
|
|
2187
2178
|
async pull(W) {
|
|
2188
|
-
const { done:
|
|
2189
|
-
if (
|
|
2179
|
+
const { done: we, value: g } = await x.read();
|
|
2180
|
+
if (P += (g == null ? void 0 : g.length) || 0, g && (W.enqueue(g), N = u([
|
|
2190
2181
|
N,
|
|
2191
|
-
|
|
2192
|
-
]).slice(-5)),
|
|
2193
|
-
(
|
|
2182
|
+
g || new Uint8Array()
|
|
2183
|
+
]).slice(-5)), we || A === "content-length" && h !== void 0 && P >= h || A === "chunked" && N.every(
|
|
2184
|
+
(Le, ye) => Le === pe[ye]
|
|
2194
2185
|
)) {
|
|
2195
2186
|
W.close();
|
|
2196
2187
|
return;
|
|
2197
2188
|
}
|
|
2198
2189
|
}
|
|
2199
|
-
}),
|
|
2200
|
-
new
|
|
2190
|
+
}), A === "chunked" && (E = E.pipeThrough(
|
|
2191
|
+
new ze()
|
|
2201
2192
|
));
|
|
2202
2193
|
}
|
|
2203
|
-
const
|
|
2204
|
-
return new Request(
|
|
2194
|
+
const v = c.headers.get("Host") ?? t, fe = new URL(c.path, n + "://" + v);
|
|
2195
|
+
return new Request(fe.toString(), {
|
|
2205
2196
|
method: c.method,
|
|
2206
2197
|
headers: c.headers,
|
|
2207
|
-
body:
|
|
2198
|
+
body: E,
|
|
2208
2199
|
// In Node.js, duplex: 'half' is required when
|
|
2209
2200
|
// the body stream is provided.
|
|
2210
2201
|
// @ts-expect-error
|
|
@@ -2212,33 +2203,33 @@ Content-Length: 0\r
|
|
|
2212
2203
|
});
|
|
2213
2204
|
}
|
|
2214
2205
|
static parseRequestHeaders(e) {
|
|
2215
|
-
const t = new TextDecoder().decode(e),
|
|
2216
|
-
`)[0], [
|
|
2217
|
-
for (const
|
|
2206
|
+
const t = new TextDecoder().decode(e), n = t.split(`
|
|
2207
|
+
`)[0], [r, s] = n.split(" "), _ = new Headers();
|
|
2208
|
+
for (const a of t.split(`\r
|
|
2218
2209
|
`).slice(1)) {
|
|
2219
|
-
if (
|
|
2210
|
+
if (a === "")
|
|
2220
2211
|
break;
|
|
2221
|
-
const [S, c] =
|
|
2222
|
-
|
|
2212
|
+
const [S, c] = a.split(": ");
|
|
2213
|
+
_.set(S, c);
|
|
2223
2214
|
}
|
|
2224
|
-
return { method:
|
|
2215
|
+
return { method: r, path: s, headers: _ };
|
|
2225
2216
|
}
|
|
2226
2217
|
}
|
|
2227
|
-
function
|
|
2228
|
-
const t = i.length,
|
|
2229
|
-
for (let s = 0; s <=
|
|
2230
|
-
let
|
|
2231
|
-
for (let
|
|
2232
|
-
if (i[s +
|
|
2233
|
-
|
|
2218
|
+
function Qe(i, e) {
|
|
2219
|
+
const t = i.length, n = e.length, r = t - n;
|
|
2220
|
+
for (let s = 0; s <= r; s++) {
|
|
2221
|
+
let _ = !0;
|
|
2222
|
+
for (let a = 0; a < n; a++)
|
|
2223
|
+
if (i[s + a] !== e[a]) {
|
|
2224
|
+
_ = !1;
|
|
2234
2225
|
break;
|
|
2235
2226
|
}
|
|
2236
|
-
if (
|
|
2227
|
+
if (_)
|
|
2237
2228
|
return s;
|
|
2238
2229
|
}
|
|
2239
2230
|
return -1;
|
|
2240
2231
|
}
|
|
2241
|
-
async function
|
|
2232
|
+
async function et(i = j) {
|
|
2242
2233
|
switch (i) {
|
|
2243
2234
|
case "8.5":
|
|
2244
2235
|
return (await import("@php-wasm/web-8-5")).getIntlExtensionPath();
|
|
@@ -2257,10 +2248,10 @@ async function nt(i = O) {
|
|
|
2257
2248
|
}
|
|
2258
2249
|
throw new Error(`Unsupported PHP version ${i}`);
|
|
2259
2250
|
}
|
|
2260
|
-
async function
|
|
2261
|
-
const t =
|
|
2251
|
+
async function tt(i = j, e) {
|
|
2252
|
+
const t = De(fetch), n = "intl.so", r = "icu.dat", s = await et(i), _ = (await import("./shared/icu.dat")).default, [a, S] = await Promise.all([
|
|
2262
2253
|
t(s).then((c) => c.arrayBuffer()),
|
|
2263
|
-
t(
|
|
2254
|
+
t(_).then((c) => c.arrayBuffer())
|
|
2264
2255
|
]);
|
|
2265
2256
|
return {
|
|
2266
2257
|
...e,
|
|
@@ -2270,27 +2261,27 @@ async function st(i = O, e) {
|
|
|
2270
2261
|
ICU_DATA: "/internal/shared"
|
|
2271
2262
|
},
|
|
2272
2263
|
onRuntimeInitialized: (c) => {
|
|
2273
|
-
e.onRuntimeInitialized && e.onRuntimeInitialized(c),
|
|
2264
|
+
e.onRuntimeInitialized && e.onRuntimeInitialized(c), w.fileExists(
|
|
2274
2265
|
c.FS,
|
|
2275
2266
|
"/internal/shared/extensions"
|
|
2276
|
-
) || c.FS.mkdirTree("/internal/shared/extensions"),
|
|
2267
|
+
) || c.FS.mkdirTree("/internal/shared/extensions"), w.fileExists(
|
|
2277
2268
|
c.FS,
|
|
2278
|
-
`/internal/shared/extensions/${
|
|
2269
|
+
`/internal/shared/extensions/${n}`
|
|
2279
2270
|
) || c.FS.writeFile(
|
|
2280
|
-
`/internal/shared/extensions/${
|
|
2281
|
-
new Uint8Array(
|
|
2282
|
-
),
|
|
2271
|
+
`/internal/shared/extensions/${n}`,
|
|
2272
|
+
new Uint8Array(a)
|
|
2273
|
+
), w.fileExists(
|
|
2283
2274
|
c.FS,
|
|
2284
2275
|
"/internal/shared/extensions/intl.ini"
|
|
2285
2276
|
) || c.FS.writeFile(
|
|
2286
2277
|
"/internal/shared/extensions/intl.ini",
|
|
2287
2278
|
[
|
|
2288
|
-
`extension=/internal/shared/extensions/${
|
|
2279
|
+
`extension=/internal/shared/extensions/${n}`
|
|
2289
2280
|
].join(`
|
|
2290
2281
|
`)
|
|
2291
|
-
),
|
|
2282
|
+
), w.fileExists(
|
|
2292
2283
|
c.FS,
|
|
2293
|
-
`${c.ENV.ICU_DATA}/${
|
|
2284
|
+
`${c.ENV.ICU_DATA}/${r}`
|
|
2294
2285
|
) || (c.FS.mkdirTree(c.ENV.ICU_DATA), c.FS.writeFile(
|
|
2295
2286
|
`${c.ENV.ICU_DATA}/icudt74l.dat`,
|
|
2296
2287
|
new Uint8Array(S)
|
|
@@ -2298,7 +2289,7 @@ async function st(i = O, e) {
|
|
|
2298
2289
|
}
|
|
2299
2290
|
};
|
|
2300
2291
|
}
|
|
2301
|
-
const
|
|
2292
|
+
const nt = () => ({
|
|
2302
2293
|
websocket: {
|
|
2303
2294
|
decorator: (i) => class extends i {
|
|
2304
2295
|
constructor() {
|
|
@@ -2313,162 +2304,162 @@ const it = () => ({
|
|
|
2313
2304
|
}
|
|
2314
2305
|
}
|
|
2315
2306
|
});
|
|
2316
|
-
async function
|
|
2307
|
+
async function Tt(i, e = {}) {
|
|
2317
2308
|
var s;
|
|
2318
|
-
"setImmediate" in globalThis || (globalThis.setImmediate = (
|
|
2309
|
+
"setImmediate" in globalThis || (globalThis.setImmediate = (_) => setTimeout(_, 0));
|
|
2319
2310
|
let t = {
|
|
2320
|
-
...
|
|
2311
|
+
...nt(),
|
|
2321
2312
|
...e.emscriptenOptions || {}
|
|
2322
2313
|
};
|
|
2323
|
-
e.tcpOverFetch && (t =
|
|
2314
|
+
e.tcpOverFetch && (t = Ye(
|
|
2324
2315
|
t,
|
|
2325
2316
|
e.tcpOverFetch
|
|
2326
|
-
)), e.withIntl && (t =
|
|
2327
|
-
const [
|
|
2328
|
-
|
|
2317
|
+
)), e.withIntl && (t = tt(i, t));
|
|
2318
|
+
const [n, r] = await Promise.all([
|
|
2319
|
+
Pe(i),
|
|
2329
2320
|
t
|
|
2330
2321
|
]);
|
|
2331
|
-
return (s = e.onPhpLoaderModuleLoaded) == null || s.call(e,
|
|
2322
|
+
return (s = e.onPhpLoaderModuleLoaded) == null || s.call(e, n), await me(n, r);
|
|
2332
2323
|
}
|
|
2333
|
-
function
|
|
2324
|
+
function ft(i, e) {
|
|
2334
2325
|
window.addEventListener("message", (t) => {
|
|
2335
2326
|
t.source === i.contentWindow && (e && t.origin !== e || typeof t.data != "object" || t.data.type !== "relay" || window.parent.postMessage(t.data, "*"));
|
|
2336
2327
|
}), window.addEventListener("message", (t) => {
|
|
2337
|
-
var
|
|
2338
|
-
t.source === window.parent && (typeof t.data != "object" || t.data.type !== "relay" || (
|
|
2328
|
+
var n;
|
|
2329
|
+
t.source === window.parent && (typeof t.data != "object" || t.data.type !== "relay" || (n = i == null ? void 0 : i.contentWindow) == null || n.postMessage(t.data));
|
|
2339
2330
|
});
|
|
2340
2331
|
}
|
|
2341
|
-
async function
|
|
2332
|
+
async function pt(i) {
|
|
2342
2333
|
const e = new Worker(i, { type: "module" });
|
|
2343
|
-
return new Promise((t,
|
|
2334
|
+
return new Promise((t, n) => {
|
|
2344
2335
|
e.onerror = (s) => {
|
|
2345
|
-
const
|
|
2336
|
+
const _ = new Error(
|
|
2346
2337
|
`WebWorker failed to load at ${i}. ${s.message ? `Original error: ${s.message}` : ""}`
|
|
2347
2338
|
);
|
|
2348
|
-
|
|
2339
|
+
_.filename = s.filename, n(_);
|
|
2349
2340
|
};
|
|
2350
|
-
function
|
|
2351
|
-
s.data === "worker-script-started" && (t(e), e.removeEventListener("message",
|
|
2341
|
+
function r(s) {
|
|
2342
|
+
s.data === "worker-script-started" && (t(e), e.removeEventListener("message", r));
|
|
2352
2343
|
}
|
|
2353
|
-
e.addEventListener("message",
|
|
2344
|
+
e.addEventListener("message", r);
|
|
2354
2345
|
});
|
|
2355
2346
|
}
|
|
2356
|
-
function
|
|
2347
|
+
function wt(i, e = { initialSync: {} }) {
|
|
2357
2348
|
return e = {
|
|
2358
2349
|
...e,
|
|
2359
2350
|
initialSync: {
|
|
2360
2351
|
...e.initialSync,
|
|
2361
2352
|
direction: e.initialSync.direction ?? "opfs-to-memfs"
|
|
2362
2353
|
}
|
|
2363
|
-
}, async function(t,
|
|
2364
|
-
return e.initialSync.direction === "opfs-to-memfs" ? (
|
|
2365
|
-
r,
|
|
2366
|
-
i,
|
|
2354
|
+
}, async function(t, n, r) {
|
|
2355
|
+
return e.initialSync.direction === "opfs-to-memfs" ? (w.fileExists(n, r) && w.rmdir(n, r), w.mkdir(n, r), await rt(n, i, r)) : await Te(
|
|
2367
2356
|
n,
|
|
2357
|
+
i,
|
|
2358
|
+
r,
|
|
2368
2359
|
e.initialSync.onProgress
|
|
2369
|
-
),
|
|
2360
|
+
), it(t, i, r);
|
|
2370
2361
|
};
|
|
2371
2362
|
}
|
|
2372
|
-
async function
|
|
2373
|
-
|
|
2374
|
-
const
|
|
2363
|
+
async function rt(i, e, t) {
|
|
2364
|
+
w.mkdir(i, t);
|
|
2365
|
+
const n = new ge({
|
|
2375
2366
|
concurrency: 40
|
|
2376
|
-
}),
|
|
2367
|
+
}), r = [], s = [
|
|
2377
2368
|
[e, t]
|
|
2378
2369
|
];
|
|
2379
2370
|
for (; s.length > 0; ) {
|
|
2380
|
-
const [
|
|
2381
|
-
for await (const S of
|
|
2382
|
-
const c =
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2371
|
+
const [_, a] = s.pop();
|
|
2372
|
+
for await (const S of _.values()) {
|
|
2373
|
+
const c = n.run(async () => {
|
|
2374
|
+
const A = ie(
|
|
2375
|
+
a,
|
|
2385
2376
|
S.name
|
|
2386
2377
|
);
|
|
2387
2378
|
if (S.kind === "directory") {
|
|
2388
2379
|
try {
|
|
2389
|
-
i.mkdir(
|
|
2390
|
-
} catch (
|
|
2391
|
-
if ((
|
|
2392
|
-
throw
|
|
2380
|
+
i.mkdir(A);
|
|
2381
|
+
} catch (h) {
|
|
2382
|
+
if ((h == null ? void 0 : h.errno) !== 20)
|
|
2383
|
+
throw U.error(h), h;
|
|
2393
2384
|
}
|
|
2394
|
-
s.push([S,
|
|
2385
|
+
s.push([S, A]);
|
|
2395
2386
|
} else if (S.kind === "file") {
|
|
2396
|
-
const
|
|
2387
|
+
const h = await S.getFile(), l = new Uint8Array(await h.arrayBuffer());
|
|
2397
2388
|
i.createDataFile(
|
|
2398
|
-
|
|
2389
|
+
a,
|
|
2399
2390
|
S.name,
|
|
2400
|
-
|
|
2391
|
+
l,
|
|
2401
2392
|
!0,
|
|
2402
2393
|
!0,
|
|
2403
2394
|
!0
|
|
2404
2395
|
);
|
|
2405
2396
|
}
|
|
2406
|
-
|
|
2397
|
+
r.splice(r.indexOf(c), 1);
|
|
2407
2398
|
});
|
|
2408
|
-
|
|
2399
|
+
r.push(c);
|
|
2409
2400
|
}
|
|
2410
|
-
for (; s.length === 0 &&
|
|
2411
|
-
await Promise.any(
|
|
2401
|
+
for (; s.length === 0 && r.length > 0; )
|
|
2402
|
+
await Promise.any(r);
|
|
2412
2403
|
}
|
|
2413
2404
|
}
|
|
2414
|
-
async function
|
|
2405
|
+
async function Te(i, e, t, n) {
|
|
2415
2406
|
i.mkdirTree(t);
|
|
2416
|
-
const
|
|
2417
|
-
async function s(
|
|
2407
|
+
const r = [];
|
|
2408
|
+
async function s(A, h) {
|
|
2418
2409
|
await Promise.all(
|
|
2419
|
-
i.readdir(
|
|
2420
|
-
(
|
|
2421
|
-
).map(async (
|
|
2422
|
-
const
|
|
2423
|
-
if (!
|
|
2424
|
-
|
|
2410
|
+
i.readdir(A).filter(
|
|
2411
|
+
(l) => l !== "." && l !== ".."
|
|
2412
|
+
).map(async (l) => {
|
|
2413
|
+
const E = ie(A, l);
|
|
2414
|
+
if (!st(i, E)) {
|
|
2415
|
+
r.push([h, E, l]);
|
|
2425
2416
|
return;
|
|
2426
2417
|
}
|
|
2427
|
-
const
|
|
2418
|
+
const v = await h.getDirectoryHandle(l, {
|
|
2428
2419
|
create: !0
|
|
2429
2420
|
});
|
|
2430
|
-
return await s(
|
|
2421
|
+
return await s(E, v);
|
|
2431
2422
|
})
|
|
2432
2423
|
);
|
|
2433
2424
|
}
|
|
2434
2425
|
await s(t, e);
|
|
2435
|
-
let
|
|
2436
|
-
const
|
|
2426
|
+
let _ = 0;
|
|
2427
|
+
const a = n && ot(n, 100), S = 100, c = /* @__PURE__ */ new Set();
|
|
2437
2428
|
try {
|
|
2438
|
-
for (const [h, l
|
|
2439
|
-
const
|
|
2440
|
-
h,
|
|
2429
|
+
for (const [A, h, l] of r) {
|
|
2430
|
+
const E = O(
|
|
2441
2431
|
A,
|
|
2432
|
+
l,
|
|
2442
2433
|
i,
|
|
2443
|
-
|
|
2434
|
+
h
|
|
2444
2435
|
).then(() => {
|
|
2445
|
-
|
|
2446
|
-
files:
|
|
2447
|
-
total:
|
|
2436
|
+
_++, c.delete(E), a == null || a({
|
|
2437
|
+
files: _,
|
|
2438
|
+
total: r.length
|
|
2448
2439
|
});
|
|
2449
2440
|
});
|
|
2450
|
-
c.add(
|
|
2451
|
-
files:
|
|
2452
|
-
total:
|
|
2441
|
+
c.add(E), c.size >= S && (await Promise.race(c), a == null || a({
|
|
2442
|
+
files: _,
|
|
2443
|
+
total: r.length
|
|
2453
2444
|
}));
|
|
2454
2445
|
}
|
|
2455
2446
|
} finally {
|
|
2456
2447
|
await Promise.allSettled(c);
|
|
2457
2448
|
}
|
|
2458
2449
|
}
|
|
2459
|
-
function
|
|
2450
|
+
function st(i, e) {
|
|
2460
2451
|
return i.isDir(i.lookupPath(e, { follow: !0 }).node.mode);
|
|
2461
2452
|
}
|
|
2462
|
-
async function
|
|
2463
|
-
let
|
|
2453
|
+
async function O(i, e, t, n) {
|
|
2454
|
+
let r;
|
|
2464
2455
|
try {
|
|
2465
|
-
|
|
2456
|
+
r = t.readFile(n, {
|
|
2466
2457
|
encoding: "binary"
|
|
2467
2458
|
});
|
|
2468
2459
|
} catch {
|
|
2469
2460
|
return;
|
|
2470
2461
|
}
|
|
2471
|
-
const s = await i.getFileHandle(e, { create: !0 }),
|
|
2462
|
+
const s = await i.getFileHandle(e, { create: !0 }), _ = s.createWritable !== void 0 ? (
|
|
2472
2463
|
// Google Chrome, Firefox, probably more browsers
|
|
2473
2464
|
await s.createWritable()
|
|
2474
2465
|
) : (
|
|
@@ -2476,145 +2467,145 @@ async function F(i, e, t, r) {
|
|
|
2476
2467
|
await s.createSyncAccessHandle()
|
|
2477
2468
|
);
|
|
2478
2469
|
try {
|
|
2479
|
-
await
|
|
2470
|
+
await _.truncate(0), await _.write(r);
|
|
2480
2471
|
} finally {
|
|
2481
|
-
await
|
|
2472
|
+
await _.close();
|
|
2482
2473
|
}
|
|
2483
2474
|
}
|
|
2484
|
-
function
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2487
|
-
}), s = new
|
|
2488
|
-
async function
|
|
2489
|
-
if (
|
|
2475
|
+
function it(i, e, t) {
|
|
2476
|
+
const n = [], r = We(i, t, (a) => {
|
|
2477
|
+
n.push(a);
|
|
2478
|
+
}), s = new _t(i, e, t);
|
|
2479
|
+
async function _() {
|
|
2480
|
+
if (n.length === 0)
|
|
2490
2481
|
return;
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2493
|
-
const c =
|
|
2482
|
+
const a = await i.semaphore.acquire(), S = [...n];
|
|
2483
|
+
n.splice(0, S.length);
|
|
2484
|
+
const c = be(S);
|
|
2494
2485
|
try {
|
|
2495
|
-
for (const
|
|
2496
|
-
await s.processEntry(
|
|
2486
|
+
for (const A of c)
|
|
2487
|
+
await s.processEntry(A);
|
|
2497
2488
|
} finally {
|
|
2498
|
-
|
|
2489
|
+
a();
|
|
2499
2490
|
}
|
|
2500
2491
|
}
|
|
2501
|
-
return i.addEventListener("request.end",
|
|
2502
|
-
|
|
2492
|
+
return i.addEventListener("request.end", _), i.addEventListener("filesystem.write", _), function() {
|
|
2493
|
+
r(), i.removeEventListener("request.end", _), i.removeEventListener("filesystem.write", _);
|
|
2503
2494
|
};
|
|
2504
2495
|
}
|
|
2505
|
-
class
|
|
2506
|
-
constructor(e, t,
|
|
2507
|
-
this.php = e, this.opfs = t, this.memfsRoot =
|
|
2496
|
+
class _t {
|
|
2497
|
+
constructor(e, t, n) {
|
|
2498
|
+
this.php = e, this.opfs = t, this.memfsRoot = re(n);
|
|
2508
2499
|
}
|
|
2509
2500
|
toOpfsPath(e) {
|
|
2510
|
-
return
|
|
2501
|
+
return re(e.substring(this.memfsRoot.length));
|
|
2511
2502
|
}
|
|
2512
2503
|
async processEntry(e) {
|
|
2513
2504
|
if (!e.path.startsWith(this.memfsRoot) || e.path === this.memfsRoot)
|
|
2514
2505
|
return;
|
|
2515
|
-
const t = this.toOpfsPath(e.path),
|
|
2516
|
-
if (
|
|
2506
|
+
const t = this.toOpfsPath(e.path), n = await se(this.opfs, t), r = at(t);
|
|
2507
|
+
if (r)
|
|
2517
2508
|
try {
|
|
2518
2509
|
if (e.operation === "DELETE")
|
|
2519
2510
|
try {
|
|
2520
|
-
await
|
|
2511
|
+
await n.removeEntry(r, {
|
|
2521
2512
|
recursive: !0
|
|
2522
2513
|
});
|
|
2523
2514
|
} catch {
|
|
2524
2515
|
}
|
|
2525
2516
|
else if (e.operation === "CREATE")
|
|
2526
|
-
e.nodeType === "directory" ? await
|
|
2517
|
+
e.nodeType === "directory" ? await n.getDirectoryHandle(r, {
|
|
2527
2518
|
create: !0
|
|
2528
|
-
}) : await
|
|
2519
|
+
}) : await n.getFileHandle(r, {
|
|
2529
2520
|
create: !0
|
|
2530
2521
|
});
|
|
2531
2522
|
else if (e.operation === "WRITE")
|
|
2532
|
-
await
|
|
2533
|
-
r,
|
|
2523
|
+
await O(
|
|
2534
2524
|
n,
|
|
2525
|
+
r,
|
|
2535
2526
|
this.php[k].FS,
|
|
2536
2527
|
e.path
|
|
2537
2528
|
);
|
|
2538
2529
|
else if (e.operation === "RENAME" && e.toPath.startsWith(this.memfsRoot)) {
|
|
2539
|
-
const s = this.toOpfsPath(e.toPath),
|
|
2530
|
+
const s = this.toOpfsPath(e.toPath), _ = await se(
|
|
2540
2531
|
this.opfs,
|
|
2541
2532
|
s
|
|
2542
2533
|
);
|
|
2543
2534
|
if (e.nodeType === "directory") {
|
|
2544
|
-
const
|
|
2545
|
-
|
|
2535
|
+
const a = await _.getDirectoryHandle(
|
|
2536
|
+
r,
|
|
2546
2537
|
{
|
|
2547
2538
|
create: !0
|
|
2548
2539
|
}
|
|
2549
2540
|
);
|
|
2550
|
-
await
|
|
2541
|
+
await Te(
|
|
2551
2542
|
this.php[k].FS,
|
|
2552
|
-
|
|
2543
|
+
a,
|
|
2553
2544
|
e.toPath
|
|
2554
|
-
), await
|
|
2545
|
+
), await n.removeEntry(r, {
|
|
2555
2546
|
recursive: !0
|
|
2556
2547
|
});
|
|
2557
2548
|
} else {
|
|
2558
2549
|
try {
|
|
2559
|
-
await
|
|
2550
|
+
await n.removeEntry(r);
|
|
2560
2551
|
} catch {
|
|
2561
2552
|
}
|
|
2562
|
-
await
|
|
2563
|
-
|
|
2564
|
-
|
|
2553
|
+
await O(
|
|
2554
|
+
_,
|
|
2555
|
+
Ie(s),
|
|
2565
2556
|
this.php[k].FS,
|
|
2566
2557
|
e.toPath
|
|
2567
2558
|
);
|
|
2568
2559
|
}
|
|
2569
2560
|
}
|
|
2570
2561
|
} catch (s) {
|
|
2571
|
-
throw
|
|
2562
|
+
throw U.log({ entry: e, name: r }), U.error(s), s;
|
|
2572
2563
|
}
|
|
2573
2564
|
}
|
|
2574
2565
|
}
|
|
2575
|
-
function
|
|
2566
|
+
function re(i) {
|
|
2576
2567
|
return i.replace(/\/$/, "").replace(/\/\/+/g, "/");
|
|
2577
2568
|
}
|
|
2578
|
-
function
|
|
2569
|
+
function at(i) {
|
|
2579
2570
|
return i.substring(i.lastIndexOf("/") + 1);
|
|
2580
2571
|
}
|
|
2581
|
-
async function
|
|
2572
|
+
async function se(i, e) {
|
|
2582
2573
|
const t = e.replace(/^\/+|\/+$/g, "").replace(/\/+/, "/");
|
|
2583
2574
|
if (!t)
|
|
2584
2575
|
return i;
|
|
2585
|
-
const
|
|
2586
|
-
let
|
|
2587
|
-
for (let s = 0; s <
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2576
|
+
const n = t.split("/");
|
|
2577
|
+
let r = i;
|
|
2578
|
+
for (let s = 0; s < n.length - 1; s++) {
|
|
2579
|
+
const _ = n[s];
|
|
2580
|
+
r = await r.getDirectoryHandle(_, { create: !0 });
|
|
2590
2581
|
}
|
|
2591
|
-
return
|
|
2582
|
+
return r;
|
|
2592
2583
|
}
|
|
2593
|
-
function
|
|
2594
|
-
let t = 0,
|
|
2595
|
-
return function(...
|
|
2596
|
-
|
|
2597
|
-
const
|
|
2598
|
-
if (
|
|
2599
|
-
const S = Math.max(0, e -
|
|
2600
|
-
|
|
2601
|
-
|
|
2584
|
+
function ot(i, e) {
|
|
2585
|
+
let t = 0, n, r;
|
|
2586
|
+
return function(..._) {
|
|
2587
|
+
r = _;
|
|
2588
|
+
const a = Date.now() - t;
|
|
2589
|
+
if (n === void 0) {
|
|
2590
|
+
const S = Math.max(0, e - a);
|
|
2591
|
+
n = setTimeout(() => {
|
|
2592
|
+
n = void 0, t = Date.now(), i(...r);
|
|
2602
2593
|
}, S);
|
|
2603
2594
|
}
|
|
2604
2595
|
};
|
|
2605
2596
|
}
|
|
2606
2597
|
export {
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2598
|
+
Kt as FirewallInterferenceError,
|
|
2599
|
+
Ht as certificateToPEM,
|
|
2600
|
+
mt as consumeAPI,
|
|
2601
|
+
wt as createDirectoryHandleMountHandler,
|
|
2602
|
+
gt as exposeAPI,
|
|
2603
|
+
Dt as fetchWithCorsProxy,
|
|
2613
2604
|
je as generateCertificate,
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2605
|
+
Pe as getPHPLoaderModule,
|
|
2606
|
+
Tt as loadWebRuntime,
|
|
2607
|
+
dt as privateKeyToPEM,
|
|
2608
|
+
ft as setupPostMessageRelay,
|
|
2609
|
+
pt as spawnPHPWorkerThread
|
|
2619
2610
|
};
|
|
2620
2611
|
//# sourceMappingURL=index.js.map
|