@reclaimprotocol/attestor-core 5.0.7 → 5.1.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser/resources/attestor-browser.min.mjs +37 -31
- package/lib/config/index.d.ts +2 -2
- package/lib/external-rpc/index.js +288 -36
- package/lib/index.js +307 -31
- package/lib/proto/api.d.ts +2 -0
- package/lib/proto/attest.d.ts +435 -0
- package/lib/proto/attestation.d.ts +261 -0
- package/lib/proto/google/protobuf/wrappers.d.ts +132 -0
- package/lib/proto/sevsnp.d.ts +144 -0
- package/lib/proto/state.d.ts +288 -0
- package/lib/proto/tdx.d.ts +165 -0
- package/lib/proto/tpm.d.ts +104 -0
- package/lib/providers/index.d.ts +1 -0
- package/lib/server/utils/sev-snp/allowlist.d.ts +13 -0
- package/lib/server/utils/sev-snp/gcp.d.ts +15 -0
- package/lib/server/utils/sev-snp/nitrotpm.d.ts +19 -0
- package/lib/server/utils/sev-snp/sev-report.d.ts +11 -0
- package/lib/server/utils/sev-snp/verify.d.ts +59 -0
- package/lib/server/utils/sev-snp/verify.test.d.ts +1 -0
- package/package.json +1 -1
package/lib/config/index.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export declare const API_SERVER_PORT = 8001;
|
|
|
10
10
|
export declare const CONNECTION_TIMEOUT_MS = 10000;
|
|
11
11
|
export declare const DNS_SERVERS: string[];
|
|
12
12
|
export declare const MAX_CLAIM_TIMESTAMP_DIFF_S: number;
|
|
13
|
-
export declare const CURRENT_ATTESTOR_VERSION:
|
|
13
|
+
export declare const CURRENT_ATTESTOR_VERSION: 7;
|
|
14
14
|
export declare const DEFAULT_METADATA: InitRequest;
|
|
15
15
|
export declare const PROVIDER_CTX: {
|
|
16
|
-
version:
|
|
16
|
+
version: 7;
|
|
17
17
|
};
|
|
18
18
|
export declare const PING_INTERVAL_MS = 10000;
|
|
19
19
|
/**
|
|
@@ -2489,6 +2489,7 @@ var AttestorVersion = {
|
|
|
2489
2489
|
ATTESTOR_VERSION_2_0_1: 4,
|
|
2490
2490
|
ATTESTOR_VERSION_3_0_0: 5,
|
|
2491
2491
|
ATTESTOR_VERSION_3_1_0: 6,
|
|
2492
|
+
ATTESTOR_VERSION_3_2_0: 7,
|
|
2492
2493
|
UNRECOGNIZED: -1
|
|
2493
2494
|
};
|
|
2494
2495
|
function attestorVersionFromJSON(object) {
|
|
@@ -2514,6 +2515,9 @@ function attestorVersionFromJSON(object) {
|
|
|
2514
2515
|
case 6:
|
|
2515
2516
|
case "ATTESTOR_VERSION_3_1_0":
|
|
2516
2517
|
return AttestorVersion.ATTESTOR_VERSION_3_1_0;
|
|
2518
|
+
case 7:
|
|
2519
|
+
case "ATTESTOR_VERSION_3_2_0":
|
|
2520
|
+
return AttestorVersion.ATTESTOR_VERSION_3_2_0;
|
|
2517
2521
|
case -1:
|
|
2518
2522
|
case "UNRECOGNIZED":
|
|
2519
2523
|
default:
|
|
@@ -2536,6 +2540,8 @@ function attestorVersionToJSON(object) {
|
|
|
2536
2540
|
return "ATTESTOR_VERSION_3_0_0";
|
|
2537
2541
|
case AttestorVersion.ATTESTOR_VERSION_3_1_0:
|
|
2538
2542
|
return "ATTESTOR_VERSION_3_1_0";
|
|
2543
|
+
case AttestorVersion.ATTESTOR_VERSION_3_2_0:
|
|
2544
|
+
return "ATTESTOR_VERSION_3_2_0";
|
|
2539
2545
|
case AttestorVersion.UNRECOGNIZED:
|
|
2540
2546
|
default:
|
|
2541
2547
|
return "UNRECOGNIZED";
|
|
@@ -6901,7 +6907,7 @@ var WS_PATHNAME = "/ws";
|
|
|
6901
6907
|
var BROWSER_RPC_PATHNAME = "/browser-rpc";
|
|
6902
6908
|
var DEFAULT_REMOTE_FILE_FETCH_BASE_URL = `${BROWSER_RPC_PATHNAME}/resources`;
|
|
6903
6909
|
var MAX_CLAIM_TIMESTAMP_DIFF_S = 10 * 60;
|
|
6904
|
-
var CURRENT_ATTESTOR_VERSION = AttestorVersion.
|
|
6910
|
+
var CURRENT_ATTESTOR_VERSION = AttestorVersion.ATTESTOR_VERSION_3_2_0;
|
|
6905
6911
|
var DEFAULT_METADATA = {
|
|
6906
6912
|
signatureType: ServiceSignatureType.SERVICE_SIGNATURE_TYPE_ETH,
|
|
6907
6913
|
clientVersion: CURRENT_ATTESTOR_VERSION,
|
|
@@ -8421,23 +8427,233 @@ import {
|
|
|
8421
8427
|
} from "esprima-next";
|
|
8422
8428
|
import { JSONPath } from "jsonpath-plus";
|
|
8423
8429
|
import { parse } from "parse5";
|
|
8424
|
-
|
|
8430
|
+
|
|
8431
|
+
// node_modules/parse5-htmlparser2-tree-adapter/dist/index.js
|
|
8432
|
+
import { html } from "parse5";
|
|
8433
|
+
function enquoteDoctypeId(id) {
|
|
8434
|
+
const quote = id.includes('"') ? "'" : '"';
|
|
8435
|
+
return quote + id + quote;
|
|
8436
|
+
}
|
|
8437
|
+
function serializeDoctypeContent(name, publicId, systemId) {
|
|
8438
|
+
let str = "!DOCTYPE ";
|
|
8439
|
+
if (name) {
|
|
8440
|
+
str += name;
|
|
8441
|
+
}
|
|
8442
|
+
if (publicId) {
|
|
8443
|
+
str += ` PUBLIC ${enquoteDoctypeId(publicId)}`;
|
|
8444
|
+
} else if (systemId) {
|
|
8445
|
+
str += " SYSTEM";
|
|
8446
|
+
}
|
|
8447
|
+
if (systemId) {
|
|
8448
|
+
str += ` ${enquoteDoctypeId(systemId)}`;
|
|
8449
|
+
}
|
|
8450
|
+
return str;
|
|
8451
|
+
}
|
|
8452
|
+
var adapter = {
|
|
8453
|
+
// Re-exports from domhandler
|
|
8454
|
+
isCommentNode: isComment,
|
|
8455
|
+
isElementNode: isTag2,
|
|
8456
|
+
isTextNode: isText,
|
|
8457
|
+
//Node construction
|
|
8458
|
+
createDocument() {
|
|
8459
|
+
const node = new Document([]);
|
|
8460
|
+
node["x-mode"] = html.DOCUMENT_MODE.NO_QUIRKS;
|
|
8461
|
+
return node;
|
|
8462
|
+
},
|
|
8463
|
+
createDocumentFragment() {
|
|
8464
|
+
return new Document([]);
|
|
8465
|
+
},
|
|
8466
|
+
createElement(tagName, namespaceURI, attrs) {
|
|
8467
|
+
const attribs = /* @__PURE__ */ Object.create(null);
|
|
8468
|
+
const attribsNamespace = /* @__PURE__ */ Object.create(null);
|
|
8469
|
+
const attribsPrefix = /* @__PURE__ */ Object.create(null);
|
|
8470
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
8471
|
+
const attrName = attrs[i].name;
|
|
8472
|
+
attribs[attrName] = attrs[i].value;
|
|
8473
|
+
attribsNamespace[attrName] = attrs[i].namespace;
|
|
8474
|
+
attribsPrefix[attrName] = attrs[i].prefix;
|
|
8475
|
+
}
|
|
8476
|
+
const node = new Element(tagName, attribs, []);
|
|
8477
|
+
node.namespace = namespaceURI;
|
|
8478
|
+
node["x-attribsNamespace"] = attribsNamespace;
|
|
8479
|
+
node["x-attribsPrefix"] = attribsPrefix;
|
|
8480
|
+
return node;
|
|
8481
|
+
},
|
|
8482
|
+
createCommentNode(data) {
|
|
8483
|
+
return new Comment2(data);
|
|
8484
|
+
},
|
|
8485
|
+
createTextNode(value) {
|
|
8486
|
+
return new Text2(value);
|
|
8487
|
+
},
|
|
8488
|
+
//Tree mutation
|
|
8489
|
+
appendChild(parentNode, newNode) {
|
|
8490
|
+
const prev = parentNode.children[parentNode.children.length - 1];
|
|
8491
|
+
if (prev) {
|
|
8492
|
+
prev.next = newNode;
|
|
8493
|
+
newNode.prev = prev;
|
|
8494
|
+
}
|
|
8495
|
+
parentNode.children.push(newNode);
|
|
8496
|
+
newNode.parent = parentNode;
|
|
8497
|
+
},
|
|
8498
|
+
insertBefore(parentNode, newNode, referenceNode) {
|
|
8499
|
+
const insertionIdx = parentNode.children.indexOf(referenceNode);
|
|
8500
|
+
const { prev } = referenceNode;
|
|
8501
|
+
if (prev) {
|
|
8502
|
+
prev.next = newNode;
|
|
8503
|
+
newNode.prev = prev;
|
|
8504
|
+
}
|
|
8505
|
+
referenceNode.prev = newNode;
|
|
8506
|
+
newNode.next = referenceNode;
|
|
8507
|
+
parentNode.children.splice(insertionIdx, 0, newNode);
|
|
8508
|
+
newNode.parent = parentNode;
|
|
8509
|
+
},
|
|
8510
|
+
setTemplateContent(templateElement, contentElement) {
|
|
8511
|
+
adapter.appendChild(templateElement, contentElement);
|
|
8512
|
+
},
|
|
8513
|
+
getTemplateContent(templateElement) {
|
|
8514
|
+
return templateElement.children[0];
|
|
8515
|
+
},
|
|
8516
|
+
setDocumentType(document, name, publicId, systemId) {
|
|
8517
|
+
const data = serializeDoctypeContent(name, publicId, systemId);
|
|
8518
|
+
let doctypeNode = document.children.find((node) => isDirective(node) && node.name === "!doctype");
|
|
8519
|
+
if (doctypeNode) {
|
|
8520
|
+
doctypeNode.data = data !== null && data !== void 0 ? data : null;
|
|
8521
|
+
} else {
|
|
8522
|
+
doctypeNode = new ProcessingInstruction("!doctype", data);
|
|
8523
|
+
adapter.appendChild(document, doctypeNode);
|
|
8524
|
+
}
|
|
8525
|
+
doctypeNode["x-name"] = name;
|
|
8526
|
+
doctypeNode["x-publicId"] = publicId;
|
|
8527
|
+
doctypeNode["x-systemId"] = systemId;
|
|
8528
|
+
},
|
|
8529
|
+
setDocumentMode(document, mode) {
|
|
8530
|
+
document["x-mode"] = mode;
|
|
8531
|
+
},
|
|
8532
|
+
getDocumentMode(document) {
|
|
8533
|
+
return document["x-mode"];
|
|
8534
|
+
},
|
|
8535
|
+
detachNode(node) {
|
|
8536
|
+
if (node.parent) {
|
|
8537
|
+
const idx = node.parent.children.indexOf(node);
|
|
8538
|
+
const { prev, next } = node;
|
|
8539
|
+
node.prev = null;
|
|
8540
|
+
node.next = null;
|
|
8541
|
+
if (prev) {
|
|
8542
|
+
prev.next = next;
|
|
8543
|
+
}
|
|
8544
|
+
if (next) {
|
|
8545
|
+
next.prev = prev;
|
|
8546
|
+
}
|
|
8547
|
+
node.parent.children.splice(idx, 1);
|
|
8548
|
+
node.parent = null;
|
|
8549
|
+
}
|
|
8550
|
+
},
|
|
8551
|
+
insertText(parentNode, text) {
|
|
8552
|
+
const lastChild = parentNode.children[parentNode.children.length - 1];
|
|
8553
|
+
if (lastChild && isText(lastChild)) {
|
|
8554
|
+
lastChild.data += text;
|
|
8555
|
+
} else {
|
|
8556
|
+
adapter.appendChild(parentNode, adapter.createTextNode(text));
|
|
8557
|
+
}
|
|
8558
|
+
},
|
|
8559
|
+
insertTextBefore(parentNode, text, referenceNode) {
|
|
8560
|
+
const prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1];
|
|
8561
|
+
if (prevNode && isText(prevNode)) {
|
|
8562
|
+
prevNode.data += text;
|
|
8563
|
+
} else {
|
|
8564
|
+
adapter.insertBefore(parentNode, adapter.createTextNode(text), referenceNode);
|
|
8565
|
+
}
|
|
8566
|
+
},
|
|
8567
|
+
adoptAttributes(recipient, attrs) {
|
|
8568
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
8569
|
+
const attrName = attrs[i].name;
|
|
8570
|
+
if (recipient.attribs[attrName] === void 0) {
|
|
8571
|
+
recipient.attribs[attrName] = attrs[i].value;
|
|
8572
|
+
recipient["x-attribsNamespace"][attrName] = attrs[i].namespace;
|
|
8573
|
+
recipient["x-attribsPrefix"][attrName] = attrs[i].prefix;
|
|
8574
|
+
}
|
|
8575
|
+
}
|
|
8576
|
+
},
|
|
8577
|
+
//Tree traversing
|
|
8578
|
+
getFirstChild(node) {
|
|
8579
|
+
return node.children[0];
|
|
8580
|
+
},
|
|
8581
|
+
getChildNodes(node) {
|
|
8582
|
+
return node.children;
|
|
8583
|
+
},
|
|
8584
|
+
getParentNode(node) {
|
|
8585
|
+
return node.parent;
|
|
8586
|
+
},
|
|
8587
|
+
getAttrList(element) {
|
|
8588
|
+
return element.attributes;
|
|
8589
|
+
},
|
|
8590
|
+
//Node data
|
|
8591
|
+
getTagName(element) {
|
|
8592
|
+
return element.name;
|
|
8593
|
+
},
|
|
8594
|
+
getNamespaceURI(element) {
|
|
8595
|
+
return element.namespace;
|
|
8596
|
+
},
|
|
8597
|
+
getTextNodeContent(textNode) {
|
|
8598
|
+
return textNode.data;
|
|
8599
|
+
},
|
|
8600
|
+
getCommentNodeContent(commentNode) {
|
|
8601
|
+
return commentNode.data;
|
|
8602
|
+
},
|
|
8603
|
+
getDocumentTypeNodeName(doctypeNode) {
|
|
8604
|
+
var _a;
|
|
8605
|
+
return (_a = doctypeNode["x-name"]) !== null && _a !== void 0 ? _a : "";
|
|
8606
|
+
},
|
|
8607
|
+
getDocumentTypeNodePublicId(doctypeNode) {
|
|
8608
|
+
var _a;
|
|
8609
|
+
return (_a = doctypeNode["x-publicId"]) !== null && _a !== void 0 ? _a : "";
|
|
8610
|
+
},
|
|
8611
|
+
getDocumentTypeNodeSystemId(doctypeNode) {
|
|
8612
|
+
var _a;
|
|
8613
|
+
return (_a = doctypeNode["x-systemId"]) !== null && _a !== void 0 ? _a : "";
|
|
8614
|
+
},
|
|
8615
|
+
//Node types
|
|
8616
|
+
isDocumentTypeNode(node) {
|
|
8617
|
+
return isDirective(node) && node.name === "!doctype";
|
|
8618
|
+
},
|
|
8619
|
+
// Source code location
|
|
8620
|
+
setNodeSourceCodeLocation(node, location) {
|
|
8621
|
+
if (location) {
|
|
8622
|
+
node.startIndex = location.startOffset;
|
|
8623
|
+
node.endIndex = location.endOffset;
|
|
8624
|
+
}
|
|
8625
|
+
node.sourceCodeLocation = location;
|
|
8626
|
+
},
|
|
8627
|
+
getNodeSourceCodeLocation(node) {
|
|
8628
|
+
return node.sourceCodeLocation;
|
|
8629
|
+
},
|
|
8630
|
+
updateNodeSourceCodeLocation(node, endLocation) {
|
|
8631
|
+
if (endLocation.endOffset != null)
|
|
8632
|
+
node.endIndex = endLocation.endOffset;
|
|
8633
|
+
node.sourceCodeLocation = {
|
|
8634
|
+
...node.sourceCodeLocation,
|
|
8635
|
+
...endLocation
|
|
8636
|
+
};
|
|
8637
|
+
}
|
|
8638
|
+
};
|
|
8639
|
+
|
|
8640
|
+
// src/providers/http/utils.ts
|
|
8425
8641
|
import RE2 from "re2";
|
|
8426
8642
|
import xpath from "xpath";
|
|
8427
|
-
function extractHTMLElement(
|
|
8428
|
-
const { start, end } = extractHTMLElementIndex(
|
|
8429
|
-
return
|
|
8643
|
+
function extractHTMLElement(html2, xpathExpression, contentsOnly) {
|
|
8644
|
+
const { start, end } = extractHTMLElementIndex(html2, xpathExpression, contentsOnly);
|
|
8645
|
+
return html2.slice(start, end);
|
|
8430
8646
|
}
|
|
8431
|
-
function extractHTMLElementIndex(
|
|
8432
|
-
return extractHTMLElementsIndexes(
|
|
8647
|
+
function extractHTMLElementIndex(html2, xpathExpression, contentsOnly) {
|
|
8648
|
+
return extractHTMLElementsIndexes(html2, xpathExpression, contentsOnly)[0];
|
|
8433
8649
|
}
|
|
8434
|
-
function extractHTMLElementsIndexes(
|
|
8435
|
-
return extractHTMLElementIndexesParse5(
|
|
8650
|
+
function extractHTMLElementsIndexes(html2, xpathExpression, contentsOnly) {
|
|
8651
|
+
return extractHTMLElementIndexesParse5(html2, xpathExpression, contentsOnly);
|
|
8436
8652
|
}
|
|
8437
|
-
function extractHTMLElementIndexesParse5(
|
|
8653
|
+
function extractHTMLElementIndexesParse5(html2, xpathExpression, contentsOnly) {
|
|
8438
8654
|
const domLight = parse(
|
|
8439
|
-
|
|
8440
|
-
{ treeAdapter:
|
|
8655
|
+
html2,
|
|
8656
|
+
{ treeAdapter: adapter, sourceCodeLocationInfo: true }
|
|
8441
8657
|
);
|
|
8442
8658
|
domLight["name"] = "root";
|
|
8443
8659
|
const parsedPath = xpath.parse(xpathExpression);
|
|
@@ -8798,6 +9014,7 @@ var HTTP_PROVIDER = {
|
|
|
8798
9014
|
logger2.error({ response: encodeBase643(response) });
|
|
8799
9015
|
throw new Error("Failed to find response body");
|
|
8800
9016
|
}
|
|
9017
|
+
const revealFraming = shouldRevealChunkFraming(ctx.version);
|
|
8801
9018
|
const reveals = [
|
|
8802
9019
|
{ fromIndex: 0, toIndex: headerEndIndex }
|
|
8803
9020
|
];
|
|
@@ -8814,6 +9031,9 @@ var HTTP_PROVIDER = {
|
|
|
8814
9031
|
if (res.headerIndices["date"]) {
|
|
8815
9032
|
reveals.push(res.headerIndices["date"]);
|
|
8816
9033
|
}
|
|
9034
|
+
if (revealFraming && res.headerIndices["transfer-encoding"]) {
|
|
9035
|
+
reveals.push(res.headerIndices["transfer-encoding"]);
|
|
9036
|
+
}
|
|
8817
9037
|
const body = uint8ArrayToBinaryStr2(res.body);
|
|
8818
9038
|
const redactions = [];
|
|
8819
9039
|
for (const rs of params.responseRedactions || []) {
|
|
@@ -8821,23 +9041,34 @@ var HTTP_PROVIDER = {
|
|
|
8821
9041
|
body,
|
|
8822
9042
|
rs,
|
|
8823
9043
|
bodyStartIdx,
|
|
8824
|
-
res.chunks
|
|
9044
|
+
res.chunks,
|
|
9045
|
+
revealFraming
|
|
8825
9046
|
);
|
|
8826
9047
|
for (const { reveal, redactions: reds } of processor) {
|
|
8827
9048
|
reveals.push(reveal);
|
|
8828
9049
|
redactions.push(...reds);
|
|
8829
9050
|
}
|
|
8830
9051
|
}
|
|
8831
|
-
|
|
9052
|
+
if (revealFraming && res.chunks?.length) {
|
|
9053
|
+
let prev = res.headerEndIdx + 4;
|
|
9054
|
+
for (const chunk of res.chunks) {
|
|
9055
|
+
reveals.push({ fromIndex: prev, toIndex: chunk.fromIndex });
|
|
9056
|
+
prev = chunk.toIndex;
|
|
9057
|
+
}
|
|
9058
|
+
reveals.push({ fromIndex: prev, toIndex: response.length });
|
|
9059
|
+
}
|
|
9060
|
+
reveals.sort((a, b) => a.fromIndex - b.fromIndex);
|
|
8832
9061
|
if (reveals.length > 1) {
|
|
8833
9062
|
let currentIndex = 0;
|
|
8834
9063
|
for (const r of reveals) {
|
|
8835
9064
|
if (currentIndex < r.fromIndex) {
|
|
8836
9065
|
redactions.push({ fromIndex: currentIndex, toIndex: r.fromIndex });
|
|
8837
9066
|
}
|
|
8838
|
-
currentIndex = r.toIndex;
|
|
9067
|
+
currentIndex = Math.max(currentIndex, r.toIndex);
|
|
9068
|
+
}
|
|
9069
|
+
if (currentIndex < response.length) {
|
|
9070
|
+
redactions.push({ fromIndex: currentIndex, toIndex: response.length });
|
|
8839
9071
|
}
|
|
8840
|
-
redactions.push({ fromIndex: currentIndex, toIndex: response.length });
|
|
8841
9072
|
}
|
|
8842
9073
|
for (const r of reveals) {
|
|
8843
9074
|
if (!r.hash) {
|
|
@@ -8887,7 +9118,9 @@ var HTTP_PROVIDER = {
|
|
|
8887
9118
|
if (connectionHeader !== "close") {
|
|
8888
9119
|
throw new Error(`Connection header must be "close", got "${connectionHeader}"`);
|
|
8889
9120
|
}
|
|
8890
|
-
const
|
|
9121
|
+
const allServerBlocks = receipt.filter((s) => s.sender === "server").map((r) => r.message);
|
|
9122
|
+
const firstRealIdx = allServerBlocks.findIndex((b) => !b.every((x) => x === REDACTION_CHAR_CODE2));
|
|
9123
|
+
const serverBlocks = firstRealIdx === -1 ? [] : allServerBlocks.slice(firstRealIdx);
|
|
8891
9124
|
const response = concatArrays(...serverBlocks);
|
|
8892
9125
|
let res;
|
|
8893
9126
|
res = uint8ArrayToStr(response);
|
|
@@ -8930,8 +9163,11 @@ var HTTP_PROVIDER = {
|
|
|
8930
9163
|
if (paramBody.length > 0 && !matchRedactedStrings(paramBody, req.body)) {
|
|
8931
9164
|
throw new Error("request body mismatch");
|
|
8932
9165
|
}
|
|
8933
|
-
if (
|
|
8934
|
-
|
|
9166
|
+
if (shouldRevealChunkFraming(clientVersion)) {
|
|
9167
|
+
const headersStr = res.slice(0, bodyStart);
|
|
9168
|
+
res = /transfer-encoding:\s*chunked/i.test(headersStr) ? headersStr + dechunkResponseBody(res.slice(bodyStart)) : res;
|
|
9169
|
+
} else if (!secretParams) {
|
|
9170
|
+
res = res.slice(bodyStart).replace(/\*{3,}/g, "");
|
|
8935
9171
|
}
|
|
8936
9172
|
for (const { type, value, invert } of params.responseMatches || []) {
|
|
8937
9173
|
const inv = Boolean(invert);
|
|
@@ -9018,6 +9254,16 @@ function assertNoSmuggle(reqBuffer, params) {
|
|
|
9018
9254
|
function shouldRevealCrlf({ version }) {
|
|
9019
9255
|
return version >= AttestorVersion.ATTESTOR_VERSION_2_0_1;
|
|
9020
9256
|
}
|
|
9257
|
+
function shouldRevealChunkFraming(version) {
|
|
9258
|
+
return version >= AttestorVersion.ATTESTOR_VERSION_3_2_0;
|
|
9259
|
+
}
|
|
9260
|
+
function dechunkResponseBody(body) {
|
|
9261
|
+
const parser = makeHttpResponseParser();
|
|
9262
|
+
parser.onChunk(
|
|
9263
|
+
strToUint8Array("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" + body)
|
|
9264
|
+
);
|
|
9265
|
+
return uint8ArrayToStr(parser.res.body ?? new Uint8Array());
|
|
9266
|
+
}
|
|
9021
9267
|
function getHostPort(params, secretParams) {
|
|
9022
9268
|
const { host } = new URL(getURL(params, secretParams));
|
|
9023
9269
|
if (!host) {
|
|
@@ -9031,7 +9277,7 @@ function getHostHeaderString(url) {
|
|
|
9031
9277
|
return port && +port !== DEFAULT_HTTPS_PORT ? `${host}:${port}` : host;
|
|
9032
9278
|
}
|
|
9033
9279
|
var paramsRegex = /{{([^{}]+)}}/sgi;
|
|
9034
|
-
function* processRedactionRequest(body, rs, bodyStartIdx, resChunks) {
|
|
9280
|
+
function* processRedactionRequest(body, rs, bodyStartIdx, resChunks, revealFraming) {
|
|
9035
9281
|
let element = body;
|
|
9036
9282
|
let elementIdx = 0;
|
|
9037
9283
|
let elementLength = -1;
|
|
@@ -9121,19 +9367,13 @@ function* processRedactionRequest(body, rs, bodyStartIdx, resChunks) {
|
|
|
9121
9367
|
elementLength = element.length;
|
|
9122
9368
|
yield* addRedaction(null);
|
|
9123
9369
|
}
|
|
9124
|
-
function* addRedaction(hash = rs.hash
|
|
9370
|
+
function* addRedaction(hash = rs.hash) {
|
|
9125
9371
|
if (elementIdx < 0 || !elementLength) {
|
|
9126
9372
|
return;
|
|
9127
9373
|
}
|
|
9128
9374
|
const reveal = getReveal(elementIdx, elementLength, hash || void 0);
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
redactions: getRedactionsForChunkHeaders(
|
|
9132
|
-
reveal.fromIndex,
|
|
9133
|
-
reveal.toIndex,
|
|
9134
|
-
_resChunks
|
|
9135
|
-
)
|
|
9136
|
-
};
|
|
9375
|
+
const redactions = revealFraming ? [] : getRedactionsForChunkHeaders(reveal.fromIndex, reveal.toIndex, resChunks);
|
|
9376
|
+
yield { reveal, redactions };
|
|
9137
9377
|
}
|
|
9138
9378
|
function getReveal(startIdx, len, hash) {
|
|
9139
9379
|
const from = convertResponsePosToAbsolutePos(
|
|
@@ -9692,13 +9932,25 @@ async function _createClaimOnAttestor({
|
|
|
9692
9932
|
}
|
|
9693
9933
|
revealedPackets.push(...packets.filter((p) => p.sender === "server"));
|
|
9694
9934
|
} else {
|
|
9695
|
-
|
|
9696
|
-
block,
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9935
|
+
const revealByBlock = new Map(
|
|
9936
|
+
serverPacketsToReveal.map((r) => [r.block, r])
|
|
9937
|
+
);
|
|
9938
|
+
for (const sb of serverBlocks) {
|
|
9939
|
+
const reveal = revealByBlock.get(sb);
|
|
9940
|
+
if (!reveal) {
|
|
9941
|
+
revealedPackets.push({
|
|
9942
|
+
sender: "server",
|
|
9943
|
+
message: new Uint8Array(sb.plaintext.length).fill(REDACTION_CHAR_CODE2)
|
|
9944
|
+
});
|
|
9945
|
+
continue;
|
|
9946
|
+
}
|
|
9947
|
+
const {
|
|
9948
|
+
block,
|
|
9949
|
+
redactedPlaintext,
|
|
9950
|
+
overshotToprfFromPrevBlock,
|
|
9951
|
+
toprfs,
|
|
9952
|
+
oprfRawMarkers
|
|
9953
|
+
} = reveal;
|
|
9702
9954
|
setRevealOfMessage(block.message, {
|
|
9703
9955
|
type: "zk",
|
|
9704
9956
|
redactedPlaintext,
|