@mikeargento/bitgraph-verify 1.17.0 → 1.18.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/README.md +1 -1
- package/dist/__tests__/carrier2.test.js +1 -1
- package/dist/__tests__/carrier2.test.js.map +1 -1
- package/dist/carrier-assemble.d.ts +19 -1
- package/dist/carrier-assemble.d.ts.map +1 -1
- package/dist/carrier-assemble.js +15 -2
- package/dist/carrier-assemble.js.map +1 -1
- package/dist/carrier-verify.d.ts +8 -1
- package/dist/carrier-verify.d.ts.map +1 -1
- package/dist/carrier-verify.js +115 -18
- package/dist/carrier-verify.js.map +1 -1
- package/dist/carrier.d.ts +42 -10
- package/dist/carrier.d.ts.map +1 -1
- package/dist/carrier.js +82 -11
- package/dist/carrier.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/carrier2.test.ts +1 -1
- package/src/carrier-assemble.ts +28 -2
- package/src/carrier-verify.ts +125 -15
- package/src/carrier.ts +98 -19
- package/src/index.ts +6 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,M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,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7I,OAAO,EACL,mBAAmB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,yBAAyB,EAC7F,iBAAiB,EAAE,WAAW,EAAE,0BAA0B,GAC3D,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAG/H,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACxJ,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC1G,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,9 @@ export { assembleCarrierV2Payload, carrierBlockSize, CARRIER_BLOCK_ZIP_LIMIT } f
|
|
|
33
33
|
/* bitgraph-carrier/3 (2026-10-06, enclave v10): the floor is the Base header the proof signs; no ceiling in position exists. */
|
|
34
34
|
export { CARRIER_VERSION_3, baseHeaderFields } from "./carrier.js";
|
|
35
35
|
export { assembleCarrierV3Payload } from "./carrier-assemble.js";
|
|
36
|
+
/* bitgraph-carrier/4 (2026-10-11): one member of a tree/1 BitGraph carries its own proof: the bytes are the leaf's, the block walks them to the signed root document. */
|
|
37
|
+
export { CARRIER_VERSION_4, memberArtifactDigest } from "./carrier.js";
|
|
38
|
+
export { assembleCarrierV4Payload } from "./carrier-assemble.js";
|
|
36
39
|
/* AWS Nitro attestation: decode, verify (chain to the AWS root, validity at the document's instant), and the openssl-checkable witness. */
|
|
37
40
|
export { AWS_NITRO_ROOT_CA_PEM, awsNitroRootDer, awsNitroRootSha256, decodeNitroAttestation, verifyNitroAttestation, attestationWitness, witnessMatchesAttestation, encodeSigStructure, rawEcdsaSigToDer, derToPem, pemToDer, ATTESTATION_WITNESS_FORMAT, } from "./nitro.js";
|
|
38
41
|
/* Settlement of a Base ceiling on Ethereum: L1 data inclusion (bitgraph-settlement/1). The pointer layer is here; the blob layer is bitgraph-audit's. */
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F;;;;;;GAMG;AAEH,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,aAAa,GAGd,MAAM,aAAa,CAAC;AAiBrB,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAG7G,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7G,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEvF,gFAAgF;AAChF,OAAO,EACL,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACvB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,sBA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F,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,WAAW,EACjH,uBAAuB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAC1H,iBAAiB,EAAE,OAAO,EAAE,gBAAgB,GAC7C,MAAM,WAAW,CAAC;AAGnB,2GAA2G;AAC3G,OAAO,EACL,mBAAmB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,yBAAyB,EAC7F,iBAAiB,EAAE,WAAW,EAAE,0BAA0B,GAC3D,MAAM,kBAAkB,CAAC;AAG1B,yHAAyH;AACzH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC7E,qFAAqF;AACrF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAExJ,kGAAkG;AAClG,OAAO,EAAE,8BAA8B,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ test("a v1 reader's view of a v2 block: an unknown version is UNDETERMINED, neve
|
|
|
211
211
|
// A reader from before /2 rejects the version string in payloadShapeError; the same
|
|
212
212
|
// path is taken here for any version this reader does not know.
|
|
213
213
|
const p = golden() as unknown as Record<string, unknown>;
|
|
214
|
-
p["carrier"] = "bitgraph-carrier/
|
|
214
|
+
p["carrier"] = "bitgraph-carrier/5"; // /3 exists since 2026-10-06 (a Base floor), /4 since 2026-10-11 (a tree member); /5 does not
|
|
215
215
|
const r = await verifyCarrier(buildCarrier(inner, p as unknown as CarrierPayload));
|
|
216
216
|
assert.equal(r.verdict, "UNDETERMINED");
|
|
217
217
|
assert.equal(r.carrier, "corrupt");
|
package/src/carrier-assemble.ts
CHANGED
|
@@ -12,9 +12,15 @@
|
|
|
12
12
|
* is its header (checked by the caller with checkFloorHeader), and the block
|
|
13
13
|
* states that no ceiling in position exists, since order is the chain of
|
|
14
14
|
* proof hashes. /2 stays the format for Ethereum-floor proofs.
|
|
15
|
+
*
|
|
16
|
+
* /4 is for one member of a tree/1 BitGraph, over either floor: the same parts
|
|
17
|
+
* as /2 (an Ethereum floor) or /3 (a Base floor), plus the tree part a
|
|
18
|
+
* one-file export/1 carries (the root document and the member's evidence).
|
|
19
|
+
* The caller has checked the member against the proof (verifyTreeMember) and
|
|
20
|
+
* the committed bytes against the leaf; this only lays the parts out.
|
|
15
21
|
*/
|
|
16
22
|
|
|
17
|
-
import { CARRIER_VERSION_2, CARRIER_VERSION_3, encodeCarrierBlock, type CarrierPayload, type CarrierFloor, type CarrierBaseFloor, type CarrierCeiling, type CarrierCeilingInTime, type CarrierSettlement, type CarrierPins, type CarrierProof } from "./carrier.js";
|
|
23
|
+
import { CARRIER_VERSION_2, CARRIER_VERSION_3, CARRIER_VERSION_4, encodeCarrierBlock, type CarrierPayload, type CarrierFloor, type CarrierBaseFloor, type CarrierCeiling, type CarrierCeilingInTime, type CarrierSettlement, type CarrierPins, type CarrierProof, type CarrierTree } from "./carrier.js";
|
|
18
24
|
import { attestationWitness } from "./nitro.js";
|
|
19
25
|
import { computeProofHash, computeSignedBodyHash } from "./proof-hash.js";
|
|
20
26
|
import { BITGRAPH_CEILING_WRITER, BASE_MAINNET_CHAIN_ID } from "./carrier-verify.js";
|
|
@@ -47,6 +53,18 @@ export interface CarrierV3Parts extends Omit<CarrierV2Parts, "floor" | "ceiling"
|
|
|
47
53
|
floor: CarrierBaseFloor;
|
|
48
54
|
}
|
|
49
55
|
|
|
56
|
+
/**
|
|
57
|
+
* The parts of a /4 block: the floor the proof signs (an Ethereum anchor with
|
|
58
|
+
* its header, or a Base header), the ceiling in position for an Ethereum floor
|
|
59
|
+
* (ignored over a Base floor, where none exists and the block says so), and
|
|
60
|
+
* the tree member.
|
|
61
|
+
*/
|
|
62
|
+
export interface CarrierV4Parts extends Omit<CarrierV2Parts, "floor" | "ceiling"> {
|
|
63
|
+
floor: CarrierFloor | CarrierBaseFloor;
|
|
64
|
+
ceiling?: CarrierCeiling;
|
|
65
|
+
tree: CarrierTree;
|
|
66
|
+
}
|
|
67
|
+
|
|
50
68
|
export function assembleCarrierV2Payload(parts: CarrierV2Parts): CarrierPayload {
|
|
51
69
|
return assemble(CARRIER_VERSION_2, parts);
|
|
52
70
|
}
|
|
@@ -55,7 +73,14 @@ export function assembleCarrierV3Payload(parts: CarrierV3Parts): CarrierPayload
|
|
|
55
73
|
return assemble(CARRIER_VERSION_3, { ...parts, ceiling: { status: "none", basis: "hash-chain" } });
|
|
56
74
|
}
|
|
57
75
|
|
|
58
|
-
function
|
|
76
|
+
export function assembleCarrierV4Payload(parts: CarrierV4Parts): CarrierPayload {
|
|
77
|
+
const baseFloor = (parts.floor as { basis?: unknown }).basis === "base-header";
|
|
78
|
+
const ceiling: CarrierCeiling = baseFloor ? { status: "none", basis: "hash-chain" } : parts.ceiling ?? { status: "unfetched" };
|
|
79
|
+
const tree: CarrierTree = { rootDocument: parts.tree.rootDocument, member: { index: parts.tree.member.index, count: parts.tree.member.count, leaf: parts.tree.member.leaf, path: [...parts.tree.member.path] } };
|
|
80
|
+
return assemble(CARRIER_VERSION_4, { ...parts, ceiling }, tree);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function assemble(version: typeof CARRIER_VERSION_2 | typeof CARRIER_VERSION_3 | typeof CARRIER_VERSION_4, parts: Omit<CarrierV2Parts, "floor"> & { floor: CarrierFloor | CarrierBaseFloor }, tree?: CarrierTree): CarrierPayload {
|
|
59
84
|
const proof = parts.proof as unknown as BitGraphProof;
|
|
60
85
|
const att = proof.environment?.attestation;
|
|
61
86
|
const wantWitness = parts.withAttestationWitness ?? (att?.format === "aws-nitro" && typeof att.reportB64 === "string");
|
|
@@ -68,6 +93,7 @@ function assemble(version: typeof CARRIER_VERSION_2 | typeof CARRIER_VERSION_3,
|
|
|
68
93
|
const payload: CarrierPayload = {
|
|
69
94
|
carrier: version,
|
|
70
95
|
proof: parts.proof,
|
|
96
|
+
...(tree ? { tree } : {}),
|
|
71
97
|
floor: parts.floor,
|
|
72
98
|
ceiling: parts.ceiling,
|
|
73
99
|
ceilingInTime: parts.ceilingInTime,
|
package/src/carrier-verify.ts
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* verifyCarrier: the offline read path for a BitGraphed file (bitgraph-carrier/1,
|
|
5
|
-
* /2 or /
|
|
5
|
+
* /2, /3 or /4), one result per claim, each saying what it rests on.
|
|
6
6
|
*
|
|
7
7
|
* Given the file and nothing else, it strips the block by structure and checks:
|
|
8
8
|
*
|
|
9
|
-
* the bytes SHA-256 of the committed bytes is the digest the proof names
|
|
9
|
+
* the bytes SHA-256 of the committed bytes is the digest the proof names; on v4
|
|
10
|
+
* (one member of a tree/1 BitGraph) it is the leaf's artifact digest, a
|
|
11
|
+
* placed leaf's bytes carry the commitment, the path reaches the root, and
|
|
12
|
+
* the root document carries that root and the position's commitment and
|
|
13
|
+
* hashes to the signed digest (verifyTreeMember), under a spec it knows
|
|
10
14
|
* the proof Ed25519 signature, the position record and its bindings, the
|
|
11
15
|
* fused commitment rebuilt (bitgraph-fuse/1, /2 or /3), proofHash
|
|
12
16
|
* the attestation ES384 signature, the certificate chain to the AWS Nitro root
|
|
@@ -41,7 +45,8 @@
|
|
|
41
45
|
|
|
42
46
|
import { verify, verifyProofIntegrity, createVerificationContext } from "./verifier.js";
|
|
43
47
|
import { verifyFuse } from "./fuse-verify.js";
|
|
44
|
-
import { readFuseAttribution, signedFloorOf, type SignedFloor } from "./fuse.js";
|
|
48
|
+
import { readFuseAttribution, signedFloorOf, hexToBytes as treeHex, type SignedFloor } from "./fuse.js";
|
|
49
|
+
import { verifyTreeMember, TREE_MEMBER_CATEGORIES, type TreeVerifyResult } from "./tree.js";
|
|
45
50
|
import { computeProofHash, computeSignedBodyHash } from "./proof-hash.js";
|
|
46
51
|
import { verifyNitroAttestation, witnessMatchesAttestation, awsNitroRootSha256, type AttestationWitness } from "./nitro.js";
|
|
47
52
|
import { baseTimeIsBound, checkFloorHeader, floorTimeIsBound, verifyCeiling, checkCeilingOnline, type CeilingSidecar } from "./ceiling.js";
|
|
@@ -52,7 +57,7 @@ import type { BitGraphProof } from "./types.js";
|
|
|
52
57
|
import { sha256 } from "@noble/hashes/sha256";
|
|
53
58
|
import {
|
|
54
59
|
parseCarrier, checkFloorBinding, checkCeilingBinding, anchorMessageBytes,
|
|
55
|
-
verifyWitnessHeader, carrierBounds, innerDigestMatches, carrierVersionOf,
|
|
60
|
+
verifyWitnessHeader, carrierBounds, innerDigestMatches, carrierVersionOf, CARRIER_VERSION_4,
|
|
56
61
|
type CarrierBounds, type CarrierPayload,
|
|
57
62
|
} from "./carrier.js";
|
|
58
63
|
|
|
@@ -85,6 +90,8 @@ export interface CarrierVerifyOptions {
|
|
|
85
90
|
/** The one online question per chain, answered by nodes the caller names. Without them the confirmed level is UNDETERMINED. */
|
|
86
91
|
lookups?: CarrierLookups;
|
|
87
92
|
/** The verifier's own pins. The file's declared pins are compared with these, never used as these. */
|
|
93
|
+
/** v4: spec hashes (base64) to accept beside the ones this verifier knows (KNOWN_TREE_SPEC_HASHES). */
|
|
94
|
+
extraSpecHashes?: readonly string[];
|
|
88
95
|
pins?: {
|
|
89
96
|
/**
|
|
90
97
|
* PCR0 values the verifier accepts. Default: BitGraph's published images
|
|
@@ -108,7 +115,11 @@ export interface CarrierVerifyResult {
|
|
|
108
115
|
floorTimeWithheld?: string | null;
|
|
109
116
|
/** "ok" | "none" | "corrupt" — whether the bytes carried a readable block at all. */
|
|
110
117
|
carrier: "ok" | "none" | "corrupt";
|
|
111
|
-
version: 1 | 2 | 3 | null;
|
|
118
|
+
version: 1 | 2 | 3 | 4 | null;
|
|
119
|
+
/** v4: the leaf the committed bytes are, once its path reached the signed root; null otherwise (and on v1 to v3). */
|
|
120
|
+
member?: TreeVerifyResult["member"];
|
|
121
|
+
/** v4: "content" when the bytes carry the commitment (a placed leaf), "record" when kept as is; null when the bytes were not matched or not in hand. */
|
|
122
|
+
floorCovers?: TreeVerifyResult["floorCovers"];
|
|
112
123
|
/** Every failed or undetermined check, in the order met. Empty on a clean TRUE. */
|
|
113
124
|
reasons: string[];
|
|
114
125
|
/** Stated only when the block was readable. notAfter null = NOT FETCHED, in those words. */
|
|
@@ -135,7 +146,7 @@ export async function verifyCarrier(bytes: Uint8Array, opts: CarrierVerifyOption
|
|
|
135
146
|
return { verdict: "UNDETERMINED", carrier: "corrupt", version: null, reasons: [detail], bounds: null, ceiling: null, claims: [claim], reading: "The file ends in a proof block this reader cannot read. That is a damaged or newer block, not a verdict on the file.", payload: null, inner: null };
|
|
136
147
|
}
|
|
137
148
|
const result = await verifyCarrierPayload(parsed.payload, parsed.inner, opts);
|
|
138
|
-
return { ...result, reading: `${result.reading} ${envelopeSentence(bytes, parsed.inner)}` };
|
|
149
|
+
return { ...result, reading: `${result.reading} ${envelopeSentence(bytes, parsed.inner, parsed.payload.carrier === CARRIER_VERSION_4)}` };
|
|
139
150
|
}
|
|
140
151
|
|
|
141
152
|
/**
|
|
@@ -144,8 +155,9 @@ export async function verifyCarrier(bytes: Uint8Array, opts: CarrierVerifyOption
|
|
|
144
155
|
* that file travels without the README"). A reader who hashes the file they were handed
|
|
145
156
|
* and compares it with the proof would otherwise conclude the proof is wrong.
|
|
146
157
|
*/
|
|
147
|
-
function envelopeSentence(outer: Uint8Array, inner: Uint8Array): string {
|
|
158
|
+
function envelopeSentence(outer: Uint8Array, inner: Uint8Array, member = false): string {
|
|
148
159
|
const hex = (b: Uint8Array) => Array.from(sha256(b), (x) => x.toString(16).padStart(2, "0")).join("");
|
|
160
|
+
if (member) return `This file's own SHA-256 (${hex(outer)}) is not the committed digest and is not meant to be: the proof block at its end is part of this file's bytes. The proof names the tree's root document; the bytes before that block (SHA-256 ${hex(inner)}) are the tree member the block names, and those are the bytes checked here.`;
|
|
149
161
|
return `This file's own SHA-256 (${hex(outer)}) is not the committed digest and is not meant to be: the proof block at its end is part of this file's bytes. The proof names the bytes before that block (SHA-256 ${hex(inner)}), and those are the bytes checked here.`;
|
|
150
162
|
}
|
|
151
163
|
|
|
@@ -167,7 +179,7 @@ export async function verifyCarrierPayload(payload: CarrierPayload, inner: Uint8
|
|
|
167
179
|
} catch (e) {
|
|
168
180
|
const detail = `a part of this proof block is malformed: ${e instanceof Error ? e.message : String(e)}`;
|
|
169
181
|
add("wellformed", "Every part of the proof block is well formed", "FALSE", "", detail);
|
|
170
|
-
let version: 1 | 2 | 3 | null = null;
|
|
182
|
+
let version: 1 | 2 | 3 | 4 | null = null;
|
|
171
183
|
try { version = carrierVersionOf(payload); } catch { /* unreadable */ }
|
|
172
184
|
const ceilingStatus = (payload as { ceiling?: { status?: unknown } } | null)?.ceiling?.status;
|
|
173
185
|
return {
|
|
@@ -199,9 +211,13 @@ async function verifyCarrierPayloadChecks(
|
|
|
199
211
|
const baseChainId = opts.pins?.baseChainId ?? BASE_MAINNET_CHAIN_ID;
|
|
200
212
|
|
|
201
213
|
if (inner !== null) add("block", "A proof block at the end of the file", "TRUE", "the block's own structure", `bitgraph-carrier/${version}, found from the end of the file and stripped exactly once`);
|
|
214
|
+
const isMember = version === 4;
|
|
202
215
|
|
|
203
|
-
// 1. The committed bytes are the ones the proof names.
|
|
204
|
-
|
|
216
|
+
// 1. The committed bytes are the ones the proof names. On v4 they are a
|
|
217
|
+
// tree member's, checked against its leaf in step 3.
|
|
218
|
+
if (isMember) {
|
|
219
|
+
// below, with the tree
|
|
220
|
+
} else if (inner !== null) {
|
|
205
221
|
const digestOk = innerDigestMatches(inner, payload);
|
|
206
222
|
add("bytes.digest", "The committed bytes are the ones the proof names", digestOk ? "TRUE" : "FALSE", "SHA-256", digestOk ? "SHA-256 of the bytes before the block equals the proof's artifact digest" : "the committed bytes do not hash to the carried proof's artifact digest");
|
|
207
223
|
} else {
|
|
@@ -211,7 +227,9 @@ async function verifyCarrierPayloadChecks(
|
|
|
211
227
|
// 2. The proof itself, under the existing bitgraph/1 algorithm. A fresh
|
|
212
228
|
// context: a carrier is judged alone, not against this process's history.
|
|
213
229
|
// Without the bytes, the integrity half runs (verify() without bytes).
|
|
214
|
-
|
|
230
|
+
// On v4 the signed digest names the root document, never the bytes, so
|
|
231
|
+
// the integrity half runs and the tree binds the bytes (step 3).
|
|
232
|
+
const proofResult = inner !== null && !isMember
|
|
215
233
|
? await verify({ proof, bytes: inner, context: createVerificationContext() })
|
|
216
234
|
: await verifyProofIntegrity({ proof, context: createVerificationContext() });
|
|
217
235
|
add("proof.signature", "The proof is signed and its position record is bound to it", proofResult.valid ? "TRUE" : "FALSE", "Ed25519", proofResult.valid ? "the enclave's Ed25519 signature over the canonical signed body verifies; the position record's own signature, its hash in the commit, the nonce and the counter order all agree" : `the carried proof does not verify: ${proofResult.reason ?? "unspecified"}`);
|
|
@@ -223,8 +241,14 @@ async function verifyCarrierPayloadChecks(
|
|
|
223
241
|
}
|
|
224
242
|
|
|
225
243
|
// 3. Fused: the commitment inside the bytes, rebuilt from the signed record (fuse/2 and fuse/3: and the signed floor block).
|
|
244
|
+
// v4: the tree. The spec the proof pins, the root document against the
|
|
245
|
+
// signed digest and the position's commitment, the path, the bytes
|
|
246
|
+
// against the leaf, and for a placed leaf the commitment in the bytes.
|
|
226
247
|
const marker = readFuseAttribution(proof);
|
|
227
|
-
|
|
248
|
+
let tr: TreeVerifyResult | null = null;
|
|
249
|
+
if (isMember) {
|
|
250
|
+
tr = await memberClaims(payload, proof, inner, opts, add);
|
|
251
|
+
} else if (marker !== null && inner === null) {
|
|
228
252
|
add("proof.fused", "The bytes carry the position commitment", "NOT_CARRIED", "", `the file is not in hand; its bytes carry a bitgraph-fuse/${marker.version ?? 1} commitment to check`);
|
|
229
253
|
} else if (marker !== null && inner !== null) {
|
|
230
254
|
const f = await verifyFuse({ proof, bytes: inner });
|
|
@@ -450,7 +474,10 @@ async function verifyCarrierPayloadChecks(
|
|
|
450
474
|
// says only that some AWS Nitro enclave signed.
|
|
451
475
|
const pins = claims.find((c) => c.id === "attestation.pins");
|
|
452
476
|
if (reasons.length === 0 && pins?.result !== "TRUE") reasons.push(pins ? `${pins.name}: ${pins.detail}` : "The image is one the verifier accepts: the proof carries no attestation, so no image was established");
|
|
453
|
-
|
|
477
|
+
// v4: a tree this verifier could not judge (a spec it does not know) is not judged, never TRUE.
|
|
478
|
+
const treeUnjudged = isMember ? claims.filter((c) => TREE_CLAIM_IDS.includes(c.id) && c.result === "UNDETERMINED") : [];
|
|
479
|
+
if (reasons.length === 0) for (const c of treeUnjudged) reasons.push(`${c.name}: ${c.detail}`);
|
|
480
|
+
const verdict: CarrierVerifyResult["verdict"] = claims.some((c) => c.result === "FALSE") ? "FALSE" : pins?.result === "TRUE" && treeUnjudged.length === 0 ? "TRUE" : "UNDETERMINED";
|
|
454
481
|
const bounds = carrierBounds(payload);
|
|
455
482
|
// The ceiling in time reaches callers only as verified here, and only when its stamp is a bound.
|
|
456
483
|
bounds.existedBy = ceilingTime ? { chain: "base", blockNumber: ceilingTime.blockNumber, blockHash: ceilingTime.blockHash, timestamp: ceilingTime.blockTimestamp } : null;
|
|
@@ -466,12 +493,86 @@ async function verifyCarrierPayloadChecks(
|
|
|
466
493
|
bounds,
|
|
467
494
|
ceiling: payload.ceiling.status,
|
|
468
495
|
claims,
|
|
469
|
-
|
|
496
|
+
member: tr?.member ?? null,
|
|
497
|
+
floorCovers: tr && (TREE_MEMBER_CATEGORIES as readonly string[]).includes(tr.category) ? tr.floorCovers : null,
|
|
498
|
+
reading: writeReading(verdict, claims, bounds, proof, ceilingTime, bounds.notBefore.timestamp, baseTimeWithheld, floorTimeWithheld, tr),
|
|
470
499
|
payload,
|
|
471
500
|
inner,
|
|
472
501
|
};
|
|
473
502
|
}
|
|
474
503
|
|
|
504
|
+
/** The claims a v4 block adds in place of the digest and fused lines; their verdict weight is checked by id. */
|
|
505
|
+
const TREE_CLAIM_IDS: readonly string[] = ["spec.pin", "tree.root", "tree.member", "bytes.digest"];
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* v4: the bytes, as one member of the tree the proof commits. Five claims, in
|
|
509
|
+
* export/1's words: the spec pin, the root document, the member's path, the
|
|
510
|
+
* bytes against the leaf, and (as proof.fused, the content floor) the
|
|
511
|
+
* commitment inside a placed leaf's bytes. A leaf kept as is carries no
|
|
512
|
+
* commitment: recorded after the floor block, the bytes themselves are not
|
|
513
|
+
* dated. The bytes must be the leaf's COMMITTED bytes: an original that would
|
|
514
|
+
* rebuild them is not what a BitGraphed file carries, and is refused.
|
|
515
|
+
*/
|
|
516
|
+
async function memberClaims(
|
|
517
|
+
payload: CarrierPayload,
|
|
518
|
+
proof: BitGraphProof,
|
|
519
|
+
inner: Uint8Array | null,
|
|
520
|
+
opts: CarrierVerifyOptions,
|
|
521
|
+
add: (id: string, name: string, result: ClaimResult, restsOn: string, detail: string, level?: "offline" | "confirmed") => number,
|
|
522
|
+
): Promise<TreeVerifyResult> {
|
|
523
|
+
const t = payload.tree!;
|
|
524
|
+
const rootDocument = treeHex(t.rootDocument) ?? new Uint8Array(0);
|
|
525
|
+
// The proof's own check is its own claim (step 2); the tree is judged on its own evidence.
|
|
526
|
+
const tr = await verifyTreeMember({
|
|
527
|
+
proof,
|
|
528
|
+
...(inner !== null ? { bytes: inner } : {}),
|
|
529
|
+
member: t.member,
|
|
530
|
+
rootDocument,
|
|
531
|
+
...(opts.extraSpecHashes ? { extraSpecHashes: opts.extraSpecHashes } : {}),
|
|
532
|
+
proofAlreadyVerified: true,
|
|
533
|
+
});
|
|
534
|
+
const unknownSpec = tr.category === "UNKNOWN_SPEC";
|
|
535
|
+
const notTree = tr.category === "NOT_TREE";
|
|
536
|
+
const specOk = !unknownSpec && !notTree && tr.category !== "INVALID_TREE_MARKER";
|
|
537
|
+
add("spec.pin", "The proof pins a spec this verifier knows", specOk ? "TRUE" : unknownSpec ? "UNDETERMINED" : "FALSE", "the signed attribution.message",
|
|
538
|
+
specOk ? `SPEC.md SHA-256 ${tr.specHashB64}` : notTree ? `the carried proof is not a tree/1 proof (${tr.reason}); a ${CARRIER_VERSION_4} block carries one member of a tree` : unknownSpec ? `${tr.reason}; a verifier that knows that spec can judge the tree` : tr.reason);
|
|
539
|
+
const rootOk = tr.tree !== null;
|
|
540
|
+
add("tree.root", "The root document is the signed one and carries this position's commitment", rootOk ? "TRUE" : unknownSpec ? "UNDETERMINED" : "FALSE",
|
|
541
|
+
"SHA-256 over the signed position record, its nonce and the signed floor block hash",
|
|
542
|
+
rootOk ? `a tree of ${tr.tree!.count} leaves, root ${tr.tree!.rootHex.slice(0, 16)}…; SHA-256 of the root document is the proof's artifact digest` : unknownSpec ? "not judged: the proof follows a spec this verifier does not know" : tr.reason);
|
|
543
|
+
const pathOk = tr.member !== null;
|
|
544
|
+
add("tree.member", "The member's leaf is in the committed tree", pathOk ? "TRUE" : rootOk ? "FALSE" : "UNDETERMINED", "SHA-256 (RFC 9162 path)",
|
|
545
|
+
pathOk ? `leaf ${tr.member!.index} of ${tr.member!.count} (${tr.member!.placement === "as-is" ? "kept as is" : tr.member!.placement}); a path proves this leaf only, not the order of the others` : rootOk ? tr.reason : "not judged: the root it would reach is not established");
|
|
546
|
+
const where = tr.member ? `leaf ${tr.member.index} of ${tr.member.count}` : `leaf ${t.member.index} of ${t.member.count}`;
|
|
547
|
+
const asIs = tr.member?.placement === "as-is" || /^00/.test(t.member.leaf);
|
|
548
|
+
if (inner === null) {
|
|
549
|
+
add("bytes.digest", "The bytes are this member's committed bytes", "NOT_CARRIED", "", `the file is not in hand; the block names ${where}, SHA-256 ${t.member.leaf.slice(2, 66)}`);
|
|
550
|
+
add("proof.fused", "The committed bytes carry the position commitment", "NOT_CARRIED", "", asIs
|
|
551
|
+
? "the member was kept as is: the bytes carry no commitment, so the bytes themselves are not dated"
|
|
552
|
+
: "the file is not in hand; its bytes carry the position commitment to check");
|
|
553
|
+
return tr;
|
|
554
|
+
}
|
|
555
|
+
const isMember = (TREE_MEMBER_CATEGORIES as readonly string[]).includes(tr.category);
|
|
556
|
+
if (tr.category === "TREE_MEMBER_FROM_ORIGIN") {
|
|
557
|
+
add("bytes.digest", "The bytes are this member's committed bytes", "FALSE", "SHA-256",
|
|
558
|
+
`the bytes before the block are ${where}'s original, not its committed bytes: a BitGraphed file carries the bytes the leaf names, with the commitment placed in them`);
|
|
559
|
+
} else {
|
|
560
|
+
add("bytes.digest", "The bytes are this member's committed bytes", isMember ? "TRUE" : pathOk ? "FALSE" : "UNDETERMINED", "SHA-256",
|
|
561
|
+
isMember ? `SHA-256 of the bytes before the block is the artifact digest of ${where}` : pathOk ? `${tr.category}: ${tr.reason}` : "not judged: the member's place in the tree did not verify");
|
|
562
|
+
}
|
|
563
|
+
if (tr.category === "TREE_MEMBER_DIRECT") {
|
|
564
|
+
add("proof.fused", "The committed bytes carry the position commitment", "TRUE", "SHA-256 over the signed position record, its nonce and the signed floor block hash",
|
|
565
|
+
`${tr.member!.placement}: the commitment binds the floor block, so these bytes could not have been finished before that block existed; the original inside them is not dated by it`);
|
|
566
|
+
} else if (tr.category === "TREE_MEMBER_AS_IS" || asIs) {
|
|
567
|
+
add("proof.fused", "The committed bytes carry the position commitment", "NOT_CARRIED", "", "the member was kept as is: the bytes carry no commitment, so the bytes themselves are not dated (the record floor only)");
|
|
568
|
+
} else if (tr.category === "INVALID_SLOT_COMMITMENT" || tr.category === "INVALID_ORIGIN") {
|
|
569
|
+
add("proof.fused", "The committed bytes carry the position commitment", "FALSE", "", `${tr.category}: ${tr.reason}`);
|
|
570
|
+
} else {
|
|
571
|
+
add("proof.fused", "The committed bytes carry the position commitment", "NOT_CARRIED", "", "not reached: the bytes before the block are not this leaf's committed bytes");
|
|
572
|
+
}
|
|
573
|
+
return tr;
|
|
574
|
+
}
|
|
575
|
+
|
|
475
576
|
async function safe<T>(f: () => Promise<T>): Promise<T | null> {
|
|
476
577
|
try { return await f(); } catch { return null; }
|
|
477
578
|
}
|
|
@@ -493,6 +594,7 @@ function writeReading(
|
|
|
493
594
|
floorTs: number | null,
|
|
494
595
|
baseTimeWithheld: string | null = null,
|
|
495
596
|
floorTimeWithheld: string | null = null,
|
|
597
|
+
tr: TreeVerifyResult | null = null,
|
|
496
598
|
): string {
|
|
497
599
|
const get = (id: string) => claims.find((c) => c.id === id);
|
|
498
600
|
if (verdict === "FALSE") {
|
|
@@ -513,7 +615,15 @@ function writeReading(
|
|
|
513
615
|
// Two floors (SPEC 8.6): every record has the record floor; only bytes that
|
|
514
616
|
// carry the commitment have the content floor. Without it, the bytes
|
|
515
617
|
// themselves are not dated.
|
|
516
|
-
|
|
618
|
+
// v4: the same two floors, said of one member of the tree (SPEC 8.6, export/1's words).
|
|
619
|
+
const leafWords = tr?.member ? `leaf ${tr.member.index} of ${tr.member.count} in the committed tree` : null;
|
|
620
|
+
const subject = tr !== null
|
|
621
|
+
? digest?.result !== "TRUE"
|
|
622
|
+
? leafWords ? `The tree this proof names was committed under this position, and ${leafWords.replace(/ in the committed tree$/, "")} is in it.` : "The tree this proof names was committed under this position."
|
|
623
|
+
: fused?.result === "TRUE"
|
|
624
|
+
? `These exact bytes are ${leafWords} and carry the commitment, so they were finished after the floor block (the content floor); an original inside them is not dated by it.`
|
|
625
|
+
: `These exact bytes are ${leafWords}, kept as is: they carry no commitment, so the bytes themselves are not dated (the record floor only).`
|
|
626
|
+
: digest?.result !== "TRUE"
|
|
517
627
|
? "The bytes this proof names were committed under this position."
|
|
518
628
|
: fused?.result === "TRUE"
|
|
519
629
|
? (fused.restsOn.includes("floor block") ? "These exact bytes carry the commitment, so they were finished after the floor block (the content floor)." : "These exact bytes carry the commitment, so they were finished after their position was opened (the content floor).")
|
package/src/carrier.ts
CHANGED
|
@@ -52,6 +52,26 @@
|
|
|
52
52
|
* Everything else (ceiling in time, settlement, pins, attestation witness) is
|
|
53
53
|
* /2's. Ethereum-floor proofs keep travelling as /1 and /2.
|
|
54
54
|
*
|
|
55
|
+
* bitgraph-carrier/4 (2026-10-11) is the BitGraphed file of ONE MEMBER of a
|
|
56
|
+
* tree/1 BitGraph. In a tree the signed digest is the SHA-256 of the tree's
|
|
57
|
+
* 84-byte root document, not of any file, so the committed bytes before the
|
|
58
|
+
* block are a LEAF's committed bytes (the bytes whose SHA-256 is the leaf's
|
|
59
|
+
* artifact digest: the file itself for a leaf kept as is, the file with the
|
|
60
|
+
* commitment placed in it otherwise), and the block carries what reaches the
|
|
61
|
+
* signed digest from them, exactly the tree part a one-file export/1 carries:
|
|
62
|
+
* `tree: { rootDocument, member: { index, count, leaf, path } }`. A reader
|
|
63
|
+
* hashes the bytes before the block, requires that digest to be the leaf's
|
|
64
|
+
* artifact (and, for a placed leaf, the commitment to be inside the bytes),
|
|
65
|
+
* walks the path to the root, and requires the root document to hold that
|
|
66
|
+
* root and the position's commitment and to hash to the signed digest. The
|
|
67
|
+
* floor is the one the proof signs, in its own shape: an Ethereum anchor and
|
|
68
|
+
* header (as /2, with the ceiling in position unfetched or present) or a Base
|
|
69
|
+
* header (as /3, with no ceiling in position). Ceiling in time, settlement,
|
|
70
|
+
* pins and attestation witness are /2's. A new version and not a field added
|
|
71
|
+
* to /2 or /3, on purpose: a reader that knows only /1 to /3 would hash the
|
|
72
|
+
* bytes against the root document's digest and call a good file FALSE, so it
|
|
73
|
+
* must see a version it does not know and say UNDETERMINED instead.
|
|
74
|
+
*
|
|
55
75
|
* ⚠️ TWO BYTE-IDENTICAL COPIES OF THIS FILE EXIST, on purpose:
|
|
56
76
|
* packages/verify/src/carrier.ts (canonical, published with the package)
|
|
57
77
|
* website/src/lib/carrier.ts (the site cannot import unpublished code)
|
|
@@ -75,7 +95,8 @@ export const MAX_CARRIER_PAYLOAD = 8 * 1024 * 1024;
|
|
|
75
95
|
export const CARRIER_VERSION = "bitgraph-carrier/1";
|
|
76
96
|
export const CARRIER_VERSION_2 = "bitgraph-carrier/2";
|
|
77
97
|
export const CARRIER_VERSION_3 = "bitgraph-carrier/3";
|
|
78
|
-
export
|
|
98
|
+
export const CARRIER_VERSION_4 = "bitgraph-carrier/4";
|
|
99
|
+
export type CarrierVersion = typeof CARRIER_VERSION | typeof CARRIER_VERSION_2 | typeof CARRIER_VERSION_3 | typeof CARRIER_VERSION_4;
|
|
79
100
|
/** The sidecar and pointer formats a v2 block carries; their shapes are checked by their own modules. */
|
|
80
101
|
export const CEILING_SIDECAR_VERSION = "bitgraph-ceiling/1";
|
|
81
102
|
export const SETTLEMENT_POINTER_VERSION = "bitgraph-settlement/1";
|
|
@@ -136,6 +157,19 @@ export type CarrierSettlement =
|
|
|
136
157
|
| { status: "unfetched" }
|
|
137
158
|
| { status: "present"; pointer: Record<string, unknown> };
|
|
138
159
|
|
|
160
|
+
/**
|
|
161
|
+
* v4: the tree member the committed bytes are, in export/1's words: the
|
|
162
|
+
* tree's root document and the member's evidence, both lowercase hex. Bound
|
|
163
|
+
* to nothing until a verifier walks it: the leaf must be the bytes, the path
|
|
164
|
+
* must reach the root, the root document must hash to the signed digest.
|
|
165
|
+
*/
|
|
166
|
+
export interface CarrierTree {
|
|
167
|
+
/** The 84-byte root document (168 hex characters); its SHA-256 is the proof's artifact digest. */
|
|
168
|
+
rootDocument: string;
|
|
169
|
+
/** The member's evidence, exactly export/1's `tree.member`: the 65-byte leaf, its index, the tree's size and the sibling path from the leaf up. */
|
|
170
|
+
member: { index: number; count: number; leaf: string; path: string[] };
|
|
171
|
+
}
|
|
172
|
+
|
|
139
173
|
/** v2: what the file was made under. Declared only; a verifier compares with its own pins. */
|
|
140
174
|
export interface CarrierPins {
|
|
141
175
|
pcr0?: string;
|
|
@@ -148,17 +182,19 @@ export interface CarrierPayload {
|
|
|
148
182
|
carrier: CarrierVersion;
|
|
149
183
|
/** The bitgraph/1 proof exactly as the commit returned it. */
|
|
150
184
|
proof: CarrierProof;
|
|
151
|
-
/**
|
|
185
|
+
/** v4, required there: the tree member the committed bytes are. */
|
|
186
|
+
tree?: CarrierTree;
|
|
187
|
+
/** v1 and v2: the Ethereum anchor proof and its header. v3: the Base header. v4: whichever the proof signs. */
|
|
152
188
|
floor: CarrierFloor | CarrierBaseFloor;
|
|
153
|
-
/** The ceiling in position: the next anchor in the chain (v1, v2), or on
|
|
189
|
+
/** The ceiling in position: the next anchor in the chain (v1, v2, v4 on an Ethereum floor), or on a Base floor the statement that there is none. */
|
|
154
190
|
ceiling: CarrierCeiling;
|
|
155
|
-
/** v2 and
|
|
191
|
+
/** v2, v3 and v4. Required there, so absence reads as a corrupt block, never as "no ceiling". */
|
|
156
192
|
ceilingInTime?: CarrierCeilingInTime;
|
|
157
|
-
/** v2 and
|
|
193
|
+
/** v2, v3 and v4, optional. */
|
|
158
194
|
settlement?: CarrierSettlement;
|
|
159
|
-
/** v2 and
|
|
195
|
+
/** v2, v3 and v4, optional. */
|
|
160
196
|
pins?: CarrierPins;
|
|
161
|
-
/** v2 and
|
|
197
|
+
/** v2, v3 and v4, optional: the proof's attestation as aws-nitro-witness/1 evidence. */
|
|
162
198
|
attestation?: Record<string, unknown>;
|
|
163
199
|
}
|
|
164
200
|
|
|
@@ -252,24 +288,46 @@ export function buildCarrier(inner: Uint8Array, payload: CarrierPayload): Uint8A
|
|
|
252
288
|
return out;
|
|
253
289
|
}
|
|
254
290
|
|
|
291
|
+
/** v4: the tree part's shape (export/1's one-file tree), lowercase hex throughout. Whether it holds is verifyCarrier's question. */
|
|
292
|
+
function treeShapeError(t: unknown): string | null {
|
|
293
|
+
const o = record(t);
|
|
294
|
+
if (o === null) return `a ${CARRIER_VERSION_4} block carries its tree member: "tree" is missing`;
|
|
295
|
+
if (Object.keys(o).sort().join(",") !== "member,rootDocument") return "tree must hold exactly rootDocument and member";
|
|
296
|
+
if (typeof o["rootDocument"] !== "string" || !/^[0-9a-f]{168}$/.test(o["rootDocument"])) return "tree.rootDocument is not 84 bytes of lowercase hex";
|
|
297
|
+
const m = record(o["member"]);
|
|
298
|
+
if (m === null || Object.keys(m).sort().join(",") !== "count,index,leaf,path") return "tree.member must hold exactly index, count, leaf and path";
|
|
299
|
+
const { index, count } = m;
|
|
300
|
+
if (typeof count !== "number" || !Number.isInteger(count) || count < 1) return "tree.member.count is not a whole number of leaves";
|
|
301
|
+
if (typeof index !== "number" || !Number.isInteger(index) || index < 0 || index >= count) return "tree.member.index is not a leaf of the tree";
|
|
302
|
+
if (typeof m["leaf"] !== "string" || !/^[0-9a-f]{130}$/.test(m["leaf"])) return "tree.member.leaf is not 65 bytes of lowercase hex";
|
|
303
|
+
if (!Array.isArray(m["path"]) || !(m["path"] as unknown[]).every((n) => typeof n === "string" && /^[0-9a-f]{64}$/.test(n))) return "tree.member.path is not a list of 32-byte lowercase-hex nodes";
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
|
|
255
307
|
/** Structural payload check: is this object a readable bitgraph-carrier/1 payload? */
|
|
256
308
|
function payloadShapeError(p: unknown): string | null {
|
|
257
309
|
const o = record(p);
|
|
258
310
|
if (o === null) return "payload is not an object";
|
|
311
|
+
const v4 = o["carrier"] === CARRIER_VERSION_4;
|
|
259
312
|
const v3 = o["carrier"] === CARRIER_VERSION_3;
|
|
260
|
-
const v2 = o["carrier"] === CARRIER_VERSION_2 || v3;
|
|
313
|
+
const v2 = o["carrier"] === CARRIER_VERSION_2 || v3 || v4;
|
|
261
314
|
if (o["carrier"] !== CARRIER_VERSION && !v2) return `unknown carrier version ${JSON.stringify(o["carrier"])}`;
|
|
262
315
|
if (record(o["proof"]) === null) return "payload carries no proof object";
|
|
316
|
+
if (v4) {
|
|
317
|
+
const te = treeShapeError(o["tree"]);
|
|
318
|
+
if (te !== null) return te;
|
|
319
|
+
}
|
|
263
320
|
const floor = record(o["floor"]);
|
|
264
321
|
if (floor === null || floor["status"] !== "present") return "floor must be present: a floorless carrier is not a not-before";
|
|
265
322
|
const ceil = record(o["ceiling"]);
|
|
266
323
|
if (ceil === null) return "ceiling is missing: absence must be a stated fact, not a missing key";
|
|
267
|
-
|
|
268
|
-
|
|
324
|
+
// v3, and v4 over a Base floor: the floor is a Base header, and no ceiling in position exists.
|
|
325
|
+
const baseFloor = v3 || (v4 && floor["basis"] === "base-header");
|
|
326
|
+
if (baseFloor) {
|
|
269
327
|
if (floor["basis"] !== "base-header") return `a ${CARRIER_VERSION_3} floor must be a Base header (basis "base-header"), got ${JSON.stringify(floor["basis"])}`;
|
|
270
328
|
if (typeof floor["header"] !== "string" || baseHeaderFields(floor["header"]) === null) return "floor carries no readable Base block header";
|
|
271
|
-
if (floor["anchor"] !== undefined || floor["witness"] !== undefined) return `a ${
|
|
272
|
-
if (ceil["status"] !== "none" || ceil["basis"] !== "hash-chain") return `a ${
|
|
329
|
+
if (floor["anchor"] !== undefined || floor["witness"] !== undefined) return `a ${String(o["carrier"])} ${v4 ? "Base " : ""}floor carries no anchor proof`;
|
|
330
|
+
if (ceil["status"] !== "none" || ceil["basis"] !== "hash-chain") return `a ${String(o["carrier"])} block ${v4 ? "over a Base floor " : ""}states no ceiling in position ({ status: "none", basis: "hash-chain" })`;
|
|
273
331
|
} else {
|
|
274
332
|
if (floor["basis"] !== undefined) return `unknown floor basis ${JSON.stringify(floor["basis"])} on ${String(o["carrier"])}`;
|
|
275
333
|
if (record(floor["anchor"]) === null) return "floor carries no anchor proof";
|
|
@@ -278,7 +336,7 @@ function payloadShapeError(p: unknown): string | null {
|
|
|
278
336
|
return "floor carries no readable block-header witness";
|
|
279
337
|
}
|
|
280
338
|
}
|
|
281
|
-
if (!
|
|
339
|
+
if (!baseFloor && ceil["status"] !== "unfetched") {
|
|
282
340
|
if (ceil["status"] !== "present") return `ceiling status must be "unfetched" or "present", got ${JSON.stringify(ceil["status"])}`;
|
|
283
341
|
if (ceil["basis"] !== "counter-order") return `unknown ceiling basis ${JSON.stringify(ceil["basis"])}`;
|
|
284
342
|
if (record(ceil["anchor"]) === null) return "ceiling carries no anchor proof";
|
|
@@ -288,7 +346,7 @@ function payloadShapeError(p: unknown): string | null {
|
|
|
288
346
|
}
|
|
289
347
|
}
|
|
290
348
|
if (!v2) return null;
|
|
291
|
-
// v2 and
|
|
349
|
+
// v2, v3 and v4: the ceiling in time is stated either way; settlement, pins and the attestation witness are optional.
|
|
292
350
|
const ct = record(o["ceilingInTime"]);
|
|
293
351
|
if (ct === null) return "ceilingInTime is missing: a v2 block states the ceiling in time or that it was not fetched";
|
|
294
352
|
if (ct["status"] === "present") {
|
|
@@ -311,9 +369,9 @@ function payloadShapeError(p: unknown): string | null {
|
|
|
311
369
|
return null;
|
|
312
370
|
}
|
|
313
371
|
|
|
314
|
-
/** 1, 2 or
|
|
315
|
-
export function carrierVersionOf(payload: CarrierPayload): 1 | 2 | 3 {
|
|
316
|
-
return payload.carrier === CARRIER_VERSION_3 ? 3 : payload.carrier === CARRIER_VERSION_2 ? 2 : 1;
|
|
372
|
+
/** 1, 2, 3 or 4, from a parsed payload. */
|
|
373
|
+
export function carrierVersionOf(payload: CarrierPayload): 1 | 2 | 3 | 4 {
|
|
374
|
+
return payload.carrier === CARRIER_VERSION_4 ? 4 : payload.carrier === CARRIER_VERSION_3 ? 3 : payload.carrier === CARRIER_VERSION_2 ? 2 : 1;
|
|
317
375
|
}
|
|
318
376
|
|
|
319
377
|
export function parseCarrier(bytes: Uint8Array): CarrierParse {
|
|
@@ -350,7 +408,7 @@ export function completeCarrier(
|
|
|
350
408
|
const p = parseCarrier(bytes);
|
|
351
409
|
if (p.kind !== "carrier") return { changed: false, bytes, error: p.kind === "none" ? "not a carrier" : `corrupt block: ${p.reason}` };
|
|
352
410
|
const cur = p.payload.ceiling;
|
|
353
|
-
if (cur.status === "none") return { changed: false, bytes, error: `a ${CARRIER_VERSION_3} block has no ceiling in position: its order is the chain of proof hashes` };
|
|
411
|
+
if (cur.status === "none") return { changed: false, bytes, error: `${p.payload.carrier === CARRIER_VERSION_3 ? `a ${CARRIER_VERSION_3} block` : "a block over a Base floor"} has no ceiling in position: its order is the chain of proof hashes` };
|
|
354
412
|
if (cur.status === "present") {
|
|
355
413
|
if (ceiling === null) return { changed: false, bytes };
|
|
356
414
|
const a = record(record(cur.anchor)?.["commit"]);
|
|
@@ -695,8 +753,29 @@ export function carrierBounds(payload: CarrierPayload): CarrierBounds {
|
|
|
695
753
|
return { notBefore, notAfter, existedBy, settledBy };
|
|
696
754
|
}
|
|
697
755
|
|
|
698
|
-
/**
|
|
756
|
+
/**
|
|
757
|
+
* v4: the leaf's artifact digest, the SHA-256 the committed bytes must have,
|
|
758
|
+
* read from the carried leaf (bytes 1 to 33 of its 65). Null when the block
|
|
759
|
+
* carries no readable leaf. That the leaf is in the signed tree is
|
|
760
|
+
* verifyCarrier's check, not this one.
|
|
761
|
+
*/
|
|
762
|
+
export function memberArtifactDigest(payload: CarrierPayload): Uint8Array | null {
|
|
763
|
+
const leaf = payload.tree?.member?.leaf;
|
|
764
|
+
const raw = typeof leaf === "string" && /^[0-9a-f]{130}$/.test(leaf) ? hexToBytes(leaf) : null;
|
|
765
|
+
return raw === null ? null : raw.slice(1, 33);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* SHA-256 of the committed bytes, compared to the carried proof's artifact
|
|
770
|
+
* digest; on v4, to the carried leaf's artifact digest (a tree's signed digest
|
|
771
|
+
* names its root document, which no file is). A digest match only: the
|
|
772
|
+
* verifier does the rest.
|
|
773
|
+
*/
|
|
699
774
|
export function innerDigestMatches(inner: Uint8Array, payload: CarrierPayload): boolean {
|
|
775
|
+
if (payload.carrier === CARRIER_VERSION_4) {
|
|
776
|
+
const want = memberArtifactDigest(payload);
|
|
777
|
+
return want !== null && sameDigest(bytesToB64(sha256(inner)), bytesToB64(want));
|
|
778
|
+
}
|
|
700
779
|
const artifact = record(payload.proof["artifact"]);
|
|
701
780
|
return sameDigest(bytesToB64(sha256(inner)), artifact?.["digestB64"] as string);
|
|
702
781
|
}
|
package/src/index.ts
CHANGED
|
@@ -138,6 +138,12 @@ export type { CarrierBaseFloor } from "./carrier.js";
|
|
|
138
138
|
export { assembleCarrierV3Payload } from "./carrier-assemble.js";
|
|
139
139
|
export type { CarrierV3Parts } from "./carrier-assemble.js";
|
|
140
140
|
|
|
141
|
+
/* bitgraph-carrier/4 (2026-10-11): one member of a tree/1 BitGraph carries its own proof: the bytes are the leaf's, the block walks them to the signed root document. */
|
|
142
|
+
export { CARRIER_VERSION_4, memberArtifactDigest } from "./carrier.js";
|
|
143
|
+
export type { CarrierTree } from "./carrier.js";
|
|
144
|
+
export { assembleCarrierV4Payload } from "./carrier-assemble.js";
|
|
145
|
+
export type { CarrierV4Parts } from "./carrier-assemble.js";
|
|
146
|
+
|
|
141
147
|
/* AWS Nitro attestation: decode, verify (chain to the AWS root, validity at the document's instant), and the openssl-checkable witness. */
|
|
142
148
|
export {
|
|
143
149
|
AWS_NITRO_ROOT_CA_PEM, awsNitroRootDer, awsNitroRootSha256, decodeNitroAttestation, verifyNitroAttestation,
|