@mikeargento/bitgraph-verify 1.15.2 → 1.16.0
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/dist/__tests__/carrier2.test.js +61 -2
- package/dist/__tests__/carrier2.test.js.map +1 -1
- package/dist/__tests__/ceiling.test.js +11 -4
- package/dist/__tests__/ceiling.test.js.map +1 -1
- package/dist/carrier-verify.d.ts +10 -2
- package/dist/carrier-verify.d.ts.map +1 -1
- package/dist/carrier-verify.js +98 -23
- package/dist/carrier-verify.js.map +1 -1
- package/dist/carrier.d.ts +4 -2
- package/dist/carrier.d.ts.map +1 -1
- package/dist/carrier.js.map +1 -1
- package/dist/ceiling.d.ts +33 -3
- package/dist/ceiling.d.ts.map +1 -1
- package/dist/ceiling.js +55 -6
- package/dist/ceiling.js.map +1 -1
- package/dist/export.d.ts +112 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +451 -0
- package/dist/export.js.map +1 -0
- package/dist/fuse.d.ts +2 -0
- package/dist/fuse.d.ts.map +1 -1
- package/dist/fuse.js +16 -1
- package/dist/fuse.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/measurements.d.ts +30 -0
- package/dist/measurements.d.ts.map +1 -0
- package/dist/measurements.js +21 -0
- package/dist/measurements.js.map +1 -0
- package/dist/output-root.d.ts +88 -0
- package/dist/output-root.d.ts.map +1 -0
- package/dist/output-root.js +260 -0
- package/dist/output-root.js.map +1 -0
- package/dist/stream.d.ts +46 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +290 -0
- package/dist/stream.js.map +1 -0
- package/dist/tree.d.ts +155 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +456 -0
- package/dist/tree.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/carrier2.test.ts +64 -2
- package/src/__tests__/ceiling.test.ts +12 -4
- package/src/carrier-verify.ts +104 -23
- package/src/carrier.ts +4 -2
- package/src/ceiling.ts +70 -7
- package/src/export.ts +529 -0
- package/src/fuse.ts +13 -1
- package/src/index.ts +30 -0
- package/src/measurements.ts +48 -0
- package/src/output-root.ts +301 -0
- package/src/stream.ts +291 -0
- package/src/tree.ts +548 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAmD,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGpG,OAAO,EAAmD,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE9G,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,eAAO,MAAM,aAAa,EAAG,mBAA4B,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE;QACJ,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,kBAAkB,CAAC;QAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;IACF,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzE,OAAO,EAAE,cAAc,GAAG;QAAE,MAAM,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC;IACvD,UAAU,EAAE,oBAAoB,GAAG;QAAE,MAAM,EAAE,SAAS,CAAC;QAAC,SAA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licensed under the MIT License. See LICENSE.
|
|
2
|
+
/**
|
|
3
|
+
* bitgraph-export/1: one JSON file that, with the file it is about, checks a
|
|
4
|
+
* tree/1 BitGraph with nothing of BitGraph's required (2026-10-03).
|
|
5
|
+
*
|
|
6
|
+
* {
|
|
7
|
+
* "format": "bitgraph-export/1",
|
|
8
|
+
* "spec": base64 SHA-256 of SPEC.md (informational; the proof's SIGNED attribution.message is authoritative),
|
|
9
|
+
* "proof": the signed bitgraph/1 proof,
|
|
10
|
+
* "tree": { "rootDocument": hex(84 bytes),
|
|
11
|
+
* "member": TreeMemberEvidence one file's export
|
|
12
|
+
* or "leaves": base64(count x 65 bytes), the owner's export
|
|
13
|
+
* "names"?: [file name per leaf] }, unsigned, informational
|
|
14
|
+
* "floor": { "blockNumber", "blockHash", "header" } | null,
|
|
15
|
+
* "ceiling": a bitgraph-ceiling/1 sidecar | { "status": "pending" } | null,
|
|
16
|
+
* "settlement": a bitgraph-output-root/1 settlement | { "status": "pending", "baseBlock"? } | null
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* verifyExport answers one line per claim, each saying what it rests on, at
|
|
20
|
+
* two levels: OFFLINE (every link recomputed from the bytes, block headers
|
|
21
|
+
* taken as the ones matching their hashes) and CONFIRMED (the caller's own
|
|
22
|
+
* lookups say those blocks are the chains' own). This module never fetches.
|
|
23
|
+
*
|
|
24
|
+
* Three time claims, never merged:
|
|
25
|
+
* floor the committed bytes were finished after Ethereum block N (needs N canonical)
|
|
26
|
+
* ceiling.base the record existed by Base block B, at B's time (needs B canonical on Base; provisional until then)
|
|
27
|
+
* ceiling.ethereum the record existed by Ethereum block H (needs H canonical; Base's honesty not needed)
|
|
28
|
+
*/
|
|
29
|
+
import { sha256 } from "@noble/hashes/sha256";
|
|
30
|
+
import { verifyProofIntegrity, createVerificationContext } from "./verifier.js";
|
|
31
|
+
import { computeSignedBodyHash } from "./proof-hash.js";
|
|
32
|
+
import { verifyNitroAttestation } from "./nitro.js";
|
|
33
|
+
import { CEILING_VERSION, baseTimeIsBound, verifyCeiling } from "./ceiling.js";
|
|
34
|
+
import { decodeHeader, hexToBytes as evmHex } from "./ceiling-evm.js";
|
|
35
|
+
import { base64ToBytes, bytesEqual, hexToBytes } from "./fuse.js";
|
|
36
|
+
import { OUTPUT_ROOT_VERSION, verifyOutputRootSettlement } from "./output-root.js";
|
|
37
|
+
import { MerkleTree } from "./fuse-merkle.js";
|
|
38
|
+
import { streamDigest } from "./stream.js";
|
|
39
|
+
import { PUBLISHED_PCR0S, publishedMeasurement } from "./measurements.js";
|
|
40
|
+
import { buildTreeMemberEvidence, decodeTreeLeaves, TREE_MEMBER_CATEGORIES, treeLeafHash, verifyTreeLeaves, verifyTreeMember, } from "./tree.js";
|
|
41
|
+
export const EXPORT_FORMAT = "bitgraph-export/1";
|
|
42
|
+
/** Parse an export from JSON text or a parsed object. Structural only; null when it is not export/1. */
|
|
43
|
+
export function parseExport(input) {
|
|
44
|
+
let v = input;
|
|
45
|
+
if (typeof input === "string") {
|
|
46
|
+
try {
|
|
47
|
+
v = JSON.parse(input);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (v === null || typeof v !== "object" || Array.isArray(v))
|
|
54
|
+
return null;
|
|
55
|
+
const e = v;
|
|
56
|
+
if (e["format"] !== EXPORT_FORMAT)
|
|
57
|
+
return null;
|
|
58
|
+
if (typeof e["proof"] !== "object" || e["proof"] === null)
|
|
59
|
+
return null;
|
|
60
|
+
const tree = e["tree"];
|
|
61
|
+
if (!tree || typeof tree !== "object" || typeof tree["rootDocument"] !== "string")
|
|
62
|
+
return null;
|
|
63
|
+
return v;
|
|
64
|
+
}
|
|
65
|
+
const iso = (unix) => new Date(unix * 1000).toISOString().replace(".000Z", "Z");
|
|
66
|
+
export async function verifyExport(input, opts = {}) {
|
|
67
|
+
const claims = [];
|
|
68
|
+
const add = (id, name, result, restsOn, detail, level = "offline") => claims.push({ id, name, result, restsOn, detail, level });
|
|
69
|
+
const times = { floor: null, ceilingBase: null, ceilingEthereum: null };
|
|
70
|
+
let member = null;
|
|
71
|
+
let baseTimeWithheld = null;
|
|
72
|
+
const exp = parseExport(input);
|
|
73
|
+
if (exp === null) {
|
|
74
|
+
// A document that says it is export/1 and lacks its parts is broken; one
|
|
75
|
+
// in another format is not judged here.
|
|
76
|
+
let declared;
|
|
77
|
+
try {
|
|
78
|
+
declared = (typeof input === "string" ? JSON.parse(input) : input)?.format;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
declared = undefined;
|
|
82
|
+
}
|
|
83
|
+
if (declared === EXPORT_FORMAT)
|
|
84
|
+
add("format", "This is a bitgraph-export/1 file", "FALSE", "its structure", "it says bitgraph-export/1 but lacks the parts that format requires (proof, tree.rootDocument)");
|
|
85
|
+
else if (typeof declared === "string" && declared.startsWith("bitgraph-export/"))
|
|
86
|
+
add("format", "This is a bitgraph-export/1 file", "UNDETERMINED", "", `not judged: a format this verifier does not know (${declared})`);
|
|
87
|
+
else
|
|
88
|
+
add("format", "This is a bitgraph-export/1 file", "UNDETERMINED", "", "not a bitgraph-export/1 document");
|
|
89
|
+
return finish(claims, null, times, member, null, null);
|
|
90
|
+
}
|
|
91
|
+
add("format", "This is a bitgraph-export/1 file", "TRUE", "its structure", "format, proof and tree present");
|
|
92
|
+
const proof = exp.proof;
|
|
93
|
+
// An optional part is absent (null or missing) or an object of its format;
|
|
94
|
+
// anything else is a malformed part, never read as "not carried".
|
|
95
|
+
const isAbsent = (v) => v === null || v === undefined;
|
|
96
|
+
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
97
|
+
// Every part below is read defensively, and anything that still throws on
|
|
98
|
+
// a malformed part of a known format becomes a FALSE claim, never an
|
|
99
|
+
// exception (formats it does not know are UNDETERMINED, above and below).
|
|
100
|
+
const run = async () => {
|
|
101
|
+
// 1. The proof, and the attestation bound to it.
|
|
102
|
+
const integrity = await verifyProofIntegrity({ proof, context: createVerificationContext() });
|
|
103
|
+
add("proof.signature", "The proof is signed and its position record is bound to it", integrity.valid ? "TRUE" : "FALSE", "Ed25519", integrity.valid ? "the enclave's signature over the canonical signed body verifies, and the position record's checks pass" : `the proof does not verify: ${integrity.reason ?? "unspecified"}`);
|
|
104
|
+
// The measurement is signed; a proof whose measurement is not hex is broken, not unknown.
|
|
105
|
+
const env = proof.environment;
|
|
106
|
+
const measurement = typeof env?.measurement === "string" && /^[0-9a-fA-F]+$/.test(env.measurement) ? env.measurement.toLowerCase() : null;
|
|
107
|
+
// The attestation document's own time, kept only when the document is AWS's (signature, chain and root all hold).
|
|
108
|
+
let attestedAtMs = null;
|
|
109
|
+
const att = env?.attestation;
|
|
110
|
+
if (att && att.format === "aws-nitro" && typeof att.reportB64 === "string") {
|
|
111
|
+
const n = verifyNitroAttestation(att.reportB64, { ...(measurement !== null ? { expectedPcr0: measurement } : {}), expectedUserDataB64: computeSignedBodyHash(proof), ...(opts.pins?.rootDer ? { rootDer: opts.pins.rootDer } : {}) });
|
|
112
|
+
if (n.doc === null) {
|
|
113
|
+
// Not a Nitro document at all: that contradicts the proof's own claim to carry one.
|
|
114
|
+
add("attestation.signature", "AWS hardware signed the attestation", "FALSE", "", `the attestation does not decode as an AWS Nitro document (${n.checks[0]?.detail ?? "unreadable"})`);
|
|
115
|
+
}
|
|
116
|
+
const byName = (prefix) => n.checks.find((c) => c.name.startsWith(prefix));
|
|
117
|
+
const r = (c) => (c === undefined ? "UNDETERMINED" : c.pass ? "TRUE" : "FALSE");
|
|
118
|
+
const sig = byName("AWS signature"), chain = byName("Certificate chain"), root = byName("Chains to") ?? byName("Trust root"), validity = byName("Certificate validity"), pcr0 = byName("PCR0"), bound = byName("Bound to this proof");
|
|
119
|
+
if (n.doc !== null)
|
|
120
|
+
add("attestation.signature", "AWS hardware signed the attestation", r(sig), "ES384 (P-384)", sig?.detail ?? "not reached");
|
|
121
|
+
add("attestation.chain", "The certificate chain holds together", r(chain), "ES384 (P-384)", chain?.detail ?? "not reached");
|
|
122
|
+
add("attestation.root", "The chain reaches the AWS Nitro root", r(root), `the AWS Nitro Enclaves Root CA G1 (${n.rootSha256.slice(0, 8)}…)`, root?.detail ?? "not reached");
|
|
123
|
+
add("attestation.validity", "Every certificate was valid at the document's own instant (archival policy, not freshness)", r(validity), "the document's signed timestamp", validity?.detail ?? "not reached");
|
|
124
|
+
if (measurement === null)
|
|
125
|
+
add("attestation.pcr0", "The attested image is the one the proof names", "FALSE", "", "the proof's environment.measurement is not a hex string, so it names no image");
|
|
126
|
+
else
|
|
127
|
+
add("attestation.pcr0", "The attested image is the one the proof names", r(pcr0), "PCR0 inside the signed document", pcr0?.detail ?? "not reached");
|
|
128
|
+
add("attestation.binding", "The attestation is bound to this proof (user_data = SHA-256 of the signed body)", r(bound), "user_data inside the signed document", bound?.detail ?? "not reached");
|
|
129
|
+
const hardwareOk = n.doc !== null && measurement !== null && [sig, chain, root, validity, pcr0, bound].every((c) => c?.pass === true);
|
|
130
|
+
if (sig?.pass && chain?.pass && root?.pass && typeof n.doc?.timestampMs === "number")
|
|
131
|
+
attestedAtMs = n.doc.timestampMs;
|
|
132
|
+
// Which image is BitGraph's is a measurement policy: BitGraph's published images unless the caller names its own.
|
|
133
|
+
// The image judged is the one the DOCUMENT attests, and only once the hardware's word verified in full.
|
|
134
|
+
const docPcr0 = n.doc?.pcrs?.[0];
|
|
135
|
+
const measured = typeof docPcr0 === "string" ? docPcr0.toLowerCase() : null;
|
|
136
|
+
const usingDefault = opts.pins?.pcr0 === undefined;
|
|
137
|
+
const policy = (opts.pins?.pcr0 ?? PUBLISHED_PCR0S).map((x) => String(x).toLowerCase());
|
|
138
|
+
if (!hardwareOk || measured === null) {
|
|
139
|
+
add("attestation.pins", "The image is one the verifier accepts", "UNDETERMINED", "", "not judged: the attestation did not verify in full, and a declared measurement is not hardware evidence");
|
|
140
|
+
}
|
|
141
|
+
else if (policy.length === 0) {
|
|
142
|
+
add("attestation.pins", "The image is one the verifier accepts", "UNDETERMINED", "", `no accepted images were given: PCR0 is ${measured}; any AWS Nitro enclave can produce a valid attestation, and only a measurement policy says whose this is`);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const ok = policy.includes(measured);
|
|
146
|
+
const pub = publishedMeasurement(measured);
|
|
147
|
+
add("attestation.pins", "The image is one the verifier accepts", ok ? "TRUE" : "FALSE", usingDefault ? "BitGraph's published enclave images (SPEC section 16)" : "the verifier's own list", ok
|
|
148
|
+
? usingDefault && pub ? `PCR0 ${measured.slice(0, 16)}… is BitGraph's published ${pub.version} image (since ${pub.since})` : `PCR0 ${measured.slice(0, 16)}… is on the verifier's list`
|
|
149
|
+
: usingDefault ? `PCR0 ${measured.slice(0, 16)}… is not an image BitGraph published, so this proof is not BitGraph's` : `PCR0 ${measured.slice(0, 16)}… is not on the verifier's list`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
add("attestation.signature", "AWS hardware signed the attestation", "FALSE", "", "the proof carries no aws-nitro attestation");
|
|
154
|
+
}
|
|
155
|
+
// 2. The tree: the spec pin, the root document, and the member or the whole list.
|
|
156
|
+
const rootDoc = hexToBytes(exp.tree.rootDocument);
|
|
157
|
+
const extra = opts.extraSpecHashes ?? [];
|
|
158
|
+
let memberEvidence = exp.tree.member;
|
|
159
|
+
let ownerList = null;
|
|
160
|
+
const leavesBytes = typeof exp.tree.leaves === "string" ? base64ToBytes(exp.tree.leaves) : null;
|
|
161
|
+
if (exp.tree.leaves !== undefined) {
|
|
162
|
+
const lc = rootDoc === null ? { ok: false, reason: "the root document is not hex" } : leavesBytes === null ? { ok: false, reason: "the leaves are not base64" } : verifyTreeLeaves(rootDoc, leavesBytes);
|
|
163
|
+
add("tree.leaves", "The whole list rebuilds the committed root, sorted and without duplicates", lc.ok ? "TRUE" : "FALSE", "SHA-256 (RFC 6962 tree)", lc.ok ? `${lc.count} leaves` : lc.reason ?? "invalid");
|
|
164
|
+
// The owner's export: find the file's leaf in the list and build its path here.
|
|
165
|
+
ownerList = { ok: lc.ok, found: false };
|
|
166
|
+
if (lc.ok && (opts.bytes !== undefined || opts.source !== undefined) && leavesBytes !== null && rootDoc !== null) {
|
|
167
|
+
const leaves = decodeTreeLeaves(leavesBytes);
|
|
168
|
+
const d = opts.bytes !== undefined ? sha256(opts.bytes) : await streamDigest(opts.source);
|
|
169
|
+
const k = leaves.findIndex((l) => bytesEqual(l.artifact, d) || bytesEqual(l.origin, d));
|
|
170
|
+
if (k >= 0) {
|
|
171
|
+
const t = new MerkleTree(leaves.map(treeLeafHash));
|
|
172
|
+
memberEvidence = buildTreeMemberEvidence(leaves[k], k, leaves.length, t.path(k));
|
|
173
|
+
ownerList.found = true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const haveFile = opts.bytes !== undefined || opts.source !== undefined;
|
|
178
|
+
const tr = await verifyTreeMember({
|
|
179
|
+
proof,
|
|
180
|
+
...(opts.bytes !== undefined ? { bytes: opts.bytes } : {}),
|
|
181
|
+
...(opts.source !== undefined ? { source: opts.source } : {}),
|
|
182
|
+
...(memberEvidence !== undefined ? { member: memberEvidence } : {}),
|
|
183
|
+
// The export's own root document, never the proof's unsigned echo: a malformed one fails.
|
|
184
|
+
rootDocument: rootDoc ?? new Uint8Array(0),
|
|
185
|
+
extraSpecHashes: extra,
|
|
186
|
+
proofAlreadyVerified: integrity.valid,
|
|
187
|
+
});
|
|
188
|
+
// A spec this verifier does not know is not judged: its rules may differ
|
|
189
|
+
// from every rule here, so neither TRUE nor FALSE is earned (SPEC 8.4).
|
|
190
|
+
const unknownSpec = tr.category === "UNKNOWN_SPEC";
|
|
191
|
+
const specOk = !unknownSpec && tr.category !== "INVALID_TREE_MARKER" && tr.category !== "NOT_TREE";
|
|
192
|
+
add("spec.pin", "The proof pins a spec this verifier knows", specOk ? "TRUE" : unknownSpec ? "UNDETERMINED" : "FALSE", "the signed attribution.message", (specOk ? `SPEC.md SHA-256 ${tr.specHashB64}` : unknownSpec ? `${tr.reason}; a verifier that knows that spec can judge the tree` : tr.reason) + (exp.spec !== proof.attribution?.message ? `; note: the export's unsigned "spec" label (${String(exp.spec)}) differs, and only the signed value counts` : ""));
|
|
193
|
+
if (unknownSpec) {
|
|
194
|
+
// The owner's list was read under this verifier's rules before the pin was known: not judged either.
|
|
195
|
+
const leavesClaim = claims.find((c) => c.id === "tree.leaves");
|
|
196
|
+
if (leavesClaim) {
|
|
197
|
+
leavesClaim.result = "UNDETERMINED";
|
|
198
|
+
leavesClaim.detail = `not judged: the proof follows a spec this verifier does not know (under this verifier's rules: ${leavesClaim.detail})`;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const rootOk = tr.tree !== null;
|
|
202
|
+
add("tree.root", "The root document is the signed one and carries this position's commitment", rootOk ? "TRUE" : specOk || rootDoc === null ? "FALSE" : "UNDETERMINED", "SHA-256 over the signed position record, its nonce and the signed floor block hash", rootOk ? `a tree of ${tr.tree.count} leaves, root ${tr.tree.rootHex.slice(0, 16)}…` : tr.reason);
|
|
203
|
+
member = tr.member;
|
|
204
|
+
if (memberEvidence === undefined) {
|
|
205
|
+
const why = ownerList === null
|
|
206
|
+
? "the export carries no member evidence"
|
|
207
|
+
: !ownerList.ok
|
|
208
|
+
? "the owner's list did not verify, so no member can be read from it"
|
|
209
|
+
: !haveFile
|
|
210
|
+
? "no file in hand to look up in the owner's list"
|
|
211
|
+
: "the file in hand is not in the owner's list";
|
|
212
|
+
add("tree.member", "The file's leaf is in the committed tree", "NOT_CARRIED", "", why);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
const pathOk = tr.member !== null;
|
|
216
|
+
add("tree.member", "The file's leaf is in the committed tree", pathOk ? "TRUE" : rootOk ? "FALSE" : "UNDETERMINED", "SHA-256 (RFC 9162 path)", pathOk ? `leaf ${tr.member.index} of ${tr.member.count}; a path proves this leaf only, not the order of the others` : tr.reason);
|
|
217
|
+
}
|
|
218
|
+
if (!haveFile) {
|
|
219
|
+
add("bytes.member", "The file in hand is that member", "NOT_CARRIED", "", "the file is not in hand");
|
|
220
|
+
}
|
|
221
|
+
else if (ownerList !== null && ownerList.ok && !ownerList.found && tr.tree !== null) {
|
|
222
|
+
// The whole list is verified (sorted, unique, rebuilds the signed root), so its absence from it is a finding, not a gap.
|
|
223
|
+
add("bytes.member", "The file in hand is that member", "FALSE", "the verified complete list of the committed tree", tr.category === "TREE_MEMBERSHIP_UNPROVEN"
|
|
224
|
+
? "these bytes carry this position's commitment, so they were made after the position existed, but they are not in the committed tree"
|
|
225
|
+
: "the file is not among the committed tree's leaves");
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
const isMember = TREE_MEMBER_CATEGORIES.includes(tr.category);
|
|
229
|
+
add("bytes.member", "The file in hand is that member", isMember ? "TRUE" : tr.member !== null ? "FALSE" : "UNDETERMINED", tr.category === "TREE_MEMBER_FROM_ORIGIN" ? "the placement rule, rebuilt here" : "SHA-256", `${tr.category}: ${tr.reason}`);
|
|
230
|
+
if (isMember) {
|
|
231
|
+
// Two floors, stated apart (SPEC 8.6). The record floor is every member's:
|
|
232
|
+
// the root document was signed after the floor block. The content floor
|
|
233
|
+
// is a placed member's: its committed bytes carry the commitment.
|
|
234
|
+
const n = proof.commit?.slotAnchor?.blockNumber;
|
|
235
|
+
const block = typeof n === "number" ? `Ethereum block ${n}` : "the signed floor block";
|
|
236
|
+
add("floor.record", "The record was made after the floor block", "TRUE", "the signed root document, which carries the commitment to the floor block", `recorded after ${block}: the tree this file is a leaf of was signed after it`);
|
|
237
|
+
if (tr.floorCovers === "content") {
|
|
238
|
+
add("floor.content", "The committed bytes were finished after the floor block", "TRUE", "SHA-256: the commitment is inside the committed bytes", `the committed bytes carry the commitment to ${block}, so they were finished after it; the original inside them is not dated by it`);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
add("floor.content", "The committed bytes were finished after the floor block", "NOT_CARRIED", "", "recorded as is: the bytes carry no commitment, so the bytes themselves are not dated");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// 3. The floor: the header hashes to the SIGNED slotAnchor block hash.
|
|
246
|
+
const slotAnchor = proof.commit?.slotAnchor;
|
|
247
|
+
if (isAbsent(exp.floor)) {
|
|
248
|
+
add("floor.header", "The floor block's header is the one the proof signs", "NOT_CARRIED", "", "no floor header in the export");
|
|
249
|
+
}
|
|
250
|
+
else if (!isObject(exp.floor)) {
|
|
251
|
+
add("floor.header", "The floor block's header is the one the proof signs", "FALSE", "", "the export's floor is neither absent nor a { blockNumber, blockHash, header } object");
|
|
252
|
+
}
|
|
253
|
+
else if (!slotAnchor) {
|
|
254
|
+
add("floor.header", "The floor block's header is the one the proof signs", "FALSE", "", "the proof signs no floor block (commit.slotAnchor)");
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
try {
|
|
258
|
+
const h = decodeHeader(evmHex(exp.floor.header));
|
|
259
|
+
const ok = h.hash === slotAnchor.blockHash.toLowerCase() && h.number === slotAnchor.blockNumber && exp.floor.blockHash.toLowerCase() === h.hash && exp.floor.blockNumber === h.number;
|
|
260
|
+
add("floor.header", "The floor block's header is the one the proof signs", ok ? "TRUE" : "FALSE", `Ethereum block ${h.number}, header as given`, ok ? `keccak-256 of the header equals the signed block hash; its time is ${iso(h.timestamp)}` : "the header does not hash to the signed floor block");
|
|
261
|
+
if (ok)
|
|
262
|
+
times.floor = { blockNumber: h.number, blockHash: h.hash, blockTimestamp: h.timestamp };
|
|
263
|
+
}
|
|
264
|
+
catch (e) {
|
|
265
|
+
add("floor.header", "The floor block's header is the one the proof signs", "FALSE", "", `floor header: ${e.message}`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// 4. The ceiling on Base: the record is under a root in a Base transaction in block B.
|
|
269
|
+
const writer = opts.pins?.ceilingWriter ?? "0xf3972408D853c975F86351C311f4310220bbF2a3";
|
|
270
|
+
const baseChainId = opts.pins?.baseChainId ?? 8453;
|
|
271
|
+
let ceilingB = null;
|
|
272
|
+
const c = exp.ceiling;
|
|
273
|
+
const ceilingVersion = c?.version;
|
|
274
|
+
const ceilingUnknown = typeof ceilingVersion === "string" && ceilingVersion !== CEILING_VERSION;
|
|
275
|
+
if (ceilingUnknown) {
|
|
276
|
+
add("ceiling.base", "The record is in a Base block", "UNDETERMINED", "", `not judged: a ceiling format this verifier does not know (${ceilingVersion})`);
|
|
277
|
+
}
|
|
278
|
+
else if (isAbsent(c)) {
|
|
279
|
+
add("ceiling.base", "The record is in a Base block", "NOT_CARRIED", "", "no ceiling in the export");
|
|
280
|
+
}
|
|
281
|
+
else if (!isObject(c) || (!c["anchor"] && c["status"] !== "pending")) {
|
|
282
|
+
add("ceiling.base", "The record is in a Base block", "FALSE", "", "the export's ceiling is neither absent, pending, nor a sidecar with its transaction");
|
|
283
|
+
}
|
|
284
|
+
else if (!c["anchor"]) {
|
|
285
|
+
// Pending means no transaction to check. With a transaction, the
|
|
286
|
+
// sidecar's status is the writer's report and is never read as evidence.
|
|
287
|
+
add("ceiling.base", "The record is in a Base block", "NOT_CARRIED", "", "ceiling pending: the Base write had not landed when this export was made");
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
let r;
|
|
291
|
+
try {
|
|
292
|
+
r = await verifyCeiling(proof, c, { writerAddress: writer, chainId: baseChainId, proofAlreadyVerified: integrity.valid });
|
|
293
|
+
}
|
|
294
|
+
catch (e) {
|
|
295
|
+
r = { ok: false, reason: `the ceiling is malformed (${e.message})`, checks: [], headerCheckedAgainstChain: false };
|
|
296
|
+
}
|
|
297
|
+
if (r.ok && r.window) {
|
|
298
|
+
ceilingB = { blockNumber: r.window.ceiling.blockNumber, blockHash: r.window.ceiling.blockHash };
|
|
299
|
+
const where = `under the root in transaction ${c.anchor.txIndex} of Base block ${r.window.ceiling.blockNumber}`;
|
|
300
|
+
// The floor's time: the export's own header, else the verified header the sidecar carries.
|
|
301
|
+
const stamp = baseTimeIsBound(r.window.ceiling.blockTimestamp, { floorTimestampSec: times.floor?.blockTimestamp ?? r.window.floor.blockTimestamp ?? null, attestedAtMs });
|
|
302
|
+
if (stamp.ok) {
|
|
303
|
+
times.ceilingBase = { ...r.window.ceiling, provisional: true };
|
|
304
|
+
add("ceiling.base", "The record is in a Base block", "TRUE", `SHA-256 path, the BGC1 payload, secp256k1, Merkle-Patricia; Base block ${r.window.ceiling.blockNumber}, header as given`, `${where}; its time ${iso(r.window.ceiling.blockTimestamp)} is provisional until the block is checked against Base`);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
// The inclusion holds; only the stamp is withheld as a bound.
|
|
308
|
+
baseTimeWithheld = stamp.reason;
|
|
309
|
+
add("ceiling.base", "The record is in a Base block", "TRUE", `SHA-256 path, the BGC1 payload, secp256k1, Merkle-Patricia; Base block ${r.window.ceiling.blockNumber}, header as given`, `${where}; ${stamp.reason}, so its time is not used as a bound`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
add("ceiling.base", "The record is in a Base block", "FALSE", "", r.reason ?? "the ceiling does not verify");
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// 5. The settlement: the Base transaction existed by Ethereum block H.
|
|
317
|
+
const s = exp.settlement;
|
|
318
|
+
const settlementVersion = s?.version;
|
|
319
|
+
if (typeof settlementVersion === "string" && settlementVersion !== OUTPUT_ROOT_VERSION) {
|
|
320
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "UNDETERMINED", "", `not judged: a settlement format this verifier does not take in an export (${settlementVersion})`);
|
|
321
|
+
}
|
|
322
|
+
else if (isAbsent(s)) {
|
|
323
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "NOT_CARRIED", "", "no settlement in the export");
|
|
324
|
+
}
|
|
325
|
+
else if (!isObject(s)) {
|
|
326
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "FALSE", "", "the export's settlement is neither absent, pending, nor a settlement object");
|
|
327
|
+
}
|
|
328
|
+
else if (s["status"] === "pending" && s["version"] === undefined) {
|
|
329
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "NOT_CARRIED", "", "settlement pending: Base's claim for this block had not reached Ethereum when this export was made");
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
const so = s;
|
|
333
|
+
let r;
|
|
334
|
+
try {
|
|
335
|
+
r = verifyOutputRootSettlement(so, { baseChainId, ethereumChainId: opts.pins?.ethereumChainId ?? 1 });
|
|
336
|
+
}
|
|
337
|
+
catch (e) {
|
|
338
|
+
r = { ok: false, reason: `the settlement is malformed (${e.message})`, checks: [] };
|
|
339
|
+
}
|
|
340
|
+
const linked = ceilingB !== null && so.base?.blockNumber === ceilingB.blockNumber && typeof so.base?.blockHash === "string" && so.base.blockHash.toLowerCase() === ceilingB.blockHash.toLowerCase();
|
|
341
|
+
if (r.ok && linked) {
|
|
342
|
+
times.ceilingEthereum = r.existedBy;
|
|
343
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "TRUE", `keccak-256 output root, EIP-2935 storage proof, Merkle-Patricia; Ethereum block ${r.existedBy.blockNumber}, header as given`, `Base's output root for block ${so.outputRoot.blockNumber} commits to the ceiling's Base block and is carried by transaction ${so.ethereum.txIndex} of Ethereum block ${r.existedBy.blockNumber} (${iso(r.existedBy.blockTimestamp)}); this holds whatever Base's claim turns out to be`);
|
|
344
|
+
}
|
|
345
|
+
else if (r.ok && !linked && ceilingUnknown) {
|
|
346
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "UNDETERMINED", "", "the settlement verifies, but the ceiling it settles is in a format this verifier does not know, so the link is not judged");
|
|
347
|
+
}
|
|
348
|
+
else if (r.ok && !linked) {
|
|
349
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "FALSE", "", ceilingB === null ? "the settlement settles a Base block, but the ceiling did not verify" : "the settlement is for a different Base block than the ceiling");
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
add("ceiling.ethereum", "The record existed by an Ethereum block", "FALSE", "", r.reason ?? "the settlement does not verify");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// 6. Confirmed: the caller's lookups say the blocks are the chains' own.
|
|
356
|
+
const confirm = async (id, name, chain, at) => {
|
|
357
|
+
if (at === null)
|
|
358
|
+
return;
|
|
359
|
+
const ask = chain === "ethereum" ? opts.lookups?.ethereumBlockHash : opts.lookups?.baseBlockHash;
|
|
360
|
+
if (!ask) {
|
|
361
|
+
add(id, name, "UNDETERMINED", "", `not checked: no ${chain === "ethereum" ? "Ethereum" : "Base"} lookup was given (block ${at.blockNumber}, ${at.blockHash})`, "confirmed");
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
try {
|
|
365
|
+
const got = (await ask(at.blockNumber))?.toLowerCase() ?? null;
|
|
366
|
+
if (got === null)
|
|
367
|
+
add(id, name, "UNDETERMINED", "", `the lookup did not return block ${at.blockNumber}`, "confirmed");
|
|
368
|
+
else
|
|
369
|
+
add(id, name, got === at.blockHash.toLowerCase() ? "TRUE" : "FALSE", `the caller's ${chain === "ethereum" ? "Ethereum" : "Base"} node`, got === at.blockHash.toLowerCase() ? `block ${at.blockNumber} is the chain's own` : `the chain's block ${at.blockNumber} is ${got}`, "confirmed");
|
|
370
|
+
}
|
|
371
|
+
catch (e) {
|
|
372
|
+
add(id, name, "UNDETERMINED", "", `lookup failed: ${e.message}`, "confirmed");
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
await confirm("confirmed.floor", "The floor block is Ethereum's own", "ethereum", times.floor);
|
|
376
|
+
await confirm("confirmed.ceiling.base", "The ceiling block is Base's own (makes its time final)", "base", ceilingB);
|
|
377
|
+
await confirm("confirmed.ceiling.ethereum", "The settlement block is Ethereum's own", "ethereum", times.ceilingEthereum);
|
|
378
|
+
const baseConfirmed = claims.find((x) => x.id === "confirmed.ceiling.base")?.result === "TRUE";
|
|
379
|
+
if (times.ceilingBase)
|
|
380
|
+
times.ceilingBase.provisional = !baseConfirmed;
|
|
381
|
+
return finish(claims, exp, times, member, tr.floorCovers, baseTimeWithheld);
|
|
382
|
+
};
|
|
383
|
+
try {
|
|
384
|
+
return await run();
|
|
385
|
+
}
|
|
386
|
+
catch (e) {
|
|
387
|
+
add("wellformed", "Every part of the export is well formed", "FALSE", "", `a part of this export is malformed: ${e.message}`);
|
|
388
|
+
return finish(claims, exp, times, member, null, baseTimeWithheld);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* The verdict and the reading, from the claims (SPEC section 12.1).
|
|
393
|
+
*
|
|
394
|
+
* FALSE when any claim is FALSE, a lookup the reader made included: a block
|
|
395
|
+
* a node says is not the chain's own refutes every time read from it.
|
|
396
|
+
* UNDETERMINED when any offline claim is undetermined, the measurement
|
|
397
|
+
* policy included. Otherwise TRUE. The reading states a time as fact only
|
|
398
|
+
* when nothing refutes it, says when a header is taken as given, and never
|
|
399
|
+
* states a Base time that was withheld as a bound.
|
|
400
|
+
*/
|
|
401
|
+
function finish(claims, exp, times, member, floorCovers = null, baseTimeWithheld = null) {
|
|
402
|
+
const offline = claims.filter((c) => c.level === "offline");
|
|
403
|
+
const failed = claims.filter((c) => c.result === "FALSE");
|
|
404
|
+
const reasons = claims.filter((c) => c.result === "FALSE" || c.result === "UNDETERMINED").map((c) => `${c.id}: ${c.detail}`);
|
|
405
|
+
const unjudged = offline.filter((c) => c.result === "UNDETERMINED");
|
|
406
|
+
const verdict = failed.length > 0 ? "FALSE" : exp === null || unjudged.length > 0 ? "UNDETERMINED" : "TRUE";
|
|
407
|
+
const confirmedTrue = (id) => claims.find((c) => c.id === id)?.result === "TRUE";
|
|
408
|
+
const parts = [];
|
|
409
|
+
if (verdict === "FALSE") {
|
|
410
|
+
if (failed.every((c) => c.level === "confirmed")) {
|
|
411
|
+
parts.push(`A lookup refutes this export: ${failed.map((c) => c.detail).join("; ")}. A block it names is not the chain's own, so the times it states do not hold.`);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
parts.push("Something in this export contradicts the proof; see the failed claims.");
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
else if (exp === null) {
|
|
418
|
+
parts.push("This is not a bitgraph-export/1 file.");
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
const lc1 = (t) => t.charAt(0).toLowerCase() + t.slice(1);
|
|
422
|
+
if (unjudged.length > 0)
|
|
423
|
+
parts.push(`Not judged in full: ${unjudged.map((c) => lc1(c.name)).join("; ")}.`);
|
|
424
|
+
const givenEth = "; that block's header is taken as given until it is checked against Ethereum";
|
|
425
|
+
if (times.floor) {
|
|
426
|
+
const at = `Ethereum block ${times.floor.blockNumber} (${iso(times.floor.blockTimestamp)})${confirmedTrue("confirmed.floor") ? "" : givenEth}`;
|
|
427
|
+
parts.push(floorCovers === "record"
|
|
428
|
+
? `Recorded after ${at}; this file was kept as is, so the bytes themselves are not dated.`
|
|
429
|
+
: floorCovers === "content"
|
|
430
|
+
? `Recorded after ${at}, and these committed bytes were finished after that block; an original inside them is not dated by it.`
|
|
431
|
+
: `Recorded after ${at}.`);
|
|
432
|
+
}
|
|
433
|
+
if (times.ceilingBase)
|
|
434
|
+
parts.push(`The record existed by Base block ${times.ceilingBase.blockNumber} (${iso(times.ceilingBase.blockTimestamp)}${times.ceilingBase.provisional ? ", provisional until checked against Base" : ""}).`);
|
|
435
|
+
else if (baseTimeWithheld)
|
|
436
|
+
parts.push(`The record is in a Base block, but its time is not used as a bound: ${baseTimeWithheld}.`);
|
|
437
|
+
if (times.ceilingEthereum)
|
|
438
|
+
parts.push(`It existed by Ethereum block ${times.ceilingEthereum.blockNumber} (${iso(times.ceilingEthereum.blockTimestamp)})${confirmedTrue("confirmed.ceiling.ethereum") ? "" : givenEth}.`);
|
|
439
|
+
if (member)
|
|
440
|
+
parts.push(`The file is leaf ${member.index} of ${member.count} in the committed tree.`);
|
|
441
|
+
}
|
|
442
|
+
return { verdict, reasons, claims, member, floorCovers, times, baseTimeWithheld, reading: parts.join(" ") };
|
|
443
|
+
}
|
|
444
|
+
/** Build an export object from its parts (producers). Fields are written in the order the spec lists them. */
|
|
445
|
+
export function buildExport(parts) {
|
|
446
|
+
const spec = parts.proof.attribution?.message;
|
|
447
|
+
if (typeof spec !== "string")
|
|
448
|
+
throw new TypeError("a tree/1 proof pins its spec in attribution.message");
|
|
449
|
+
return { format: EXPORT_FORMAT, spec, proof: parts.proof, tree: parts.tree, floor: parts.floor, ceiling: parts.ceiling, settlement: parts.settlement };
|
|
450
|
+
}
|
|
451
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAuB,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAA6B,MAAM,kBAAkB,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY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CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,qDAAqD,CAAC,CAAC;IACzG,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;AACzJ,CAAC"}
|
package/dist/fuse.d.ts
CHANGED
|
@@ -90,6 +90,8 @@ export declare function parseFusePayload(bytes: Uint8Array): {
|
|
|
90
90
|
commitment: Uint8Array;
|
|
91
91
|
originDigest?: Uint8Array;
|
|
92
92
|
} | null;
|
|
93
|
+
/** The largest file a container placement can hold: 8 GiB - 1, the ustar header's 11-digit octal size field (SPEC 7.3). */
|
|
94
|
+
export declare const MAX_CONTAINER_ENTRY_BYTES = 8589934591;
|
|
93
95
|
export type PlacementId = "trailer/1" | "container/1" | "container/2" | "produced/1" | "set/1" | "set/2";
|
|
94
96
|
export interface Located {
|
|
95
97
|
/** The commitment found in the fused bytes. */
|
package/dist/fuse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuse.d.ts","sourceRoot":"","sources":["../src/fuse.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAsC,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElF,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM7E,eAAO,MAAM,YAAY,EAAG,iBAA0B,CAAC;AAEvD,gFAAgF;AAChF,eAAO,MAAM,WAAW,EAAE,UAMtB,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,mBAAe,CAAC;AAElD,0FAA0F;AAC1F,eAAO,M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AS,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE;YAAE,SAAS,EAAE,QAAQ,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QACjD,QAAQ,EAAE;YAAE,SAAS,EAAE,QAAQ,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAClD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,CAAC;IACF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,WAAW,CAAC;IACvB,cAAc,EAAE,UAAU,CAAC;IAC3B,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B,GAAG,SAAS,CAiBZ;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CA2B3D;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAW5D"}
|
package/dist/fuse.js
CHANGED
|
@@ -314,7 +314,9 @@ export function parseFusePayload(bytes) {
|
|
|
314
314
|
// Minimal deterministic ustar (POSIX.1-1988) for container/1 and container/2
|
|
315
315
|
// ---------------------------------------------------------------------------
|
|
316
316
|
const BLOCK = 512;
|
|
317
|
-
|
|
317
|
+
/** The largest file a container placement can hold: 8 GiB - 1, the ustar header's 11-digit octal size field (SPEC 7.3). */
|
|
318
|
+
export const MAX_CONTAINER_ENTRY_BYTES = 0o77777777777;
|
|
319
|
+
const MAX_ENTRY = MAX_CONTAINER_ENTRY_BYTES;
|
|
318
320
|
function octal(n, width) {
|
|
319
321
|
const s = n.toString(8).padStart(width - 1, "0") + "\0";
|
|
320
322
|
if (s.length !== width)
|
|
@@ -433,6 +435,10 @@ const container1 = {
|
|
|
433
435
|
const rebuilt = buildContainer(o.data, m.data);
|
|
434
436
|
if (!bytesEqual(rebuilt, fused))
|
|
435
437
|
return null;
|
|
438
|
+
// And the original inside must be the one the manifest names: the declared
|
|
439
|
+
// digest is never taken on the archive's word.
|
|
440
|
+
if (!bytesEqual(sha256(o.data), payload.originDigest))
|
|
441
|
+
return null;
|
|
436
442
|
return { commitment: payload.commitment, originDigest: payload.originDigest, originalBytes: o.data };
|
|
437
443
|
},
|
|
438
444
|
frame({ originalSize, originDigest, commitment }) {
|
|
@@ -482,6 +488,9 @@ const container2 = {
|
|
|
482
488
|
const rebuilt = buildContainer2(o.data, m.data);
|
|
483
489
|
if (!bytesEqual(rebuilt, fused))
|
|
484
490
|
return null;
|
|
491
|
+
// And the original inside must be the one the manifest names.
|
|
492
|
+
if (!bytesEqual(sha256(o.data), payload.originDigest))
|
|
493
|
+
return null;
|
|
485
494
|
return { commitment: payload.commitment, originDigest: payload.originDigest, originalBytes: o.data };
|
|
486
495
|
},
|
|
487
496
|
frame({ originalSize, originDigest, commitment }) {
|
|
@@ -978,6 +987,12 @@ export function readFuseAttribution(proof) {
|
|
|
978
987
|
const version = fuseVersionOfName(a?.name);
|
|
979
988
|
if (a === undefined || version === null)
|
|
980
989
|
return null;
|
|
990
|
+
// A tree/1 proof carries the fuse/2 name, but it is not a single fused file:
|
|
991
|
+
// its committed artifact is the tree's root document and its message is the
|
|
992
|
+
// SPEC hash, not an origin. Read it with verifyTreeMember (tree.ts), never
|
|
993
|
+
// here, or the spec hash would be taken for an origin digest.
|
|
994
|
+
if (a.title === "tree/1")
|
|
995
|
+
return null;
|
|
981
996
|
const declared = typeof a.title === "string" && a.title.length > 0;
|
|
982
997
|
const marker = { placement: declared ? a.title : null, placementSource: declared ? "attribution" : null, source: "attribution", version };
|
|
983
998
|
if (typeof a.message === "string" && a.message.length > 0) {
|