@reclaimprotocol/attestor-core 5.0.2 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +660 -660
- package/browser/resources/attestor-browser.min.mjs +31 -31
- package/lib/avs/abis/avsDirectoryABI.js +340 -0
- package/lib/avs/abis/delegationABI.js +1 -0
- package/lib/avs/abis/registryABI.js +725 -0
- package/lib/avs/client/create-claim-on-avs.js +138 -0
- package/lib/avs/config.js +20 -0
- package/lib/avs/contracts/ReclaimServiceManager.js +1 -0
- package/lib/avs/contracts/common.js +1 -0
- package/lib/avs/contracts/factories/ReclaimServiceManager__factory.js +1169 -0
- package/lib/avs/contracts/factories/index.js +4 -0
- package/lib/avs/contracts/index.js +2 -0
- package/lib/avs/types/index.js +1 -0
- package/lib/avs/utils/contracts.js +33 -0
- package/lib/avs/utils/register.js +78 -0
- package/lib/avs/utils/tasks.js +40 -0
- package/lib/client/create-claim.js +433 -0
- package/lib/client/index.js +3 -0
- package/lib/client/tunnels/make-rpc-tcp-tunnel.js +51 -0
- package/lib/client/tunnels/make-rpc-tls-tunnel.js +131 -0
- package/lib/client/utils/attestor-pool.js +25 -0
- package/lib/client/utils/client-socket.js +98 -0
- package/lib/client/utils/message-handler.js +87 -0
- package/lib/config/index.d.ts +2 -2
- package/lib/config/index.js +44 -0
- package/lib/external-rpc/benchmark.js +69 -0
- package/lib/external-rpc/event-bus.js +14 -0
- package/lib/external-rpc/handle-incoming-msg.js +233 -0
- package/lib/external-rpc/index.js +101 -54
- package/lib/external-rpc/jsc-polyfills/1.js +82 -0
- package/lib/external-rpc/jsc-polyfills/2.js +20 -0
- package/lib/external-rpc/jsc-polyfills/event.js +14 -0
- package/lib/external-rpc/jsc-polyfills/index.js +2 -0
- package/lib/external-rpc/jsc-polyfills/ws.js +81 -0
- package/lib/external-rpc/setup-browser.js +33 -0
- package/lib/external-rpc/setup-jsc.js +22 -0
- package/lib/external-rpc/types.js +1 -0
- package/lib/external-rpc/utils.js +100 -0
- package/lib/external-rpc/zk.js +63 -0
- package/lib/index.js +121 -72
- package/lib/mechain/abis/governanceABI.js +458 -0
- package/lib/mechain/abis/taskABI.js +509 -0
- package/lib/mechain/client/create-claim-on-mechain.js +28 -0
- package/lib/mechain/client/index.js +1 -0
- package/lib/mechain/constants/index.js +3 -0
- package/lib/mechain/index.js +2 -0
- package/lib/mechain/types/index.js +1 -0
- package/lib/proto/api.d.ts +2 -0
- package/lib/proto/api.js +4273 -0
- package/lib/proto/tee-bundle.js +1316 -0
- package/lib/providers/http/index.js +658 -0
- package/lib/providers/http/patch-parse5-tree.js +33 -0
- package/lib/providers/http/utils.js +324 -0
- package/lib/providers/index.js +4 -0
- package/lib/scripts/fetch-ec2-metadata.d.ts +1 -0
- package/lib/server/create-server.js +103 -0
- package/lib/server/handlers/claimTeeBundle.js +252 -0
- package/lib/server/handlers/claimTunnel.js +73 -0
- package/lib/server/handlers/completeClaimOnChain.js +22 -0
- package/lib/server/handlers/createClaimOnChain.js +26 -0
- package/lib/server/handlers/createTaskOnMechain.js +47 -0
- package/lib/server/handlers/createTunnel.js +93 -0
- package/lib/server/handlers/disconnectTunnel.js +5 -0
- package/lib/server/handlers/fetchCertificateBytes.js +41 -0
- package/lib/server/handlers/index.js +22 -0
- package/lib/server/handlers/init.js +32 -0
- package/lib/server/handlers/toprf.js +16 -0
- package/lib/server/index.js +4 -0
- package/lib/server/socket.js +109 -0
- package/lib/server/tunnels/make-tcp-tunnel.js +177 -0
- package/lib/server/utils/apm.js +36 -0
- package/lib/server/utils/assert-valid-claim-request.d.ts +1 -1
- package/lib/server/utils/assert-valid-claim-request.js +204 -0
- package/lib/server/utils/config-env.js +4 -0
- package/lib/server/utils/dns.js +18 -0
- package/lib/server/utils/gcp-attestation.js +289 -0
- package/lib/server/utils/generics.d.ts +1 -0
- package/lib/server/utils/generics.js +51 -0
- package/lib/server/utils/iso.js +256 -0
- package/lib/server/utils/keep-alive.js +38 -0
- package/lib/server/utils/nitro-attestation.js +325 -0
- package/lib/server/utils/process-handshake.js +215 -0
- package/lib/server/utils/proxy-session.js +6 -0
- package/lib/server/utils/tee-oprf-mpc-verification.js +90 -0
- package/lib/server/utils/tee-oprf-verification.js +174 -0
- package/lib/server/utils/tee-transcript-reconstruction.js +187 -0
- package/lib/server/utils/tee-verification.js +421 -0
- package/lib/server/utils/validation.js +38 -0
- package/lib/types/bgp.js +1 -0
- package/lib/types/claims.js +1 -0
- package/lib/types/client.js +1 -0
- package/lib/types/general.js +1 -0
- package/lib/types/handlers.js +1 -0
- package/lib/types/index.js +10 -0
- package/lib/types/providers.d.ts +1 -0
- package/lib/types/providers.gen.js +10 -0
- package/lib/types/providers.js +1 -0
- package/lib/types/rpc.js +1 -0
- package/lib/types/signatures.js +1 -0
- package/lib/types/tunnel.js +1 -0
- package/lib/types/zk.js +1 -0
- package/lib/utils/auth.js +59 -0
- package/lib/utils/b64-json.js +17 -0
- package/lib/utils/bgp-listener.js +119 -0
- package/lib/utils/claims.js +99 -0
- package/lib/utils/env.js +15 -0
- package/lib/utils/error.js +50 -0
- package/lib/utils/generics.js +317 -0
- package/lib/utils/http-parser.d.ts +2 -1
- package/lib/utils/http-parser.js +246 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/logger.js +91 -0
- package/lib/utils/prepare-packets.js +62 -0
- package/lib/utils/redactions.js +148 -0
- package/lib/utils/retries.js +24 -0
- package/lib/utils/signatures/eth.js +29 -0
- package/lib/utils/signatures/index.js +7 -0
- package/lib/utils/socket-base.js +90 -0
- package/lib/utils/tls.js +58 -0
- package/lib/utils/ws.js +22 -0
- package/lib/utils/zk.js +577 -0
- package/package.json +3 -2
|
@@ -2488,6 +2488,7 @@ var AttestorVersion = {
|
|
|
2488
2488
|
ATTESTOR_VERSION_2_0_0: 3,
|
|
2489
2489
|
ATTESTOR_VERSION_2_0_1: 4,
|
|
2490
2490
|
ATTESTOR_VERSION_3_0_0: 5,
|
|
2491
|
+
ATTESTOR_VERSION_3_1_0: 6,
|
|
2491
2492
|
UNRECOGNIZED: -1
|
|
2492
2493
|
};
|
|
2493
2494
|
function attestorVersionFromJSON(object) {
|
|
@@ -2510,6 +2511,9 @@ function attestorVersionFromJSON(object) {
|
|
|
2510
2511
|
case 5:
|
|
2511
2512
|
case "ATTESTOR_VERSION_3_0_0":
|
|
2512
2513
|
return AttestorVersion.ATTESTOR_VERSION_3_0_0;
|
|
2514
|
+
case 6:
|
|
2515
|
+
case "ATTESTOR_VERSION_3_1_0":
|
|
2516
|
+
return AttestorVersion.ATTESTOR_VERSION_3_1_0;
|
|
2513
2517
|
case -1:
|
|
2514
2518
|
case "UNRECOGNIZED":
|
|
2515
2519
|
default:
|
|
@@ -2530,6 +2534,8 @@ function attestorVersionToJSON(object) {
|
|
|
2530
2534
|
return "ATTESTOR_VERSION_2_0_1";
|
|
2531
2535
|
case AttestorVersion.ATTESTOR_VERSION_3_0_0:
|
|
2532
2536
|
return "ATTESTOR_VERSION_3_0_0";
|
|
2537
|
+
case AttestorVersion.ATTESTOR_VERSION_3_1_0:
|
|
2538
|
+
return "ATTESTOR_VERSION_3_1_0";
|
|
2533
2539
|
case AttestorVersion.UNRECOGNIZED:
|
|
2534
2540
|
default:
|
|
2535
2541
|
return "UNRECOGNIZED";
|
|
@@ -2717,7 +2723,7 @@ var ProviderClaimData = {
|
|
|
2717
2723
|
},
|
|
2718
2724
|
decode(input, length) {
|
|
2719
2725
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2720
|
-
|
|
2726
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2721
2727
|
const message = createBaseProviderClaimData();
|
|
2722
2728
|
while (reader.pos < end) {
|
|
2723
2729
|
const tag = reader.uint32();
|
|
@@ -2848,7 +2854,7 @@ var ErrorData = {
|
|
|
2848
2854
|
},
|
|
2849
2855
|
decode(input, length) {
|
|
2850
2856
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2851
|
-
|
|
2857
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2852
2858
|
const message = createBaseErrorData();
|
|
2853
2859
|
while (reader.pos < end) {
|
|
2854
2860
|
const tag = reader.uint32();
|
|
@@ -2937,7 +2943,7 @@ var CreateTunnelRequest = {
|
|
|
2937
2943
|
},
|
|
2938
2944
|
decode(input, length) {
|
|
2939
2945
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2940
|
-
|
|
2946
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2941
2947
|
const message = createBaseCreateTunnelRequest();
|
|
2942
2948
|
while (reader.pos < end) {
|
|
2943
2949
|
const tag = reader.uint32();
|
|
@@ -3038,7 +3044,7 @@ var FetchCertificateBytesRequest = {
|
|
|
3038
3044
|
},
|
|
3039
3045
|
decode(input, length) {
|
|
3040
3046
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3041
|
-
|
|
3047
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3042
3048
|
const message = createBaseFetchCertificateBytesRequest();
|
|
3043
3049
|
while (reader.pos < end) {
|
|
3044
3050
|
const tag = reader.uint32();
|
|
@@ -3089,7 +3095,7 @@ var FetchCertificateBytesResponse = {
|
|
|
3089
3095
|
},
|
|
3090
3096
|
decode(input, length) {
|
|
3091
3097
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3092
|
-
|
|
3098
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3093
3099
|
const message = createBaseFetchCertificateBytesResponse();
|
|
3094
3100
|
while (reader.pos < end) {
|
|
3095
3101
|
const tag = reader.uint32();
|
|
@@ -3140,7 +3146,7 @@ var DisconnectTunnelRequest = {
|
|
|
3140
3146
|
},
|
|
3141
3147
|
decode(input, length) {
|
|
3142
3148
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3143
|
-
|
|
3149
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3144
3150
|
const message = createBaseDisconnectTunnelRequest();
|
|
3145
3151
|
while (reader.pos < end) {
|
|
3146
3152
|
const tag = reader.uint32();
|
|
@@ -3188,7 +3194,7 @@ var Empty = {
|
|
|
3188
3194
|
},
|
|
3189
3195
|
decode(input, length) {
|
|
3190
3196
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3191
|
-
|
|
3197
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3192
3198
|
const message = createBaseEmpty();
|
|
3193
3199
|
while (reader.pos < end) {
|
|
3194
3200
|
const tag = reader.uint32();
|
|
@@ -3231,7 +3237,7 @@ var TunnelMessage = {
|
|
|
3231
3237
|
},
|
|
3232
3238
|
decode(input, length) {
|
|
3233
3239
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3234
|
-
|
|
3240
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3235
3241
|
const message = createBaseTunnelMessage();
|
|
3236
3242
|
while (reader.pos < end) {
|
|
3237
3243
|
const tag = reader.uint32();
|
|
@@ -3299,7 +3305,7 @@ var TunnelDisconnectEvent = {
|
|
|
3299
3305
|
},
|
|
3300
3306
|
decode(input, length) {
|
|
3301
3307
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3302
|
-
|
|
3308
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3303
3309
|
const message = createBaseTunnelDisconnectEvent();
|
|
3304
3310
|
while (reader.pos < end) {
|
|
3305
3311
|
const tag = reader.uint32();
|
|
@@ -3367,7 +3373,7 @@ var MessageReveal = {
|
|
|
3367
3373
|
},
|
|
3368
3374
|
decode(input, length) {
|
|
3369
3375
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3370
|
-
|
|
3376
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3371
3377
|
const message = createBaseMessageReveal();
|
|
3372
3378
|
while (reader.pos < end) {
|
|
3373
3379
|
const tag = reader.uint32();
|
|
@@ -3438,7 +3444,7 @@ var MessageReveal_MessageRevealDirect = {
|
|
|
3438
3444
|
},
|
|
3439
3445
|
decode(input, length) {
|
|
3440
3446
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3441
|
-
|
|
3447
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3442
3448
|
const message = createBaseMessageReveal_MessageRevealDirect();
|
|
3443
3449
|
while (reader.pos < end) {
|
|
3444
3450
|
const tag = reader.uint32();
|
|
@@ -3524,7 +3530,7 @@ var MessageReveal_MessageRevealZk = {
|
|
|
3524
3530
|
},
|
|
3525
3531
|
decode(input, length) {
|
|
3526
3532
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3527
|
-
|
|
3533
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3528
3534
|
const message = createBaseMessageReveal_MessageRevealZk();
|
|
3529
3535
|
while (reader.pos < end) {
|
|
3530
3536
|
const tag = reader.uint32();
|
|
@@ -3613,7 +3619,7 @@ var MessageReveal_OPRFRawMarker = {
|
|
|
3613
3619
|
},
|
|
3614
3620
|
decode(input, length) {
|
|
3615
3621
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3616
|
-
|
|
3622
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3617
3623
|
const message = createBaseMessageReveal_OPRFRawMarker();
|
|
3618
3624
|
while (reader.pos < end) {
|
|
3619
3625
|
const tag = reader.uint32();
|
|
@@ -3678,7 +3684,7 @@ var MessageReveal_ZKProof = {
|
|
|
3678
3684
|
},
|
|
3679
3685
|
decode(input, length) {
|
|
3680
3686
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3681
|
-
|
|
3687
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3682
3688
|
const message = createBaseMessageReveal_ZKProof();
|
|
3683
3689
|
while (reader.pos < end) {
|
|
3684
3690
|
const tag = reader.uint32();
|
|
@@ -3773,7 +3779,7 @@ var MessageReveal_TOPRFProof = {
|
|
|
3773
3779
|
},
|
|
3774
3780
|
decode(input, length) {
|
|
3775
3781
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3776
|
-
|
|
3782
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3777
3783
|
const message = createBaseMessageReveal_TOPRFProof();
|
|
3778
3784
|
while (reader.pos < end) {
|
|
3779
3785
|
const tag = reader.uint32();
|
|
@@ -3856,7 +3862,7 @@ var TOPRFPayload = {
|
|
|
3856
3862
|
},
|
|
3857
3863
|
decode(input, length) {
|
|
3858
3864
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3859
|
-
|
|
3865
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3860
3866
|
const message = createBaseTOPRFPayload();
|
|
3861
3867
|
while (reader.pos < end) {
|
|
3862
3868
|
const tag = reader.uint32();
|
|
@@ -3936,7 +3942,7 @@ var DataSlice = {
|
|
|
3936
3942
|
},
|
|
3937
3943
|
decode(input, length) {
|
|
3938
3944
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3939
|
-
|
|
3945
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3940
3946
|
const message = createBaseDataSlice();
|
|
3941
3947
|
while (reader.pos < end) {
|
|
3942
3948
|
const tag = reader.uint32();
|
|
@@ -4013,7 +4019,7 @@ var ClaimRequestData = {
|
|
|
4013
4019
|
},
|
|
4014
4020
|
decode(input, length) {
|
|
4015
4021
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4016
|
-
|
|
4022
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4017
4023
|
const message = createBaseClaimRequestData();
|
|
4018
4024
|
while (reader.pos < end) {
|
|
4019
4025
|
const tag = reader.uint32();
|
|
@@ -4120,7 +4126,7 @@ var ClaimTeeBundleRequest = {
|
|
|
4120
4126
|
},
|
|
4121
4127
|
decode(input, length) {
|
|
4122
4128
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4123
|
-
|
|
4129
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4124
4130
|
const message = createBaseClaimTeeBundleRequest();
|
|
4125
4131
|
while (reader.pos < end) {
|
|
4126
4132
|
const tag = reader.uint32();
|
|
@@ -4197,7 +4203,7 @@ var ClaimTeeBundleRequest_Signatures = {
|
|
|
4197
4203
|
},
|
|
4198
4204
|
decode(input, length) {
|
|
4199
4205
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4200
|
-
|
|
4206
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4201
4207
|
const message = createBaseClaimTeeBundleRequest_Signatures();
|
|
4202
4208
|
while (reader.pos < end) {
|
|
4203
4209
|
const tag = reader.uint32();
|
|
@@ -4259,7 +4265,7 @@ var ClaimTeeBundleResponse = {
|
|
|
4259
4265
|
},
|
|
4260
4266
|
decode(input, length) {
|
|
4261
4267
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4262
|
-
|
|
4268
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4263
4269
|
const message = createBaseClaimTeeBundleResponse();
|
|
4264
4270
|
while (reader.pos < end) {
|
|
4265
4271
|
const tag = reader.uint32();
|
|
@@ -4354,7 +4360,7 @@ var ClaimTeeBundleResponse_Signatures = {
|
|
|
4354
4360
|
},
|
|
4355
4361
|
decode(input, length) {
|
|
4356
4362
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4357
|
-
|
|
4363
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4358
4364
|
const message = createBaseClaimTeeBundleResponse_Signatures();
|
|
4359
4365
|
while (reader.pos < end) {
|
|
4360
4366
|
const tag = reader.uint32();
|
|
@@ -4457,7 +4463,7 @@ var ClaimTunnelRequest = {
|
|
|
4457
4463
|
},
|
|
4458
4464
|
decode(input, length) {
|
|
4459
4465
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4460
|
-
|
|
4466
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4461
4467
|
const message = createBaseClaimTunnelRequest();
|
|
4462
4468
|
while (reader.pos < end) {
|
|
4463
4469
|
const tag = reader.uint32();
|
|
@@ -4582,7 +4588,7 @@ var ClaimTunnelRequest_Signatures = {
|
|
|
4582
4588
|
},
|
|
4583
4589
|
decode(input, length) {
|
|
4584
4590
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4585
|
-
|
|
4591
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4586
4592
|
const message = createBaseClaimTunnelRequest_Signatures();
|
|
4587
4593
|
while (reader.pos < end) {
|
|
4588
4594
|
const tag = reader.uint32();
|
|
@@ -4641,7 +4647,7 @@ var ClaimTunnelRequest_TranscriptMessage = {
|
|
|
4641
4647
|
},
|
|
4642
4648
|
decode(input, length) {
|
|
4643
4649
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4644
|
-
|
|
4650
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4645
4651
|
const message = createBaseClaimTunnelRequest_TranscriptMessage();
|
|
4646
4652
|
while (reader.pos < end) {
|
|
4647
4653
|
const tag = reader.uint32();
|
|
@@ -4727,7 +4733,7 @@ var ClaimTunnelResponse = {
|
|
|
4727
4733
|
},
|
|
4728
4734
|
decode(input, length) {
|
|
4729
4735
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4730
|
-
|
|
4736
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4731
4737
|
const message = createBaseClaimTunnelResponse();
|
|
4732
4738
|
while (reader.pos < end) {
|
|
4733
4739
|
const tag = reader.uint32();
|
|
@@ -4822,7 +4828,7 @@ var ClaimTunnelResponse_Signatures = {
|
|
|
4822
4828
|
},
|
|
4823
4829
|
decode(input, length) {
|
|
4824
4830
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4825
|
-
|
|
4831
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4826
4832
|
const message = createBaseClaimTunnelResponse_Signatures();
|
|
4827
4833
|
while (reader.pos < end) {
|
|
4828
4834
|
const tag = reader.uint32();
|
|
@@ -4905,7 +4911,7 @@ var RequestClaimOnAvsRequest = {
|
|
|
4905
4911
|
},
|
|
4906
4912
|
decode(input, length) {
|
|
4907
4913
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4908
|
-
|
|
4914
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4909
4915
|
const message = createBaseRequestClaimOnAvsRequest();
|
|
4910
4916
|
while (reader.pos < end) {
|
|
4911
4917
|
const tag = reader.uint32();
|
|
@@ -4988,7 +4994,7 @@ var RequestClaimOnAvsResponse = {
|
|
|
4988
4994
|
},
|
|
4989
4995
|
decode(input, length) {
|
|
4990
4996
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4991
|
-
|
|
4997
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4992
4998
|
const message = createBaseRequestClaimOnAvsResponse();
|
|
4993
4999
|
while (reader.pos < end) {
|
|
4994
5000
|
const tag = reader.uint32();
|
|
@@ -5071,7 +5077,7 @@ var CompleteClaimOnAvsRequest = {
|
|
|
5071
5077
|
},
|
|
5072
5078
|
decode(input, length) {
|
|
5073
5079
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5074
|
-
|
|
5080
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5075
5081
|
const message = createBaseCompleteClaimOnAvsRequest();
|
|
5076
5082
|
while (reader.pos < end) {
|
|
5077
5083
|
const tag = reader.uint32();
|
|
@@ -5151,7 +5157,7 @@ var CompleteClaimOnAvsResponse = {
|
|
|
5151
5157
|
},
|
|
5152
5158
|
decode(input, length) {
|
|
5153
5159
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5154
|
-
|
|
5160
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5155
5161
|
const message = createBaseCompleteClaimOnAvsResponse();
|
|
5156
5162
|
while (reader.pos < end) {
|
|
5157
5163
|
const tag = reader.uint32();
|
|
@@ -5216,7 +5222,7 @@ var CreateTaskOnMechainRequest = {
|
|
|
5216
5222
|
},
|
|
5217
5223
|
decode(input, length) {
|
|
5218
5224
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5219
|
-
|
|
5225
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5220
5226
|
const message = createBaseCreateTaskOnMechainRequest();
|
|
5221
5227
|
while (reader.pos < end) {
|
|
5222
5228
|
const tag = reader.uint32();
|
|
@@ -5273,7 +5279,7 @@ var CreateTaskOnMechainResponse = {
|
|
|
5273
5279
|
},
|
|
5274
5280
|
decode(input, length) {
|
|
5275
5281
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5276
|
-
|
|
5282
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5277
5283
|
const message = createBaseCreateTaskOnMechainResponse();
|
|
5278
5284
|
while (reader.pos < end) {
|
|
5279
5285
|
const tag = reader.uint32();
|
|
@@ -5359,7 +5365,7 @@ var AuthenticatedUserData = {
|
|
|
5359
5365
|
},
|
|
5360
5366
|
decode(input, length) {
|
|
5361
5367
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5362
|
-
|
|
5368
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5363
5369
|
const message = createBaseAuthenticatedUserData();
|
|
5364
5370
|
while (reader.pos < end) {
|
|
5365
5371
|
const tag = reader.uint32();
|
|
@@ -5451,7 +5457,7 @@ var AuthenticationRequest = {
|
|
|
5451
5457
|
},
|
|
5452
5458
|
decode(input, length) {
|
|
5453
5459
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5454
|
-
|
|
5460
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5455
5461
|
const message = createBaseAuthenticationRequest();
|
|
5456
5462
|
while (reader.pos < end) {
|
|
5457
5463
|
const tag = reader.uint32();
|
|
@@ -5522,7 +5528,7 @@ var InitRequest = {
|
|
|
5522
5528
|
},
|
|
5523
5529
|
decode(input, length) {
|
|
5524
5530
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5525
|
-
|
|
5531
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5526
5532
|
const message = createBaseInitRequest();
|
|
5527
5533
|
while (reader.pos < end) {
|
|
5528
5534
|
const tag = reader.uint32();
|
|
@@ -5602,7 +5608,7 @@ var InitResponse = {
|
|
|
5602
5608
|
},
|
|
5603
5609
|
decode(input, length) {
|
|
5604
5610
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5605
|
-
|
|
5611
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5606
5612
|
const message = createBaseInitResponse();
|
|
5607
5613
|
while (reader.pos < end) {
|
|
5608
5614
|
const tag = reader.uint32();
|
|
@@ -5670,7 +5676,7 @@ var TOPRFRequest = {
|
|
|
5670
5676
|
},
|
|
5671
5677
|
decode(input, length) {
|
|
5672
5678
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5673
|
-
|
|
5679
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5674
5680
|
const message = createBaseTOPRFRequest();
|
|
5675
5681
|
while (reader.pos < end) {
|
|
5676
5682
|
const tag = reader.uint32();
|
|
@@ -5749,7 +5755,7 @@ var TOPRFResponse = {
|
|
|
5749
5755
|
},
|
|
5750
5756
|
decode(input, length) {
|
|
5751
5757
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5752
|
-
|
|
5758
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5753
5759
|
const message = createBaseTOPRFResponse();
|
|
5754
5760
|
while (reader.pos < end) {
|
|
5755
5761
|
const tag = reader.uint32();
|
|
@@ -5936,7 +5942,7 @@ var RPCMessage = {
|
|
|
5936
5942
|
},
|
|
5937
5943
|
decode(input, length) {
|
|
5938
5944
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5939
|
-
|
|
5945
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5940
5946
|
const message = createBaseRPCMessage();
|
|
5941
5947
|
while (reader.pos < end) {
|
|
5942
5948
|
const tag = reader.uint32();
|
|
@@ -6277,7 +6283,7 @@ var RPCMessages = {
|
|
|
6277
6283
|
},
|
|
6278
6284
|
decode(input, length) {
|
|
6279
6285
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
6280
|
-
|
|
6286
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
6281
6287
|
const message = createBaseRPCMessages();
|
|
6282
6288
|
while (reader.pos < end) {
|
|
6283
6289
|
const tag = reader.uint32();
|
|
@@ -6813,18 +6819,20 @@ function makeHttpResponseParser() {
|
|
|
6813
6819
|
return line;
|
|
6814
6820
|
}
|
|
6815
6821
|
}
|
|
6816
|
-
function
|
|
6822
|
+
function extractRequestBufferFromTranscript(receipt) {
|
|
6817
6823
|
const clientMsgs = receipt.filter((s) => s.sender === "client");
|
|
6818
6824
|
if (clientMsgs[0].message[0] === REDACTION_CHAR_CODE2) {
|
|
6819
6825
|
throw new Error("First client message request is redacted. Cannot parse");
|
|
6820
6826
|
}
|
|
6827
|
+
return concatenateUint8Arrays2(clientMsgs.map((m) => m.message));
|
|
6828
|
+
}
|
|
6829
|
+
function getHttpRequestDataFromTranscript(requestBuffer) {
|
|
6821
6830
|
const request = {
|
|
6822
6831
|
method: "",
|
|
6823
6832
|
url: "",
|
|
6824
6833
|
protocol: "",
|
|
6825
6834
|
headers: {}
|
|
6826
6835
|
};
|
|
6827
|
-
let requestBuffer = concatenateUint8Arrays2(clientMsgs.map((m) => m.message));
|
|
6828
6836
|
for (let line = getLine(); typeof line !== "undefined"; line = getLine()) {
|
|
6829
6837
|
if (line === "") {
|
|
6830
6838
|
break;
|
|
@@ -6893,7 +6901,7 @@ var WS_PATHNAME = "/ws";
|
|
|
6893
6901
|
var BROWSER_RPC_PATHNAME = "/browser-rpc";
|
|
6894
6902
|
var DEFAULT_REMOTE_FILE_FETCH_BASE_URL = `${BROWSER_RPC_PATHNAME}/resources`;
|
|
6895
6903
|
var MAX_CLAIM_TIMESTAMP_DIFF_S = 10 * 60;
|
|
6896
|
-
var CURRENT_ATTESTOR_VERSION = AttestorVersion.
|
|
6904
|
+
var CURRENT_ATTESTOR_VERSION = AttestorVersion.ATTESTOR_VERSION_3_1_0;
|
|
6897
6905
|
var DEFAULT_METADATA = {
|
|
6898
6906
|
signatureType: ServiceSignatureType.SERVICE_SIGNATURE_TYPE_ETH,
|
|
6899
6907
|
clientVersion: CURRENT_ATTESTOR_VERSION,
|
|
@@ -8643,7 +8651,8 @@ function generateRequstAndResponseFromTranscript(transcript, tlsVersion) {
|
|
|
8643
8651
|
sender: b.sender
|
|
8644
8652
|
});
|
|
8645
8653
|
}
|
|
8646
|
-
const
|
|
8654
|
+
const reqTranscript = extractRequestBufferFromTranscript(packets);
|
|
8655
|
+
const req = getHttpRequestDataFromTranscript(reqTranscript);
|
|
8647
8656
|
const responsePackets = concatenateUint8Arrays6(packets.filter((p) => p.sender === "server").map((p) => p.message).filter((b) => !b.every((b2) => b2 === REDACTION_CHAR_CODE2)));
|
|
8648
8657
|
const res = parseHttpResponse(responsePackets);
|
|
8649
8658
|
return { req, res };
|
|
@@ -8656,6 +8665,7 @@ function isValidProxySessionId(sessionId) {
|
|
|
8656
8665
|
|
|
8657
8666
|
// src/providers/http/index.ts
|
|
8658
8667
|
var OK_HTTP_HEADER = "HTTP/1.1 200";
|
|
8668
|
+
var MAX_REDACTIONS_IN_PATH = 96;
|
|
8659
8669
|
var dateHeaderRegex = "[dD]ate: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-3][0-9]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?:[0-9]{4}) (?:[01][0-9]|2[0-3])(?::[0-5][0-9]){2} GMT)";
|
|
8660
8670
|
var dateDiff = 1e3 * 60 * 10;
|
|
8661
8671
|
var HTTP_PROVIDER = {
|
|
@@ -8711,8 +8721,8 @@ var HTTP_PROVIDER = {
|
|
|
8711
8721
|
const httpReqHeaderStr = [
|
|
8712
8722
|
reqLine,
|
|
8713
8723
|
`Host: ${getHostHeaderString(url)}`,
|
|
8714
|
-
`Content-Length: ${contentLength}`,
|
|
8715
8724
|
"Connection: close",
|
|
8725
|
+
`Content-Length: ${contentLength}`,
|
|
8716
8726
|
//no compression
|
|
8717
8727
|
"Accept-Encoding: identity",
|
|
8718
8728
|
...buildHeaders(pubHeaders),
|
|
@@ -8825,23 +8835,27 @@ var HTTP_PROVIDER = {
|
|
|
8825
8835
|
redactions.sort((a, b) => a.toIndex - b.toIndex);
|
|
8826
8836
|
return redactions;
|
|
8827
8837
|
},
|
|
8828
|
-
assertValidProviderReceipt({ receipt, params: paramsAny, logger: logger2, ctx }) {
|
|
8838
|
+
assertValidProviderReceipt({ clientVersion, receipt, params: paramsAny, logger: logger2, ctx }) {
|
|
8829
8839
|
logTranscript();
|
|
8830
8840
|
let extractedParams = {};
|
|
8831
8841
|
const secretParams = "secretParams" in paramsAny ? paramsAny.secretParams : void 0;
|
|
8832
8842
|
const newParams = substituteParamValues(paramsAny, secretParams, !secretParams);
|
|
8833
8843
|
const params = newParams.newParams;
|
|
8834
8844
|
extractedParams = { ...extractedParams, ...newParams.extractedValues };
|
|
8835
|
-
const req = getHttpRequestDataFromTranscript(receipt);
|
|
8836
|
-
if (req.method !== params.method.toLowerCase()) {
|
|
8837
|
-
throw new Error(`Invalid method: ${req.method}`);
|
|
8838
|
-
}
|
|
8839
8845
|
const url = new URL(params.url);
|
|
8840
8846
|
const { protocol, pathname } = url;
|
|
8841
8847
|
if (protocol !== "https:") {
|
|
8842
8848
|
logger2.error("params URL: %s", params.url);
|
|
8843
8849
|
throw new Error(`Expected protocol: https, found: ${protocol}`);
|
|
8844
8850
|
}
|
|
8851
|
+
const reqBuffer = extractRequestBufferFromTranscript(receipt);
|
|
8852
|
+
if (clientVersion >= AttestorVersion.ATTESTOR_VERSION_3_1_0) {
|
|
8853
|
+
assertNoSmuggle(reqBuffer, params);
|
|
8854
|
+
}
|
|
8855
|
+
const req = getHttpRequestDataFromTranscript(reqBuffer);
|
|
8856
|
+
if (req.method !== params.method.toLowerCase()) {
|
|
8857
|
+
throw new Error(`Invalid method: ${req.method}`);
|
|
8858
|
+
}
|
|
8845
8859
|
const searchParams = params.url.includes("?") ? params.url.split("?")[1] : "";
|
|
8846
8860
|
const expectedPath = pathname.replaceAll("%7B", "{").replaceAll("%7D", "}") + (searchParams?.length ? "?" + searchParams : "");
|
|
8847
8861
|
if (!matchRedactedStrings(strToUint8Array(expectedPath), strToUint8Array(req.url))) {
|
|
@@ -8956,10 +8970,34 @@ var HTTP_PROVIDER = {
|
|
|
8956
8970
|
const serverMsgs = receipt.filter((s) => s.sender === "server").map((m) => m.message);
|
|
8957
8971
|
const clientTranscript = encodeBase643(concatenateUint8Arrays7(clientMsgs));
|
|
8958
8972
|
const serverTranscript = encodeBase643(concatenateUint8Arrays7(serverMsgs));
|
|
8959
|
-
logger2.debug({
|
|
8973
|
+
logger2.debug({
|
|
8974
|
+
requestBytes: clientTranscript.length,
|
|
8975
|
+
responseBytes: serverTranscript.length
|
|
8976
|
+
}, "http transcript captured");
|
|
8960
8977
|
}
|
|
8961
8978
|
}
|
|
8962
8979
|
};
|
|
8980
|
+
function assertNoSmuggle(reqBuffer, params) {
|
|
8981
|
+
const reqStr = uint8ArrayToBinaryStr2(reqBuffer);
|
|
8982
|
+
const expRegex = makeRegex(
|
|
8983
|
+
`^${params.method} (?<path>[^\\s]+) HTTP\\/1\\.1\\r\\nHost: ${getHostHeaderString(new URL(params.url))}\\r\\nConnection: close\\r\\n`
|
|
8984
|
+
);
|
|
8985
|
+
const rslt = expRegex.exec(reqStr);
|
|
8986
|
+
if (!rslt?.groups?.path) {
|
|
8987
|
+
throw new Error(
|
|
8988
|
+
"Method/Host mismatch, or first 2 headers were not Host and Connection"
|
|
8989
|
+
);
|
|
8990
|
+
}
|
|
8991
|
+
let redInPathCount = 0;
|
|
8992
|
+
for (const char of rslt.groups.path) {
|
|
8993
|
+
if (char === REDACTION_CHAR) {
|
|
8994
|
+
redInPathCount++;
|
|
8995
|
+
}
|
|
8996
|
+
}
|
|
8997
|
+
if (redInPathCount > MAX_REDACTIONS_IN_PATH) {
|
|
8998
|
+
throw new Error(`Too many redactions in URL path: ${redInPathCount}`);
|
|
8999
|
+
}
|
|
9000
|
+
}
|
|
8963
9001
|
function shouldRevealCrlf({ version }) {
|
|
8964
9002
|
return version >= AttestorVersion.ATTESTOR_VERSION_2_0_1;
|
|
8965
9003
|
}
|
|
@@ -9669,6 +9707,7 @@ async function _createClaimOnAttestor({
|
|
|
9669
9707
|
}
|
|
9670
9708
|
}
|
|
9671
9709
|
await provider.assertValidProviderReceipt({
|
|
9710
|
+
clientVersion: client.metadata.clientVersion,
|
|
9672
9711
|
receipt: revealedPackets,
|
|
9673
9712
|
params: {
|
|
9674
9713
|
...params,
|
|
@@ -10196,10 +10235,18 @@ async function _handleIncomingMessage(req) {
|
|
|
10196
10235
|
return;
|
|
10197
10236
|
}
|
|
10198
10237
|
if (!reqId) {
|
|
10199
|
-
logger.warn({ req }, "Window RPC request missing ID");
|
|
10238
|
+
logger.warn({ type: req.type }, "Window RPC request missing ID");
|
|
10200
10239
|
return;
|
|
10201
10240
|
}
|
|
10202
|
-
logger.info(
|
|
10241
|
+
logger.info(
|
|
10242
|
+
{
|
|
10243
|
+
reqId,
|
|
10244
|
+
type: req.type,
|
|
10245
|
+
module: req.module,
|
|
10246
|
+
channel: req.channel
|
|
10247
|
+
},
|
|
10248
|
+
"processing RPC request"
|
|
10249
|
+
);
|
|
10203
10250
|
switch (req.type) {
|
|
10204
10251
|
case "createClaim":
|
|
10205
10252
|
const claimTunnelRes = await createClaimOnAttestor({
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { TextDecoder, TextEncoder } from '@kayahr/text-encoding';
|
|
2
|
+
import { crypto, uint8ArrayToBinaryStr } from '@reclaimprotocol/tls';
|
|
3
|
+
import { fromByteArray, toByteArray } from 'base64-js';
|
|
4
|
+
import { EventTarget } from 'event-target-shim';
|
|
5
|
+
if (typeof global === 'undefined') {
|
|
6
|
+
globalThis.global = globalThis;
|
|
7
|
+
}
|
|
8
|
+
if (typeof console === 'undefined') {
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
globalThis.console = {
|
|
11
|
+
log: print,
|
|
12
|
+
error: print,
|
|
13
|
+
warn: print,
|
|
14
|
+
info: print,
|
|
15
|
+
debug: print,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (typeof globalThis.crypto === 'undefined') {
|
|
19
|
+
globalThis.crypto = {
|
|
20
|
+
// @ts-expect-error
|
|
21
|
+
getRandomValues(arr) {
|
|
22
|
+
const randVals = crypto.randomBytes(arr.length);
|
|
23
|
+
for (let i = 0; i < arr.length; i++) {
|
|
24
|
+
arr[i] = randVals[i];
|
|
25
|
+
}
|
|
26
|
+
return arr;
|
|
27
|
+
},
|
|
28
|
+
randomBytes(length) {
|
|
29
|
+
return crypto.randomBytes(length);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (typeof globalThis.TextEncoder === 'undefined') {
|
|
34
|
+
globalThis.TextEncoder = TextEncoder;
|
|
35
|
+
}
|
|
36
|
+
if (typeof globalThis.TextDecoder === 'undefined') {
|
|
37
|
+
globalThis.TextDecoder = TextDecoder;
|
|
38
|
+
}
|
|
39
|
+
if (typeof globalThis.EventTarget === 'undefined') {
|
|
40
|
+
globalThis.EventTarget = EventTarget;
|
|
41
|
+
}
|
|
42
|
+
if (typeof globalThis.atob === 'undefined') {
|
|
43
|
+
globalThis.atob = a => uint8ArrayToBinaryStr(toByteArray(a));
|
|
44
|
+
}
|
|
45
|
+
if (typeof globalThis.btoa === 'undefined') {
|
|
46
|
+
function binaryStringToUint8Array(binaryString) {
|
|
47
|
+
const uint8Array = new Uint8Array(binaryString.length);
|
|
48
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
49
|
+
uint8Array[i] = binaryString.charCodeAt(i);
|
|
50
|
+
}
|
|
51
|
+
return uint8Array;
|
|
52
|
+
}
|
|
53
|
+
globalThis.btoa = b => fromByteArray(binaryStringToUint8Array(b));
|
|
54
|
+
}
|
|
55
|
+
if (typeof globalThis.clearTimeout === 'undefined') {
|
|
56
|
+
const ogSettimeout = globalThis.setTimeout;
|
|
57
|
+
if (!ogSettimeout) {
|
|
58
|
+
throw new Error('setTimeout is not defined, no polyfill yet');
|
|
59
|
+
}
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
globalThis.setTimeout = (fn, delayMs, ...args) => {
|
|
62
|
+
let aborted = false;
|
|
63
|
+
const abortableFn = (...args) => {
|
|
64
|
+
if (aborted) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
return fn(...args);
|
|
68
|
+
};
|
|
69
|
+
const val = ogSettimeout(abortableFn, delayMs, ...args);
|
|
70
|
+
return {
|
|
71
|
+
original: val,
|
|
72
|
+
abort() {
|
|
73
|
+
aborted = true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
globalThis.clearTimeout = (id) => {
|
|
78
|
+
if (typeof id === 'object' && !!id && 'abort' in id) {
|
|
79
|
+
id.abort();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { URL as WHATWG_URL } from 'whatwg-url';
|
|
2
|
+
import { CloseEventPolyfill, ErrorEventPolyfill, EventPolyfill, MessageEventPolyfill } from "./event.js";
|
|
3
|
+
import { RPCWebSocket } from "./ws.js";
|
|
4
|
+
if (typeof globalThis.URL === 'undefined') {
|
|
5
|
+
globalThis.URL = WHATWG_URL;
|
|
6
|
+
}
|
|
7
|
+
if (typeof globalThis.Event === 'undefined') {
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
globalThis.Event = EventPolyfill;
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
globalThis.ErrorEvent = ErrorEventPolyfill;
|
|
12
|
+
// @ts-expect-error
|
|
13
|
+
globalThis.CloseEvent = CloseEventPolyfill;
|
|
14
|
+
// @ts-expect-error
|
|
15
|
+
globalThis.MessageEvent = MessageEventPolyfill;
|
|
16
|
+
}
|
|
17
|
+
if (typeof globalThis.WebSocket === 'undefined') {
|
|
18
|
+
// @ts-expect-error
|
|
19
|
+
globalThis.WebSocket = RPCWebSocket;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @ts-expect-error
|
|
2
|
+
export class EventPolyfill {
|
|
3
|
+
type;
|
|
4
|
+
constructor(type, eventInitDict) {
|
|
5
|
+
this.type = type;
|
|
6
|
+
Object.assign(this, eventInitDict);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class ErrorEventPolyfill extends EventPolyfill {
|
|
10
|
+
}
|
|
11
|
+
export class CloseEventPolyfill extends EventPolyfill {
|
|
12
|
+
}
|
|
13
|
+
export class MessageEventPolyfill extends EventPolyfill {
|
|
14
|
+
}
|