@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/index.js
CHANGED
|
@@ -155,6 +155,7 @@ var AttestorVersion = {
|
|
|
155
155
|
ATTESTOR_VERSION_2_0_1: 4,
|
|
156
156
|
ATTESTOR_VERSION_3_0_0: 5,
|
|
157
157
|
ATTESTOR_VERSION_3_1_0: 6,
|
|
158
|
+
ATTESTOR_VERSION_3_2_0: 7,
|
|
158
159
|
UNRECOGNIZED: -1
|
|
159
160
|
};
|
|
160
161
|
function attestorVersionFromJSON(object) {
|
|
@@ -180,6 +181,9 @@ function attestorVersionFromJSON(object) {
|
|
|
180
181
|
case 6:
|
|
181
182
|
case "ATTESTOR_VERSION_3_1_0":
|
|
182
183
|
return AttestorVersion.ATTESTOR_VERSION_3_1_0;
|
|
184
|
+
case 7:
|
|
185
|
+
case "ATTESTOR_VERSION_3_2_0":
|
|
186
|
+
return AttestorVersion.ATTESTOR_VERSION_3_2_0;
|
|
183
187
|
case -1:
|
|
184
188
|
case "UNRECOGNIZED":
|
|
185
189
|
default:
|
|
@@ -202,6 +206,8 @@ function attestorVersionToJSON(object) {
|
|
|
202
206
|
return "ATTESTOR_VERSION_3_0_0";
|
|
203
207
|
case AttestorVersion.ATTESTOR_VERSION_3_1_0:
|
|
204
208
|
return "ATTESTOR_VERSION_3_1_0";
|
|
209
|
+
case AttestorVersion.ATTESTOR_VERSION_3_2_0:
|
|
210
|
+
return "ATTESTOR_VERSION_3_2_0";
|
|
205
211
|
case AttestorVersion.UNRECOGNIZED:
|
|
206
212
|
default:
|
|
207
213
|
return "UNRECOGNIZED";
|
|
@@ -4284,7 +4290,7 @@ var DNS_SERVERS = [
|
|
|
4284
4290
|
"8.8.4.4"
|
|
4285
4291
|
];
|
|
4286
4292
|
var MAX_CLAIM_TIMESTAMP_DIFF_S = 10 * 60;
|
|
4287
|
-
var CURRENT_ATTESTOR_VERSION = AttestorVersion.
|
|
4293
|
+
var CURRENT_ATTESTOR_VERSION = AttestorVersion.ATTESTOR_VERSION_3_2_0;
|
|
4288
4294
|
var DEFAULT_METADATA = {
|
|
4289
4295
|
signatureType: ServiceSignatureType.SERVICE_SIGNATURE_TYPE_ETH,
|
|
4290
4296
|
clientVersion: CURRENT_ATTESTOR_VERSION,
|
|
@@ -6730,16 +6736,241 @@ import {
|
|
|
6730
6736
|
} from "esprima-next";
|
|
6731
6737
|
import { JSONPath } from "jsonpath-plus";
|
|
6732
6738
|
import { parse } from "parse5";
|
|
6733
|
-
|
|
6739
|
+
|
|
6740
|
+
// node_modules/parse5-htmlparser2-tree-adapter/dist/index.js
|
|
6741
|
+
import { html } from "parse5";
|
|
6742
|
+
function enquoteDoctypeId(id) {
|
|
6743
|
+
const quote = id.includes('"') ? "'" : '"';
|
|
6744
|
+
return quote + id + quote;
|
|
6745
|
+
}
|
|
6746
|
+
function serializeDoctypeContent(name, publicId, systemId) {
|
|
6747
|
+
let str = "!DOCTYPE ";
|
|
6748
|
+
if (name) {
|
|
6749
|
+
str += name;
|
|
6750
|
+
}
|
|
6751
|
+
if (publicId) {
|
|
6752
|
+
str += ` PUBLIC ${enquoteDoctypeId(publicId)}`;
|
|
6753
|
+
} else if (systemId) {
|
|
6754
|
+
str += " SYSTEM";
|
|
6755
|
+
}
|
|
6756
|
+
if (systemId) {
|
|
6757
|
+
str += ` ${enquoteDoctypeId(systemId)}`;
|
|
6758
|
+
}
|
|
6759
|
+
return str;
|
|
6760
|
+
}
|
|
6761
|
+
var adapter = {
|
|
6762
|
+
// Re-exports from domhandler
|
|
6763
|
+
isCommentNode: isComment,
|
|
6764
|
+
isElementNode: isTag2,
|
|
6765
|
+
isTextNode: isText,
|
|
6766
|
+
//Node construction
|
|
6767
|
+
createDocument() {
|
|
6768
|
+
const node = new Document([]);
|
|
6769
|
+
node["x-mode"] = html.DOCUMENT_MODE.NO_QUIRKS;
|
|
6770
|
+
return node;
|
|
6771
|
+
},
|
|
6772
|
+
createDocumentFragment() {
|
|
6773
|
+
return new Document([]);
|
|
6774
|
+
},
|
|
6775
|
+
createElement(tagName, namespaceURI, attrs) {
|
|
6776
|
+
const attribs = /* @__PURE__ */ Object.create(null);
|
|
6777
|
+
const attribsNamespace = /* @__PURE__ */ Object.create(null);
|
|
6778
|
+
const attribsPrefix = /* @__PURE__ */ Object.create(null);
|
|
6779
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
6780
|
+
const attrName = attrs[i].name;
|
|
6781
|
+
attribs[attrName] = attrs[i].value;
|
|
6782
|
+
attribsNamespace[attrName] = attrs[i].namespace;
|
|
6783
|
+
attribsPrefix[attrName] = attrs[i].prefix;
|
|
6784
|
+
}
|
|
6785
|
+
const node = new Element(tagName, attribs, []);
|
|
6786
|
+
node.namespace = namespaceURI;
|
|
6787
|
+
node["x-attribsNamespace"] = attribsNamespace;
|
|
6788
|
+
node["x-attribsPrefix"] = attribsPrefix;
|
|
6789
|
+
return node;
|
|
6790
|
+
},
|
|
6791
|
+
createCommentNode(data) {
|
|
6792
|
+
return new Comment2(data);
|
|
6793
|
+
},
|
|
6794
|
+
createTextNode(value) {
|
|
6795
|
+
return new Text2(value);
|
|
6796
|
+
},
|
|
6797
|
+
//Tree mutation
|
|
6798
|
+
appendChild(parentNode, newNode) {
|
|
6799
|
+
const prev = parentNode.children[parentNode.children.length - 1];
|
|
6800
|
+
if (prev) {
|
|
6801
|
+
prev.next = newNode;
|
|
6802
|
+
newNode.prev = prev;
|
|
6803
|
+
}
|
|
6804
|
+
parentNode.children.push(newNode);
|
|
6805
|
+
newNode.parent = parentNode;
|
|
6806
|
+
},
|
|
6807
|
+
insertBefore(parentNode, newNode, referenceNode) {
|
|
6808
|
+
const insertionIdx = parentNode.children.indexOf(referenceNode);
|
|
6809
|
+
const { prev } = referenceNode;
|
|
6810
|
+
if (prev) {
|
|
6811
|
+
prev.next = newNode;
|
|
6812
|
+
newNode.prev = prev;
|
|
6813
|
+
}
|
|
6814
|
+
referenceNode.prev = newNode;
|
|
6815
|
+
newNode.next = referenceNode;
|
|
6816
|
+
parentNode.children.splice(insertionIdx, 0, newNode);
|
|
6817
|
+
newNode.parent = parentNode;
|
|
6818
|
+
},
|
|
6819
|
+
setTemplateContent(templateElement, contentElement) {
|
|
6820
|
+
adapter.appendChild(templateElement, contentElement);
|
|
6821
|
+
},
|
|
6822
|
+
getTemplateContent(templateElement) {
|
|
6823
|
+
return templateElement.children[0];
|
|
6824
|
+
},
|
|
6825
|
+
setDocumentType(document, name, publicId, systemId) {
|
|
6826
|
+
const data = serializeDoctypeContent(name, publicId, systemId);
|
|
6827
|
+
let doctypeNode = document.children.find((node) => isDirective(node) && node.name === "!doctype");
|
|
6828
|
+
if (doctypeNode) {
|
|
6829
|
+
doctypeNode.data = data !== null && data !== void 0 ? data : null;
|
|
6830
|
+
} else {
|
|
6831
|
+
doctypeNode = new ProcessingInstruction("!doctype", data);
|
|
6832
|
+
adapter.appendChild(document, doctypeNode);
|
|
6833
|
+
}
|
|
6834
|
+
doctypeNode["x-name"] = name;
|
|
6835
|
+
doctypeNode["x-publicId"] = publicId;
|
|
6836
|
+
doctypeNode["x-systemId"] = systemId;
|
|
6837
|
+
},
|
|
6838
|
+
setDocumentMode(document, mode) {
|
|
6839
|
+
document["x-mode"] = mode;
|
|
6840
|
+
},
|
|
6841
|
+
getDocumentMode(document) {
|
|
6842
|
+
return document["x-mode"];
|
|
6843
|
+
},
|
|
6844
|
+
detachNode(node) {
|
|
6845
|
+
if (node.parent) {
|
|
6846
|
+
const idx = node.parent.children.indexOf(node);
|
|
6847
|
+
const { prev, next } = node;
|
|
6848
|
+
node.prev = null;
|
|
6849
|
+
node.next = null;
|
|
6850
|
+
if (prev) {
|
|
6851
|
+
prev.next = next;
|
|
6852
|
+
}
|
|
6853
|
+
if (next) {
|
|
6854
|
+
next.prev = prev;
|
|
6855
|
+
}
|
|
6856
|
+
node.parent.children.splice(idx, 1);
|
|
6857
|
+
node.parent = null;
|
|
6858
|
+
}
|
|
6859
|
+
},
|
|
6860
|
+
insertText(parentNode, text) {
|
|
6861
|
+
const lastChild = parentNode.children[parentNode.children.length - 1];
|
|
6862
|
+
if (lastChild && isText(lastChild)) {
|
|
6863
|
+
lastChild.data += text;
|
|
6864
|
+
} else {
|
|
6865
|
+
adapter.appendChild(parentNode, adapter.createTextNode(text));
|
|
6866
|
+
}
|
|
6867
|
+
},
|
|
6868
|
+
insertTextBefore(parentNode, text, referenceNode) {
|
|
6869
|
+
const prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1];
|
|
6870
|
+
if (prevNode && isText(prevNode)) {
|
|
6871
|
+
prevNode.data += text;
|
|
6872
|
+
} else {
|
|
6873
|
+
adapter.insertBefore(parentNode, adapter.createTextNode(text), referenceNode);
|
|
6874
|
+
}
|
|
6875
|
+
},
|
|
6876
|
+
adoptAttributes(recipient, attrs) {
|
|
6877
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
6878
|
+
const attrName = attrs[i].name;
|
|
6879
|
+
if (recipient.attribs[attrName] === void 0) {
|
|
6880
|
+
recipient.attribs[attrName] = attrs[i].value;
|
|
6881
|
+
recipient["x-attribsNamespace"][attrName] = attrs[i].namespace;
|
|
6882
|
+
recipient["x-attribsPrefix"][attrName] = attrs[i].prefix;
|
|
6883
|
+
}
|
|
6884
|
+
}
|
|
6885
|
+
},
|
|
6886
|
+
//Tree traversing
|
|
6887
|
+
getFirstChild(node) {
|
|
6888
|
+
return node.children[0];
|
|
6889
|
+
},
|
|
6890
|
+
getChildNodes(node) {
|
|
6891
|
+
return node.children;
|
|
6892
|
+
},
|
|
6893
|
+
getParentNode(node) {
|
|
6894
|
+
return node.parent;
|
|
6895
|
+
},
|
|
6896
|
+
getAttrList(element) {
|
|
6897
|
+
return element.attributes;
|
|
6898
|
+
},
|
|
6899
|
+
//Node data
|
|
6900
|
+
getTagName(element) {
|
|
6901
|
+
return element.name;
|
|
6902
|
+
},
|
|
6903
|
+
getNamespaceURI(element) {
|
|
6904
|
+
return element.namespace;
|
|
6905
|
+
},
|
|
6906
|
+
getTextNodeContent(textNode) {
|
|
6907
|
+
return textNode.data;
|
|
6908
|
+
},
|
|
6909
|
+
getCommentNodeContent(commentNode) {
|
|
6910
|
+
return commentNode.data;
|
|
6911
|
+
},
|
|
6912
|
+
getDocumentTypeNodeName(doctypeNode) {
|
|
6913
|
+
var _a;
|
|
6914
|
+
return (_a = doctypeNode["x-name"]) !== null && _a !== void 0 ? _a : "";
|
|
6915
|
+
},
|
|
6916
|
+
getDocumentTypeNodePublicId(doctypeNode) {
|
|
6917
|
+
var _a;
|
|
6918
|
+
return (_a = doctypeNode["x-publicId"]) !== null && _a !== void 0 ? _a : "";
|
|
6919
|
+
},
|
|
6920
|
+
getDocumentTypeNodeSystemId(doctypeNode) {
|
|
6921
|
+
var _a;
|
|
6922
|
+
return (_a = doctypeNode["x-systemId"]) !== null && _a !== void 0 ? _a : "";
|
|
6923
|
+
},
|
|
6924
|
+
//Node types
|
|
6925
|
+
isDocumentTypeNode(node) {
|
|
6926
|
+
return isDirective(node) && node.name === "!doctype";
|
|
6927
|
+
},
|
|
6928
|
+
// Source code location
|
|
6929
|
+
setNodeSourceCodeLocation(node, location) {
|
|
6930
|
+
if (location) {
|
|
6931
|
+
node.startIndex = location.startOffset;
|
|
6932
|
+
node.endIndex = location.endOffset;
|
|
6933
|
+
}
|
|
6934
|
+
node.sourceCodeLocation = location;
|
|
6935
|
+
},
|
|
6936
|
+
getNodeSourceCodeLocation(node) {
|
|
6937
|
+
return node.sourceCodeLocation;
|
|
6938
|
+
},
|
|
6939
|
+
updateNodeSourceCodeLocation(node, endLocation) {
|
|
6940
|
+
if (endLocation.endOffset != null)
|
|
6941
|
+
node.endIndex = endLocation.endOffset;
|
|
6942
|
+
node.sourceCodeLocation = {
|
|
6943
|
+
...node.sourceCodeLocation,
|
|
6944
|
+
...endLocation
|
|
6945
|
+
};
|
|
6946
|
+
}
|
|
6947
|
+
};
|
|
6948
|
+
|
|
6949
|
+
// src/providers/http/utils.ts
|
|
6734
6950
|
import RE2 from "re2";
|
|
6735
6951
|
import xpath from "xpath";
|
|
6736
|
-
function
|
|
6737
|
-
|
|
6952
|
+
function extractHTMLElement(html2, xpathExpression, contentsOnly) {
|
|
6953
|
+
const { start, end } = extractHTMLElementIndex(html2, xpathExpression, contentsOnly);
|
|
6954
|
+
return html2.slice(start, end);
|
|
6738
6955
|
}
|
|
6739
|
-
function
|
|
6956
|
+
function extractHTMLElements(html2, xpathExpression, contentsOnly) {
|
|
6957
|
+
const indexes = extractHTMLElementsIndexes(html2, xpathExpression, contentsOnly);
|
|
6958
|
+
const res = [];
|
|
6959
|
+
for (const { start, end } of indexes) {
|
|
6960
|
+
res.push(html2.slice(start, end));
|
|
6961
|
+
}
|
|
6962
|
+
return res;
|
|
6963
|
+
}
|
|
6964
|
+
function extractHTMLElementIndex(html2, xpathExpression, contentsOnly) {
|
|
6965
|
+
return extractHTMLElementsIndexes(html2, xpathExpression, contentsOnly)[0];
|
|
6966
|
+
}
|
|
6967
|
+
function extractHTMLElementsIndexes(html2, xpathExpression, contentsOnly) {
|
|
6968
|
+
return extractHTMLElementIndexesParse5(html2, xpathExpression, contentsOnly);
|
|
6969
|
+
}
|
|
6970
|
+
function extractHTMLElementIndexesParse5(html2, xpathExpression, contentsOnly) {
|
|
6740
6971
|
const domLight = parse(
|
|
6741
|
-
|
|
6742
|
-
{ treeAdapter:
|
|
6972
|
+
html2,
|
|
6973
|
+
{ treeAdapter: adapter, sourceCodeLocationInfo: true }
|
|
6743
6974
|
);
|
|
6744
6975
|
domLight["name"] = "root";
|
|
6745
6976
|
const parsedPath = xpath.parse(xpathExpression);
|
|
@@ -6764,6 +6995,9 @@ function getNodeRange(node, contentsOnly) {
|
|
|
6764
6995
|
end: node.lastChild.endIndex
|
|
6765
6996
|
};
|
|
6766
6997
|
}
|
|
6998
|
+
function extractJSONValueIndex(json, jsonPath) {
|
|
6999
|
+
return extractJSONValueIndexes(json, jsonPath)[0];
|
|
7000
|
+
}
|
|
6767
7001
|
function extractJSONValueIndexes(json, jsonPath) {
|
|
6768
7002
|
const pointers = JSONPath({
|
|
6769
7003
|
path: jsonPath,
|
|
@@ -7078,6 +7312,7 @@ var HTTP_PROVIDER = {
|
|
|
7078
7312
|
logger2.error({ response: encodeBase643(response) });
|
|
7079
7313
|
throw new Error("Failed to find response body");
|
|
7080
7314
|
}
|
|
7315
|
+
const revealFraming = shouldRevealChunkFraming(ctx.version);
|
|
7081
7316
|
const reveals = [
|
|
7082
7317
|
{ fromIndex: 0, toIndex: headerEndIndex }
|
|
7083
7318
|
];
|
|
@@ -7094,6 +7329,9 @@ var HTTP_PROVIDER = {
|
|
|
7094
7329
|
if (res.headerIndices["date"]) {
|
|
7095
7330
|
reveals.push(res.headerIndices["date"]);
|
|
7096
7331
|
}
|
|
7332
|
+
if (revealFraming && res.headerIndices["transfer-encoding"]) {
|
|
7333
|
+
reveals.push(res.headerIndices["transfer-encoding"]);
|
|
7334
|
+
}
|
|
7097
7335
|
const body = uint8ArrayToBinaryStr2(res.body);
|
|
7098
7336
|
const redactions = [];
|
|
7099
7337
|
for (const rs of params.responseRedactions || []) {
|
|
@@ -7101,23 +7339,34 @@ var HTTP_PROVIDER = {
|
|
|
7101
7339
|
body,
|
|
7102
7340
|
rs,
|
|
7103
7341
|
bodyStartIdx,
|
|
7104
|
-
res.chunks
|
|
7342
|
+
res.chunks,
|
|
7343
|
+
revealFraming
|
|
7105
7344
|
);
|
|
7106
7345
|
for (const { reveal, redactions: reds } of processor) {
|
|
7107
7346
|
reveals.push(reveal);
|
|
7108
7347
|
redactions.push(...reds);
|
|
7109
7348
|
}
|
|
7110
7349
|
}
|
|
7111
|
-
|
|
7350
|
+
if (revealFraming && res.chunks?.length) {
|
|
7351
|
+
let prev = res.headerEndIdx + 4;
|
|
7352
|
+
for (const chunk of res.chunks) {
|
|
7353
|
+
reveals.push({ fromIndex: prev, toIndex: chunk.fromIndex });
|
|
7354
|
+
prev = chunk.toIndex;
|
|
7355
|
+
}
|
|
7356
|
+
reveals.push({ fromIndex: prev, toIndex: response.length });
|
|
7357
|
+
}
|
|
7358
|
+
reveals.sort((a, b) => a.fromIndex - b.fromIndex);
|
|
7112
7359
|
if (reveals.length > 1) {
|
|
7113
7360
|
let currentIndex = 0;
|
|
7114
7361
|
for (const r of reveals) {
|
|
7115
7362
|
if (currentIndex < r.fromIndex) {
|
|
7116
7363
|
redactions.push({ fromIndex: currentIndex, toIndex: r.fromIndex });
|
|
7117
7364
|
}
|
|
7118
|
-
currentIndex = r.toIndex;
|
|
7365
|
+
currentIndex = Math.max(currentIndex, r.toIndex);
|
|
7366
|
+
}
|
|
7367
|
+
if (currentIndex < response.length) {
|
|
7368
|
+
redactions.push({ fromIndex: currentIndex, toIndex: response.length });
|
|
7119
7369
|
}
|
|
7120
|
-
redactions.push({ fromIndex: currentIndex, toIndex: response.length });
|
|
7121
7370
|
}
|
|
7122
7371
|
for (const r of reveals) {
|
|
7123
7372
|
if (!r.hash) {
|
|
@@ -7167,7 +7416,9 @@ var HTTP_PROVIDER = {
|
|
|
7167
7416
|
if (connectionHeader !== "close") {
|
|
7168
7417
|
throw new Error(`Connection header must be "close", got "${connectionHeader}"`);
|
|
7169
7418
|
}
|
|
7170
|
-
const
|
|
7419
|
+
const allServerBlocks = receipt.filter((s) => s.sender === "server").map((r) => r.message);
|
|
7420
|
+
const firstRealIdx = allServerBlocks.findIndex((b) => !b.every((x) => x === REDACTION_CHAR_CODE2));
|
|
7421
|
+
const serverBlocks = firstRealIdx === -1 ? [] : allServerBlocks.slice(firstRealIdx);
|
|
7171
7422
|
const response = concatArrays(...serverBlocks);
|
|
7172
7423
|
let res;
|
|
7173
7424
|
res = uint8ArrayToStr(response);
|
|
@@ -7210,8 +7461,11 @@ var HTTP_PROVIDER = {
|
|
|
7210
7461
|
if (paramBody.length > 0 && !matchRedactedStrings(paramBody, req.body)) {
|
|
7211
7462
|
throw new Error("request body mismatch");
|
|
7212
7463
|
}
|
|
7213
|
-
if (
|
|
7214
|
-
|
|
7464
|
+
if (shouldRevealChunkFraming(clientVersion)) {
|
|
7465
|
+
const headersStr = res.slice(0, bodyStart);
|
|
7466
|
+
res = /transfer-encoding:\s*chunked/i.test(headersStr) ? headersStr + dechunkResponseBody(res.slice(bodyStart)) : res;
|
|
7467
|
+
} else if (!secretParams) {
|
|
7468
|
+
res = res.slice(bodyStart).replace(/\*{3,}/g, "");
|
|
7215
7469
|
}
|
|
7216
7470
|
for (const { type, value, invert } of params.responseMatches || []) {
|
|
7217
7471
|
const inv = Boolean(invert);
|
|
@@ -7298,6 +7552,16 @@ function assertNoSmuggle(reqBuffer, params) {
|
|
|
7298
7552
|
function shouldRevealCrlf({ version }) {
|
|
7299
7553
|
return version >= AttestorVersion.ATTESTOR_VERSION_2_0_1;
|
|
7300
7554
|
}
|
|
7555
|
+
function shouldRevealChunkFraming(version) {
|
|
7556
|
+
return version >= AttestorVersion.ATTESTOR_VERSION_3_2_0;
|
|
7557
|
+
}
|
|
7558
|
+
function dechunkResponseBody(body) {
|
|
7559
|
+
const parser = makeHttpResponseParser();
|
|
7560
|
+
parser.onChunk(
|
|
7561
|
+
strToUint8Array("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" + body)
|
|
7562
|
+
);
|
|
7563
|
+
return uint8ArrayToStr(parser.res.body ?? new Uint8Array());
|
|
7564
|
+
}
|
|
7301
7565
|
function getHostPort(params, secretParams) {
|
|
7302
7566
|
const { host } = new URL(getURL(params, secretParams));
|
|
7303
7567
|
if (!host) {
|
|
@@ -7311,7 +7575,7 @@ function getHostHeaderString(url) {
|
|
|
7311
7575
|
return port && +port !== DEFAULT_HTTPS_PORT ? `${host}:${port}` : host;
|
|
7312
7576
|
}
|
|
7313
7577
|
var paramsRegex = /{{([^{}]+)}}/sgi;
|
|
7314
|
-
function* processRedactionRequest(body, rs, bodyStartIdx, resChunks) {
|
|
7578
|
+
function* processRedactionRequest(body, rs, bodyStartIdx, resChunks, revealFraming) {
|
|
7315
7579
|
let element = body;
|
|
7316
7580
|
let elementIdx = 0;
|
|
7317
7581
|
let elementLength = -1;
|
|
@@ -7401,19 +7665,13 @@ function* processRedactionRequest(body, rs, bodyStartIdx, resChunks) {
|
|
|
7401
7665
|
elementLength = element.length;
|
|
7402
7666
|
yield* addRedaction(null);
|
|
7403
7667
|
}
|
|
7404
|
-
function* addRedaction(hash = rs.hash
|
|
7668
|
+
function* addRedaction(hash = rs.hash) {
|
|
7405
7669
|
if (elementIdx < 0 || !elementLength) {
|
|
7406
7670
|
return;
|
|
7407
7671
|
}
|
|
7408
7672
|
const reveal = getReveal(elementIdx, elementLength, hash || void 0);
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
redactions: getRedactionsForChunkHeaders(
|
|
7412
|
-
reveal.fromIndex,
|
|
7413
|
-
reveal.toIndex,
|
|
7414
|
-
_resChunks
|
|
7415
|
-
)
|
|
7416
|
-
};
|
|
7673
|
+
const redactions = revealFraming ? [] : getRedactionsForChunkHeaders(reveal.fromIndex, reveal.toIndex, resChunks);
|
|
7674
|
+
yield { reveal, redactions };
|
|
7417
7675
|
}
|
|
7418
7676
|
function getReveal(startIdx, len, hash) {
|
|
7419
7677
|
const from = convertResponsePosToAbsolutePos(
|
|
@@ -8173,13 +8431,25 @@ async function _createClaimOnAttestor({
|
|
|
8173
8431
|
}
|
|
8174
8432
|
revealedPackets.push(...packets.filter((p) => p.sender === "server"));
|
|
8175
8433
|
} else {
|
|
8176
|
-
|
|
8177
|
-
block,
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8434
|
+
const revealByBlock = new Map(
|
|
8435
|
+
serverPacketsToReveal.map((r) => [r.block, r])
|
|
8436
|
+
);
|
|
8437
|
+
for (const sb of serverBlocks) {
|
|
8438
|
+
const reveal = revealByBlock.get(sb);
|
|
8439
|
+
if (!reveal) {
|
|
8440
|
+
revealedPackets.push({
|
|
8441
|
+
sender: "server",
|
|
8442
|
+
message: new Uint8Array(sb.plaintext.length).fill(REDACTION_CHAR_CODE2)
|
|
8443
|
+
});
|
|
8444
|
+
continue;
|
|
8445
|
+
}
|
|
8446
|
+
const {
|
|
8447
|
+
block,
|
|
8448
|
+
redactedPlaintext,
|
|
8449
|
+
overshotToprfFromPrevBlock,
|
|
8450
|
+
toprfs,
|
|
8451
|
+
oprfRawMarkers
|
|
8452
|
+
} = reveal;
|
|
8183
8453
|
setRevealOfMessage(block.message, {
|
|
8184
8454
|
type: "zk",
|
|
8185
8455
|
redactedPlaintext,
|
|
@@ -8345,7 +8615,13 @@ export {
|
|
|
8345
8615
|
ethersStructToPlainObject,
|
|
8346
8616
|
extractApplicationDataFromTranscript,
|
|
8347
8617
|
extractArrayBufferFromWsData,
|
|
8618
|
+
extractHTMLElement,
|
|
8619
|
+
extractHTMLElementIndex,
|
|
8620
|
+
extractHTMLElements,
|
|
8621
|
+
extractHTMLElementsIndexes,
|
|
8348
8622
|
extractHandshakeFromTranscript,
|
|
8623
|
+
extractJSONValueIndex,
|
|
8624
|
+
extractJSONValueIndexes,
|
|
8349
8625
|
extractRequestBufferFromTranscript,
|
|
8350
8626
|
findIndexInUint8Array,
|
|
8351
8627
|
generateRpcMessageId,
|
package/lib/proto/api.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare const AttestorVersion: {
|
|
|
41
41
|
readonly ATTESTOR_VERSION_2_0_1: 4;
|
|
42
42
|
readonly ATTESTOR_VERSION_3_0_0: 5;
|
|
43
43
|
readonly ATTESTOR_VERSION_3_1_0: 6;
|
|
44
|
+
readonly ATTESTOR_VERSION_3_2_0: 7;
|
|
44
45
|
readonly UNRECOGNIZED: -1;
|
|
45
46
|
};
|
|
46
47
|
export type AttestorVersion = typeof AttestorVersion[keyof typeof AttestorVersion];
|
|
@@ -52,6 +53,7 @@ export declare namespace AttestorVersion {
|
|
|
52
53
|
type ATTESTOR_VERSION_2_0_1 = typeof AttestorVersion.ATTESTOR_VERSION_2_0_1;
|
|
53
54
|
type ATTESTOR_VERSION_3_0_0 = typeof AttestorVersion.ATTESTOR_VERSION_3_0_0;
|
|
54
55
|
type ATTESTOR_VERSION_3_1_0 = typeof AttestorVersion.ATTESTOR_VERSION_3_1_0;
|
|
56
|
+
type ATTESTOR_VERSION_3_2_0 = typeof AttestorVersion.ATTESTOR_VERSION_3_2_0;
|
|
55
57
|
type UNRECOGNIZED = typeof AttestorVersion.UNRECOGNIZED;
|
|
56
58
|
}
|
|
57
59
|
export declare function attestorVersionFromJSON(object: any): AttestorVersion;
|