@reclaimprotocol/attestor-core 5.0.3 → 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
package/lib/index.js
CHANGED
|
@@ -154,6 +154,7 @@ var AttestorVersion = {
|
|
|
154
154
|
ATTESTOR_VERSION_2_0_0: 3,
|
|
155
155
|
ATTESTOR_VERSION_2_0_1: 4,
|
|
156
156
|
ATTESTOR_VERSION_3_0_0: 5,
|
|
157
|
+
ATTESTOR_VERSION_3_1_0: 6,
|
|
157
158
|
UNRECOGNIZED: -1
|
|
158
159
|
};
|
|
159
160
|
function attestorVersionFromJSON(object) {
|
|
@@ -176,6 +177,9 @@ function attestorVersionFromJSON(object) {
|
|
|
176
177
|
case 5:
|
|
177
178
|
case "ATTESTOR_VERSION_3_0_0":
|
|
178
179
|
return AttestorVersion.ATTESTOR_VERSION_3_0_0;
|
|
180
|
+
case 6:
|
|
181
|
+
case "ATTESTOR_VERSION_3_1_0":
|
|
182
|
+
return AttestorVersion.ATTESTOR_VERSION_3_1_0;
|
|
179
183
|
case -1:
|
|
180
184
|
case "UNRECOGNIZED":
|
|
181
185
|
default:
|
|
@@ -196,6 +200,8 @@ function attestorVersionToJSON(object) {
|
|
|
196
200
|
return "ATTESTOR_VERSION_2_0_1";
|
|
197
201
|
case AttestorVersion.ATTESTOR_VERSION_3_0_0:
|
|
198
202
|
return "ATTESTOR_VERSION_3_0_0";
|
|
203
|
+
case AttestorVersion.ATTESTOR_VERSION_3_1_0:
|
|
204
|
+
return "ATTESTOR_VERSION_3_1_0";
|
|
199
205
|
case AttestorVersion.UNRECOGNIZED:
|
|
200
206
|
default:
|
|
201
207
|
return "UNRECOGNIZED";
|
|
@@ -358,7 +364,7 @@ function createBaseClaimContext() {
|
|
|
358
364
|
}
|
|
359
365
|
var ClaimContext = {
|
|
360
366
|
encode(message, writer = new BinaryWriter()) {
|
|
361
|
-
Object.entries(message.extractedParameters).forEach(([key, value]) => {
|
|
367
|
+
globalThis.Object.entries(message.extractedParameters).forEach(([key, value]) => {
|
|
362
368
|
ClaimContext_ExtractedParametersEntry.encode({ key, value }, writer.uint32(10).fork()).join();
|
|
363
369
|
});
|
|
364
370
|
if (message.providerHash !== "") {
|
|
@@ -368,7 +374,7 @@ var ClaimContext = {
|
|
|
368
374
|
},
|
|
369
375
|
decode(input, length) {
|
|
370
376
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
371
|
-
|
|
377
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
372
378
|
const message = createBaseClaimContext();
|
|
373
379
|
while (reader.pos < end) {
|
|
374
380
|
const tag = reader.uint32();
|
|
@@ -400,17 +406,20 @@ var ClaimContext = {
|
|
|
400
406
|
},
|
|
401
407
|
fromJSON(object) {
|
|
402
408
|
return {
|
|
403
|
-
extractedParameters: isObject(object.extractedParameters) ? Object.entries(object.extractedParameters).reduce(
|
|
404
|
-
acc[key]
|
|
405
|
-
|
|
406
|
-
|
|
409
|
+
extractedParameters: isObject(object.extractedParameters) ? globalThis.Object.entries(object.extractedParameters).reduce(
|
|
410
|
+
(acc, [key, value]) => {
|
|
411
|
+
acc[key] = globalThis.String(value);
|
|
412
|
+
return acc;
|
|
413
|
+
},
|
|
414
|
+
{}
|
|
415
|
+
) : {},
|
|
407
416
|
providerHash: isSet(object.providerHash) ? globalThis.String(object.providerHash) : ""
|
|
408
417
|
};
|
|
409
418
|
},
|
|
410
419
|
toJSON(message) {
|
|
411
420
|
const obj = {};
|
|
412
421
|
if (message.extractedParameters) {
|
|
413
|
-
const entries = Object.entries(message.extractedParameters);
|
|
422
|
+
const entries = globalThis.Object.entries(message.extractedParameters);
|
|
414
423
|
if (entries.length > 0) {
|
|
415
424
|
obj.extractedParameters = {};
|
|
416
425
|
entries.forEach(([k, v]) => {
|
|
@@ -428,15 +437,12 @@ var ClaimContext = {
|
|
|
428
437
|
},
|
|
429
438
|
fromPartial(object) {
|
|
430
439
|
const message = createBaseClaimContext();
|
|
431
|
-
message.extractedParameters = Object.entries(object.extractedParameters ?? {}).reduce(
|
|
432
|
-
(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
},
|
|
438
|
-
{}
|
|
439
|
-
);
|
|
440
|
+
message.extractedParameters = globalThis.Object.entries(object.extractedParameters ?? {}).reduce((acc, [key, value]) => {
|
|
441
|
+
if (value !== void 0) {
|
|
442
|
+
acc[key] = globalThis.String(value);
|
|
443
|
+
}
|
|
444
|
+
return acc;
|
|
445
|
+
}, {});
|
|
440
446
|
message.providerHash = object.providerHash ?? "";
|
|
441
447
|
return message;
|
|
442
448
|
}
|
|
@@ -456,7 +462,7 @@ var ClaimContext_ExtractedParametersEntry = {
|
|
|
456
462
|
},
|
|
457
463
|
decode(input, length) {
|
|
458
464
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
459
|
-
|
|
465
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
460
466
|
const message = createBaseClaimContext_ExtractedParametersEntry();
|
|
461
467
|
while (reader.pos < end) {
|
|
462
468
|
const tag = reader.uint32();
|
|
@@ -539,7 +545,7 @@ var ProviderClaimData = {
|
|
|
539
545
|
},
|
|
540
546
|
decode(input, length) {
|
|
541
547
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
542
|
-
|
|
548
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
543
549
|
const message = createBaseProviderClaimData();
|
|
544
550
|
while (reader.pos < end) {
|
|
545
551
|
const tag = reader.uint32();
|
|
@@ -670,7 +676,7 @@ var ProviderClaimInfo = {
|
|
|
670
676
|
},
|
|
671
677
|
decode(input, length) {
|
|
672
678
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
673
|
-
|
|
679
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
674
680
|
const message = createBaseProviderClaimInfo();
|
|
675
681
|
while (reader.pos < end) {
|
|
676
682
|
const tag = reader.uint32();
|
|
@@ -753,7 +759,7 @@ var ErrorData = {
|
|
|
753
759
|
},
|
|
754
760
|
decode(input, length) {
|
|
755
761
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
756
|
-
|
|
762
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
757
763
|
const message = createBaseErrorData();
|
|
758
764
|
while (reader.pos < end) {
|
|
759
765
|
const tag = reader.uint32();
|
|
@@ -842,7 +848,7 @@ var CreateTunnelRequest = {
|
|
|
842
848
|
},
|
|
843
849
|
decode(input, length) {
|
|
844
850
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
845
|
-
|
|
851
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
846
852
|
const message = createBaseCreateTunnelRequest();
|
|
847
853
|
while (reader.pos < end) {
|
|
848
854
|
const tag = reader.uint32();
|
|
@@ -943,7 +949,7 @@ var FetchCertificateBytesRequest = {
|
|
|
943
949
|
},
|
|
944
950
|
decode(input, length) {
|
|
945
951
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
946
|
-
|
|
952
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
947
953
|
const message = createBaseFetchCertificateBytesRequest();
|
|
948
954
|
while (reader.pos < end) {
|
|
949
955
|
const tag = reader.uint32();
|
|
@@ -994,7 +1000,7 @@ var FetchCertificateBytesResponse = {
|
|
|
994
1000
|
},
|
|
995
1001
|
decode(input, length) {
|
|
996
1002
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
997
|
-
|
|
1003
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
998
1004
|
const message = createBaseFetchCertificateBytesResponse();
|
|
999
1005
|
while (reader.pos < end) {
|
|
1000
1006
|
const tag = reader.uint32();
|
|
@@ -1045,7 +1051,7 @@ var DisconnectTunnelRequest = {
|
|
|
1045
1051
|
},
|
|
1046
1052
|
decode(input, length) {
|
|
1047
1053
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1048
|
-
|
|
1054
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1049
1055
|
const message = createBaseDisconnectTunnelRequest();
|
|
1050
1056
|
while (reader.pos < end) {
|
|
1051
1057
|
const tag = reader.uint32();
|
|
@@ -1093,7 +1099,7 @@ var Empty = {
|
|
|
1093
1099
|
},
|
|
1094
1100
|
decode(input, length) {
|
|
1095
1101
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1096
|
-
|
|
1102
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1097
1103
|
const message = createBaseEmpty();
|
|
1098
1104
|
while (reader.pos < end) {
|
|
1099
1105
|
const tag = reader.uint32();
|
|
@@ -1136,7 +1142,7 @@ var TunnelMessage = {
|
|
|
1136
1142
|
},
|
|
1137
1143
|
decode(input, length) {
|
|
1138
1144
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1139
|
-
|
|
1145
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1140
1146
|
const message = createBaseTunnelMessage();
|
|
1141
1147
|
while (reader.pos < end) {
|
|
1142
1148
|
const tag = reader.uint32();
|
|
@@ -1204,7 +1210,7 @@ var TunnelDisconnectEvent = {
|
|
|
1204
1210
|
},
|
|
1205
1211
|
decode(input, length) {
|
|
1206
1212
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1207
|
-
|
|
1213
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1208
1214
|
const message = createBaseTunnelDisconnectEvent();
|
|
1209
1215
|
while (reader.pos < end) {
|
|
1210
1216
|
const tag = reader.uint32();
|
|
@@ -1272,7 +1278,7 @@ var MessageReveal = {
|
|
|
1272
1278
|
},
|
|
1273
1279
|
decode(input, length) {
|
|
1274
1280
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1275
|
-
|
|
1281
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1276
1282
|
const message = createBaseMessageReveal();
|
|
1277
1283
|
while (reader.pos < end) {
|
|
1278
1284
|
const tag = reader.uint32();
|
|
@@ -1343,7 +1349,7 @@ var MessageReveal_MessageRevealDirect = {
|
|
|
1343
1349
|
},
|
|
1344
1350
|
decode(input, length) {
|
|
1345
1351
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1346
|
-
|
|
1352
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1347
1353
|
const message = createBaseMessageReveal_MessageRevealDirect();
|
|
1348
1354
|
while (reader.pos < end) {
|
|
1349
1355
|
const tag = reader.uint32();
|
|
@@ -1429,7 +1435,7 @@ var MessageReveal_MessageRevealZk = {
|
|
|
1429
1435
|
},
|
|
1430
1436
|
decode(input, length) {
|
|
1431
1437
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1432
|
-
|
|
1438
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1433
1439
|
const message = createBaseMessageReveal_MessageRevealZk();
|
|
1434
1440
|
while (reader.pos < end) {
|
|
1435
1441
|
const tag = reader.uint32();
|
|
@@ -1518,7 +1524,7 @@ var MessageReveal_OPRFRawMarker = {
|
|
|
1518
1524
|
},
|
|
1519
1525
|
decode(input, length) {
|
|
1520
1526
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1521
|
-
|
|
1527
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1522
1528
|
const message = createBaseMessageReveal_OPRFRawMarker();
|
|
1523
1529
|
while (reader.pos < end) {
|
|
1524
1530
|
const tag = reader.uint32();
|
|
@@ -1583,7 +1589,7 @@ var MessageReveal_ZKProof = {
|
|
|
1583
1589
|
},
|
|
1584
1590
|
decode(input, length) {
|
|
1585
1591
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1586
|
-
|
|
1592
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1587
1593
|
const message = createBaseMessageReveal_ZKProof();
|
|
1588
1594
|
while (reader.pos < end) {
|
|
1589
1595
|
const tag = reader.uint32();
|
|
@@ -1678,7 +1684,7 @@ var MessageReveal_TOPRFProof = {
|
|
|
1678
1684
|
},
|
|
1679
1685
|
decode(input, length) {
|
|
1680
1686
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1681
|
-
|
|
1687
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1682
1688
|
const message = createBaseMessageReveal_TOPRFProof();
|
|
1683
1689
|
while (reader.pos < end) {
|
|
1684
1690
|
const tag = reader.uint32();
|
|
@@ -1761,7 +1767,7 @@ var TOPRFPayload = {
|
|
|
1761
1767
|
},
|
|
1762
1768
|
decode(input, length) {
|
|
1763
1769
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1764
|
-
|
|
1770
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1765
1771
|
const message = createBaseTOPRFPayload();
|
|
1766
1772
|
while (reader.pos < end) {
|
|
1767
1773
|
const tag = reader.uint32();
|
|
@@ -1841,7 +1847,7 @@ var DataSlice = {
|
|
|
1841
1847
|
},
|
|
1842
1848
|
decode(input, length) {
|
|
1843
1849
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1844
|
-
|
|
1850
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1845
1851
|
const message = createBaseDataSlice();
|
|
1846
1852
|
while (reader.pos < end) {
|
|
1847
1853
|
const tag = reader.uint32();
|
|
@@ -1918,7 +1924,7 @@ var ClaimRequestData = {
|
|
|
1918
1924
|
},
|
|
1919
1925
|
decode(input, length) {
|
|
1920
1926
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1921
|
-
|
|
1927
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1922
1928
|
const message = createBaseClaimRequestData();
|
|
1923
1929
|
while (reader.pos < end) {
|
|
1924
1930
|
const tag = reader.uint32();
|
|
@@ -2025,7 +2031,7 @@ var ClaimTeeBundleRequest = {
|
|
|
2025
2031
|
},
|
|
2026
2032
|
decode(input, length) {
|
|
2027
2033
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2028
|
-
|
|
2034
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2029
2035
|
const message = createBaseClaimTeeBundleRequest();
|
|
2030
2036
|
while (reader.pos < end) {
|
|
2031
2037
|
const tag = reader.uint32();
|
|
@@ -2102,7 +2108,7 @@ var ClaimTeeBundleRequest_Signatures = {
|
|
|
2102
2108
|
},
|
|
2103
2109
|
decode(input, length) {
|
|
2104
2110
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2105
|
-
|
|
2111
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2106
2112
|
const message = createBaseClaimTeeBundleRequest_Signatures();
|
|
2107
2113
|
while (reader.pos < end) {
|
|
2108
2114
|
const tag = reader.uint32();
|
|
@@ -2164,7 +2170,7 @@ var ClaimTeeBundleResponse = {
|
|
|
2164
2170
|
},
|
|
2165
2171
|
decode(input, length) {
|
|
2166
2172
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2167
|
-
|
|
2173
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2168
2174
|
const message = createBaseClaimTeeBundleResponse();
|
|
2169
2175
|
while (reader.pos < end) {
|
|
2170
2176
|
const tag = reader.uint32();
|
|
@@ -2259,7 +2265,7 @@ var ClaimTeeBundleResponse_Signatures = {
|
|
|
2259
2265
|
},
|
|
2260
2266
|
decode(input, length) {
|
|
2261
2267
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2262
|
-
|
|
2268
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2263
2269
|
const message = createBaseClaimTeeBundleResponse_Signatures();
|
|
2264
2270
|
while (reader.pos < end) {
|
|
2265
2271
|
const tag = reader.uint32();
|
|
@@ -2362,7 +2368,7 @@ var ClaimTunnelRequest = {
|
|
|
2362
2368
|
},
|
|
2363
2369
|
decode(input, length) {
|
|
2364
2370
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2365
|
-
|
|
2371
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2366
2372
|
const message = createBaseClaimTunnelRequest();
|
|
2367
2373
|
while (reader.pos < end) {
|
|
2368
2374
|
const tag = reader.uint32();
|
|
@@ -2487,7 +2493,7 @@ var ClaimTunnelRequest_Signatures = {
|
|
|
2487
2493
|
},
|
|
2488
2494
|
decode(input, length) {
|
|
2489
2495
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2490
|
-
|
|
2496
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2491
2497
|
const message = createBaseClaimTunnelRequest_Signatures();
|
|
2492
2498
|
while (reader.pos < end) {
|
|
2493
2499
|
const tag = reader.uint32();
|
|
@@ -2546,7 +2552,7 @@ var ClaimTunnelRequest_TranscriptMessage = {
|
|
|
2546
2552
|
},
|
|
2547
2553
|
decode(input, length) {
|
|
2548
2554
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2549
|
-
|
|
2555
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2550
2556
|
const message = createBaseClaimTunnelRequest_TranscriptMessage();
|
|
2551
2557
|
while (reader.pos < end) {
|
|
2552
2558
|
const tag = reader.uint32();
|
|
@@ -2632,7 +2638,7 @@ var ClaimTunnelResponse = {
|
|
|
2632
2638
|
},
|
|
2633
2639
|
decode(input, length) {
|
|
2634
2640
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2635
|
-
|
|
2641
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2636
2642
|
const message = createBaseClaimTunnelResponse();
|
|
2637
2643
|
while (reader.pos < end) {
|
|
2638
2644
|
const tag = reader.uint32();
|
|
@@ -2727,7 +2733,7 @@ var ClaimTunnelResponse_Signatures = {
|
|
|
2727
2733
|
},
|
|
2728
2734
|
decode(input, length) {
|
|
2729
2735
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2730
|
-
|
|
2736
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2731
2737
|
const message = createBaseClaimTunnelResponse_Signatures();
|
|
2732
2738
|
while (reader.pos < end) {
|
|
2733
2739
|
const tag = reader.uint32();
|
|
@@ -2810,7 +2816,7 @@ var RequestClaimOnAvsRequest = {
|
|
|
2810
2816
|
},
|
|
2811
2817
|
decode(input, length) {
|
|
2812
2818
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2813
|
-
|
|
2819
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2814
2820
|
const message = createBaseRequestClaimOnAvsRequest();
|
|
2815
2821
|
while (reader.pos < end) {
|
|
2816
2822
|
const tag = reader.uint32();
|
|
@@ -2893,7 +2899,7 @@ var RequestClaimOnAvsResponse = {
|
|
|
2893
2899
|
},
|
|
2894
2900
|
decode(input, length) {
|
|
2895
2901
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2896
|
-
|
|
2902
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2897
2903
|
const message = createBaseRequestClaimOnAvsResponse();
|
|
2898
2904
|
while (reader.pos < end) {
|
|
2899
2905
|
const tag = reader.uint32();
|
|
@@ -2976,7 +2982,7 @@ var CompleteClaimOnAvsRequest = {
|
|
|
2976
2982
|
},
|
|
2977
2983
|
decode(input, length) {
|
|
2978
2984
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2979
|
-
|
|
2985
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
2980
2986
|
const message = createBaseCompleteClaimOnAvsRequest();
|
|
2981
2987
|
while (reader.pos < end) {
|
|
2982
2988
|
const tag = reader.uint32();
|
|
@@ -3056,7 +3062,7 @@ var CompleteClaimOnAvsResponse = {
|
|
|
3056
3062
|
},
|
|
3057
3063
|
decode(input, length) {
|
|
3058
3064
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3059
|
-
|
|
3065
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3060
3066
|
const message = createBaseCompleteClaimOnAvsResponse();
|
|
3061
3067
|
while (reader.pos < end) {
|
|
3062
3068
|
const tag = reader.uint32();
|
|
@@ -3121,7 +3127,7 @@ var CreateTaskOnMechainRequest = {
|
|
|
3121
3127
|
},
|
|
3122
3128
|
decode(input, length) {
|
|
3123
3129
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3124
|
-
|
|
3130
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3125
3131
|
const message = createBaseCreateTaskOnMechainRequest();
|
|
3126
3132
|
while (reader.pos < end) {
|
|
3127
3133
|
const tag = reader.uint32();
|
|
@@ -3178,7 +3184,7 @@ var CreateTaskOnMechainResponse = {
|
|
|
3178
3184
|
},
|
|
3179
3185
|
decode(input, length) {
|
|
3180
3186
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3181
|
-
|
|
3187
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3182
3188
|
const message = createBaseCreateTaskOnMechainResponse();
|
|
3183
3189
|
while (reader.pos < end) {
|
|
3184
3190
|
const tag = reader.uint32();
|
|
@@ -3264,7 +3270,7 @@ var AuthenticatedUserData = {
|
|
|
3264
3270
|
},
|
|
3265
3271
|
decode(input, length) {
|
|
3266
3272
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3267
|
-
|
|
3273
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3268
3274
|
const message = createBaseAuthenticatedUserData();
|
|
3269
3275
|
while (reader.pos < end) {
|
|
3270
3276
|
const tag = reader.uint32();
|
|
@@ -3356,7 +3362,7 @@ var AuthenticationRequest = {
|
|
|
3356
3362
|
},
|
|
3357
3363
|
decode(input, length) {
|
|
3358
3364
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3359
|
-
|
|
3365
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3360
3366
|
const message = createBaseAuthenticationRequest();
|
|
3361
3367
|
while (reader.pos < end) {
|
|
3362
3368
|
const tag = reader.uint32();
|
|
@@ -3427,7 +3433,7 @@ var InitRequest = {
|
|
|
3427
3433
|
},
|
|
3428
3434
|
decode(input, length) {
|
|
3429
3435
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3430
|
-
|
|
3436
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3431
3437
|
const message = createBaseInitRequest();
|
|
3432
3438
|
while (reader.pos < end) {
|
|
3433
3439
|
const tag = reader.uint32();
|
|
@@ -3507,7 +3513,7 @@ var InitResponse = {
|
|
|
3507
3513
|
},
|
|
3508
3514
|
decode(input, length) {
|
|
3509
3515
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3510
|
-
|
|
3516
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3511
3517
|
const message = createBaseInitResponse();
|
|
3512
3518
|
while (reader.pos < end) {
|
|
3513
3519
|
const tag = reader.uint32();
|
|
@@ -3575,7 +3581,7 @@ var TOPRFRequest = {
|
|
|
3575
3581
|
},
|
|
3576
3582
|
decode(input, length) {
|
|
3577
3583
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3578
|
-
|
|
3584
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3579
3585
|
const message = createBaseTOPRFRequest();
|
|
3580
3586
|
while (reader.pos < end) {
|
|
3581
3587
|
const tag = reader.uint32();
|
|
@@ -3654,7 +3660,7 @@ var TOPRFResponse = {
|
|
|
3654
3660
|
},
|
|
3655
3661
|
decode(input, length) {
|
|
3656
3662
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3657
|
-
|
|
3663
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3658
3664
|
const message = createBaseTOPRFResponse();
|
|
3659
3665
|
while (reader.pos < end) {
|
|
3660
3666
|
const tag = reader.uint32();
|
|
@@ -3841,7 +3847,7 @@ var RPCMessage = {
|
|
|
3841
3847
|
},
|
|
3842
3848
|
decode(input, length) {
|
|
3843
3849
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3844
|
-
|
|
3850
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
3845
3851
|
const message = createBaseRPCMessage();
|
|
3846
3852
|
while (reader.pos < end) {
|
|
3847
3853
|
const tag = reader.uint32();
|
|
@@ -4182,7 +4188,7 @@ var RPCMessages = {
|
|
|
4182
4188
|
},
|
|
4183
4189
|
decode(input, length) {
|
|
4184
4190
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4185
|
-
|
|
4191
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4186
4192
|
const message = createBaseRPCMessages();
|
|
4187
4193
|
while (reader.pos < end) {
|
|
4188
4194
|
const tag = reader.uint32();
|
|
@@ -4278,7 +4284,7 @@ var DNS_SERVERS = [
|
|
|
4278
4284
|
"8.8.4.4"
|
|
4279
4285
|
];
|
|
4280
4286
|
var MAX_CLAIM_TIMESTAMP_DIFF_S = 10 * 60;
|
|
4281
|
-
var CURRENT_ATTESTOR_VERSION = AttestorVersion.
|
|
4287
|
+
var CURRENT_ATTESTOR_VERSION = AttestorVersion.ATTESTOR_VERSION_3_1_0;
|
|
4282
4288
|
var DEFAULT_METADATA = {
|
|
4283
4289
|
signatureType: ServiceSignatureType.SERVICE_SIGNATURE_TYPE_ETH,
|
|
4284
4290
|
clientVersion: CURRENT_ATTESTOR_VERSION,
|
|
@@ -4908,18 +4914,20 @@ function makeHttpResponseParser() {
|
|
|
4908
4914
|
return line;
|
|
4909
4915
|
}
|
|
4910
4916
|
}
|
|
4911
|
-
function
|
|
4917
|
+
function extractRequestBufferFromTranscript(receipt) {
|
|
4912
4918
|
const clientMsgs = receipt.filter((s) => s.sender === "client");
|
|
4913
4919
|
if (clientMsgs[0].message[0] === REDACTION_CHAR_CODE2) {
|
|
4914
4920
|
throw new Error("First client message request is redacted. Cannot parse");
|
|
4915
4921
|
}
|
|
4922
|
+
return concatenateUint8Arrays2(clientMsgs.map((m) => m.message));
|
|
4923
|
+
}
|
|
4924
|
+
function getHttpRequestDataFromTranscript(requestBuffer) {
|
|
4916
4925
|
const request = {
|
|
4917
4926
|
method: "",
|
|
4918
4927
|
url: "",
|
|
4919
4928
|
protocol: "",
|
|
4920
4929
|
headers: {}
|
|
4921
4930
|
};
|
|
4922
|
-
let requestBuffer = concatenateUint8Arrays2(clientMsgs.map((m) => m.message));
|
|
4923
4931
|
for (let line = getLine(); typeof line !== "undefined"; line = getLine()) {
|
|
4924
4932
|
if (line === "") {
|
|
4925
4933
|
break;
|
|
@@ -5730,9 +5738,19 @@ function hashProviderParams(params) {
|
|
|
5730
5738
|
const filteredParams = {
|
|
5731
5739
|
url: params.url,
|
|
5732
5740
|
method: params.method,
|
|
5733
|
-
body: params.body,
|
|
5734
|
-
responseMatches: params.responseMatches
|
|
5735
|
-
|
|
5741
|
+
body: params.body ?? "",
|
|
5742
|
+
responseMatches: params.responseMatches.map((it) => ({
|
|
5743
|
+
value: it.value,
|
|
5744
|
+
type: it.type,
|
|
5745
|
+
// default undefined, even if false
|
|
5746
|
+
invert: it.invert || void 0
|
|
5747
|
+
})),
|
|
5748
|
+
responseRedactions: params.responseRedactions?.map((it) => ({
|
|
5749
|
+
xPath: it.xPath ?? "",
|
|
5750
|
+
jsonPath: it.jsonPath ?? "",
|
|
5751
|
+
regex: it.regex ?? "",
|
|
5752
|
+
hash: it.hash || void 0
|
|
5753
|
+
})) ?? []
|
|
5736
5754
|
};
|
|
5737
5755
|
const serializedParams = canonicalStringify(filteredParams);
|
|
5738
5756
|
return keccak256(
|
|
@@ -6927,6 +6945,7 @@ function isValidProxySessionId(sessionId) {
|
|
|
6927
6945
|
|
|
6928
6946
|
// src/providers/http/index.ts
|
|
6929
6947
|
var OK_HTTP_HEADER = "HTTP/1.1 200";
|
|
6948
|
+
var MAX_REDACTIONS_IN_PATH = 96;
|
|
6930
6949
|
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)";
|
|
6931
6950
|
var dateDiff = 1e3 * 60 * 10;
|
|
6932
6951
|
var HTTP_PROVIDER = {
|
|
@@ -6982,8 +7001,8 @@ var HTTP_PROVIDER = {
|
|
|
6982
7001
|
const httpReqHeaderStr = [
|
|
6983
7002
|
reqLine,
|
|
6984
7003
|
`Host: ${getHostHeaderString(url)}`,
|
|
6985
|
-
`Content-Length: ${contentLength}`,
|
|
6986
7004
|
"Connection: close",
|
|
7005
|
+
`Content-Length: ${contentLength}`,
|
|
6987
7006
|
//no compression
|
|
6988
7007
|
"Accept-Encoding: identity",
|
|
6989
7008
|
...buildHeaders(pubHeaders),
|
|
@@ -7096,23 +7115,27 @@ var HTTP_PROVIDER = {
|
|
|
7096
7115
|
redactions.sort((a, b) => a.toIndex - b.toIndex);
|
|
7097
7116
|
return redactions;
|
|
7098
7117
|
},
|
|
7099
|
-
assertValidProviderReceipt({ receipt, params: paramsAny, logger: logger2, ctx }) {
|
|
7118
|
+
assertValidProviderReceipt({ clientVersion, receipt, params: paramsAny, logger: logger2, ctx }) {
|
|
7100
7119
|
logTranscript();
|
|
7101
7120
|
let extractedParams = {};
|
|
7102
7121
|
const secretParams = "secretParams" in paramsAny ? paramsAny.secretParams : void 0;
|
|
7103
7122
|
const newParams = substituteParamValues(paramsAny, secretParams, !secretParams);
|
|
7104
7123
|
const params = newParams.newParams;
|
|
7105
7124
|
extractedParams = { ...extractedParams, ...newParams.extractedValues };
|
|
7106
|
-
const req = getHttpRequestDataFromTranscript(receipt);
|
|
7107
|
-
if (req.method !== params.method.toLowerCase()) {
|
|
7108
|
-
throw new Error(`Invalid method: ${req.method}`);
|
|
7109
|
-
}
|
|
7110
7125
|
const url = new URL(params.url);
|
|
7111
7126
|
const { protocol, pathname } = url;
|
|
7112
7127
|
if (protocol !== "https:") {
|
|
7113
7128
|
logger2.error("params URL: %s", params.url);
|
|
7114
7129
|
throw new Error(`Expected protocol: https, found: ${protocol}`);
|
|
7115
7130
|
}
|
|
7131
|
+
const reqBuffer = extractRequestBufferFromTranscript(receipt);
|
|
7132
|
+
if (clientVersion >= AttestorVersion.ATTESTOR_VERSION_3_1_0) {
|
|
7133
|
+
assertNoSmuggle(reqBuffer, params);
|
|
7134
|
+
}
|
|
7135
|
+
const req = getHttpRequestDataFromTranscript(reqBuffer);
|
|
7136
|
+
if (req.method !== params.method.toLowerCase()) {
|
|
7137
|
+
throw new Error(`Invalid method: ${req.method}`);
|
|
7138
|
+
}
|
|
7116
7139
|
const searchParams = params.url.includes("?") ? params.url.split("?")[1] : "";
|
|
7117
7140
|
const expectedPath = pathname.replaceAll("%7B", "{").replaceAll("%7D", "}") + (searchParams?.length ? "?" + searchParams : "");
|
|
7118
7141
|
if (!matchRedactedStrings(strToUint8Array(expectedPath), strToUint8Array(req.url))) {
|
|
@@ -7227,10 +7250,34 @@ var HTTP_PROVIDER = {
|
|
|
7227
7250
|
const serverMsgs = receipt.filter((s) => s.sender === "server").map((m) => m.message);
|
|
7228
7251
|
const clientTranscript = encodeBase643(concatenateUint8Arrays6(clientMsgs));
|
|
7229
7252
|
const serverTranscript = encodeBase643(concatenateUint8Arrays6(serverMsgs));
|
|
7230
|
-
logger2.debug({
|
|
7253
|
+
logger2.debug({
|
|
7254
|
+
requestBytes: clientTranscript.length,
|
|
7255
|
+
responseBytes: serverTranscript.length
|
|
7256
|
+
}, "http transcript captured");
|
|
7231
7257
|
}
|
|
7232
7258
|
}
|
|
7233
7259
|
};
|
|
7260
|
+
function assertNoSmuggle(reqBuffer, params) {
|
|
7261
|
+
const reqStr = uint8ArrayToBinaryStr2(reqBuffer);
|
|
7262
|
+
const expRegex = makeRegex(
|
|
7263
|
+
`^${params.method} (?<path>[^\\s]+) HTTP\\/1\\.1\\r\\nHost: ${getHostHeaderString(new URL(params.url))}\\r\\nConnection: close\\r\\n`
|
|
7264
|
+
);
|
|
7265
|
+
const rslt = expRegex.exec(reqStr);
|
|
7266
|
+
if (!rslt?.groups?.path) {
|
|
7267
|
+
throw new Error(
|
|
7268
|
+
"Method/Host mismatch, or first 2 headers were not Host and Connection"
|
|
7269
|
+
);
|
|
7270
|
+
}
|
|
7271
|
+
let redInPathCount = 0;
|
|
7272
|
+
for (const char of rslt.groups.path) {
|
|
7273
|
+
if (char === REDACTION_CHAR) {
|
|
7274
|
+
redInPathCount++;
|
|
7275
|
+
}
|
|
7276
|
+
}
|
|
7277
|
+
if (redInPathCount > MAX_REDACTIONS_IN_PATH) {
|
|
7278
|
+
throw new Error(`Too many redactions in URL path: ${redInPathCount}`);
|
|
7279
|
+
}
|
|
7280
|
+
}
|
|
7234
7281
|
function shouldRevealCrlf({ version }) {
|
|
7235
7282
|
return version >= AttestorVersion.ATTESTOR_VERSION_2_0_1;
|
|
7236
7283
|
}
|
|
@@ -8141,6 +8188,7 @@ async function _createClaimOnAttestor({
|
|
|
8141
8188
|
}
|
|
8142
8189
|
}
|
|
8143
8190
|
await provider.assertValidProviderReceipt({
|
|
8191
|
+
clientVersion: client.metadata.clientVersion,
|
|
8144
8192
|
receipt: revealedPackets,
|
|
8145
8193
|
params: {
|
|
8146
8194
|
...params,
|
|
@@ -8281,6 +8329,7 @@ export {
|
|
|
8281
8329
|
extractApplicationDataFromTranscript,
|
|
8282
8330
|
extractArrayBufferFromWsData,
|
|
8283
8331
|
extractHandshakeFromTranscript,
|
|
8332
|
+
extractRequestBufferFromTranscript,
|
|
8284
8333
|
findIndexInUint8Array,
|
|
8285
8334
|
generateRpcMessageId,
|
|
8286
8335
|
generateSessionId,
|