@mikeargento/bitgraph-verify 1.29.0 → 1.29.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 +33 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,30 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Offline, deterministic verification of [BitGraph](https://bitgraph.ing) proofs.
|
|
4
4
|
|
|
5
|
-
A BitGraph is made inside a hardware enclave in one atomic action: a fresh nonce from the hardware's random number generator takes one count
|
|
5
|
+
A BitGraph is made inside a hardware enclave in one atomic action: a fresh nonce from the hardware's random number generator takes one count, the content's SHA-256 takes the next, and both are signed together and attested by AWS Nitro. This package checks that proof offline. The inputs are the proof and the file. There is no network access, no account and no contact with BitGraph. Checking a BitGraph involves no blockchain.
|
|
6
6
|
|
|
7
|
-
Verification of BitGraph proofs is permissionless by design. This package is MIT-licensed so that anyone, including parties adverse to the proof's issuer, can verify a proof without asking permission, online or offline
|
|
7
|
+
Verification of BitGraph proofs is permissionless by design. This package is MIT-licensed so that anyone, including parties adverse to the proof's issuer, can verify a proof without asking permission, online or offline.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install @mikeargento/bitgraph-verify
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { verifyExport, parseExport } from "@mikeargento/bitgraph-verify";
|
|
17
|
-
|
|
18
|
-
const result = await verifyExport(exportJson, { bytes }); // or { source } to stream a file of any size
|
|
19
|
-
result.verdict; // TRUE, FALSE or UNDETERMINED
|
|
20
|
-
result.claims; // proof, attestation, spec pin, tree root, this file's leaf, floor, Base ceiling, Ethereum settlement
|
|
21
|
-
result.times; // floor, ceilingBase, ceilingEthereum: three time claims, never merged
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
The three time claims are kept apart. The floor is in time: the committed bytes were finished after floor block N, the Base block signed into the proof as `commit.slotFloor` (an Ethereum block, `commit.slotAnchor`, on proofs made before the switch; v12 proofs sign no floor). The ceiling on Base is in time: the record existed by Base block B, provisional until B is confirmed as Base's own. Settlement is Ethereum's record of that Base block through Base's output root (`bitgraph-output-root/1`). A pending section reads NOT_CARRIED, never FALSE. A part in a format this version does not know is UNDETERMINED. The spec hash a proof pins must be one this verifier knows: `KNOWN_TREE_SPEC_HASHES` holds SPEC.md version 1, `QazdIR0JYtHQwQuIISo7bvH1gxUvTS2cY+tW6BjUIRs=`, frozen 2026-10-04 and never changed; a later version is added beside it.
|
|
25
|
-
|
|
26
|
-
`verifyTreeMember` checks one leaf and path against a tree/1 proof. `verifyCarrier` judges a BitGraphed file, a file that carries its own proof: carrier/2 and /3 for a single-file position, carrier/4 for one member of a tree/1 BitGraph (its bytes walked to the signed root document through the member's leaf and path). `verifyCeiling` checks a ceiling in time, `verifyOutputRootSettlement` its settlement, `verifyNitroAttestation` the attestation to the AWS Nitro root. `PUBLISHED_PCR0S` is the default measurement policy: a proof from any other enclave image is not a BitGraph.
|
|
27
|
-
|
|
28
|
-
A bare bitgraph/1 proof is checked against its bytes with `verifyAttested`. This is the check to rely on:
|
|
13
|
+
## The check to rely on
|
|
29
14
|
|
|
30
15
|
```ts
|
|
31
16
|
import { verifyAttested } from "@mikeargento/bitgraph-verify";
|
|
@@ -34,17 +19,27 @@ const r = await verifyAttested({ proof, bytes }); // bytes optional; pcr0: [..
|
|
|
34
19
|
if (r.valid) {
|
|
35
20
|
// the bytes match the digest; the Ed25519 signature, the nonce's record and the two consecutive counts hold;
|
|
36
21
|
// the AWS Nitro attestation verifies to the AWS root, at its own signed time, over this exact signed body;
|
|
37
|
-
// and the image it attests (r.pcr0, r.image) is one BitGraph published. r.attestedAtMs is
|
|
22
|
+
// and the image it attests (r.pcr0, r.image) is one BitGraph published. r.attestedAtMs is the attested time.
|
|
38
23
|
} else {
|
|
39
24
|
console.error(r.reason);
|
|
40
25
|
}
|
|
41
26
|
```
|
|
42
27
|
|
|
43
|
-
`
|
|
28
|
+
`verifyAttested` is the full check: the file's hash, the signature, the position record, the two counts, and the AWS Nitro attestation, pinned to an enclave image. `PUBLISHED_PCR0S` is the default policy: the images BitGraph has published, each accepted for proofs the hardware dated no later than seven days after the next image went live. Pass `pcr0` to accept only images you have rebuilt and measured yourself. Attestation certificates are evaluated at the attestation document's own signed time, never at the reader's clock, so a proof does not expire.
|
|
29
|
+
|
|
30
|
+
Without `bytes` the proof is checked on its own, and the result says nothing about any file.
|
|
31
|
+
|
|
32
|
+
## Trees
|
|
44
33
|
|
|
45
|
-
|
|
34
|
+
Many files can be bound as one BitGraph: an RFC 6962 Merkle tree over the files' SHA-256s, with the root's text (`merkle-root.txt`) bound as an ordinary proof. Each file of a tree has a proof of its own: the tree's proof with a `bitgraph-tree-member/1` block (its index, the path to the root, the root's text) in the unsigned metadata. `verifyAttested({ proof, bytes })` walks the file's hash up that path to the root the proof binds before it checks the proof, and reports `treeMember: { index, files }`. `checkTreeMember` does the walk alone.
|
|
46
35
|
|
|
47
|
-
|
|
36
|
+
## A run of proofs
|
|
37
|
+
|
|
38
|
+
Each proof carries the hash of the one before it in `commit.prevB64`. `verifyAttested` checks that field's form, never its value, because it holds one proof. `verifyStretch(proofs)` checks a run of consecutive proofs you hold: the links and the counts, with no gap. `verifyBetween(stretch, record)` checks that a record sits strictly between the first and last proof of an unbroken run. Both check the run's shape; check each proof in it with `verifyAttested` as well.
|
|
39
|
+
|
|
40
|
+
## The lower layer
|
|
41
|
+
|
|
42
|
+
`verify({ proof, bytes })` checks structure, the Ed25519 signature, the position record, the counts and the digest. It checks the signature against the key **the proof itself carries**, and does not open the attestation, so on its own it cannot tell BitGraph's enclave from anyone who made a key and signed a body. Use it only beneath `verifyAttested`, or with your own `allowedPublicKeys`.
|
|
48
43
|
|
|
49
44
|
Verification is a function of its inputs. The single-successor (fork) history is the one piece of state it keeps, and only a proof that passed every check records anything in it. Pass a context of your own to keep one run's history separate:
|
|
50
45
|
|
|
@@ -55,11 +50,24 @@ const context = createVerificationContext();
|
|
|
55
50
|
await verify({ proof, bytes, context });
|
|
56
51
|
```
|
|
57
52
|
|
|
58
|
-
|
|
53
|
+
`verifyNitroAttestation` checks an attestation to the AWS Nitro root on its own.
|
|
54
|
+
|
|
55
|
+
## What a valid result does not assert
|
|
56
|
+
|
|
57
|
+
- When or how the content was made. The result says where the digest was bound and the time the hardware attested.
|
|
58
|
+
- Who made the content, or that it is true.
|
|
59
|
+
- That the proof is in BitGraph's ledger.
|
|
60
|
+
- That the predecessor named by `commit.prevB64` is the proof you think it is, unless you hold the run and check it with `verifyStretch`.
|
|
61
|
+
|
|
62
|
+
## Formats
|
|
63
|
+
|
|
64
|
+
The proof schema (`bitgraph/1`), the canonical serialization and the proof hash live here, so independent implementations can be checked against this one. In the signed fields the position record is named `slotAllocation`.
|
|
65
|
+
|
|
66
|
+
Proofs and files in earlier formats keep verifying, each through its own function: `verifyExport` for a `bitgraph-export/1` file with the file it is about, `verifyTreeMember` for a tree/1 member, `verifyCarrier` for a BitGraphed file (a file that carries its proof inside), and `verifyCeiling`, `verifyOutputRootSettlement` and `verifyTimelineBundle` for the Base and Ethereum block evidence some of those proofs carry. `spec/SPEC.md` and `spec/SPEC-v2.md` in the repository are the texts tree/1 proofs pin; both are frozen.
|
|
59
67
|
|
|
60
|
-
See [bitgraph.ing/tools](https://bitgraph.ing/tools) for the verification checklist and attestation handling, and [CHANGELOG.md](./CHANGELOG.md) for
|
|
68
|
+
See [bitgraph.ing/tools](https://bitgraph.ing/tools) for the verification checklist and attestation handling, and [CHANGELOG.md](./CHANGELOG.md) for each release.
|
|
61
69
|
|
|
62
|
-
Making a BitGraph is separate and proprietary: [`@mikeargento/bitgraph-sdk`](https://www.npmjs.com/package/@mikeargento/bitgraph-sdk) for software,
|
|
70
|
+
Making a BitGraph is separate and proprietary: [`@mikeargento/bitgraph-sdk`](https://www.npmjs.com/package/@mikeargento/bitgraph-sdk) for software, [`@mikeargento/bitgraph-mcp`](https://www.npmjs.com/package/@mikeargento/bitgraph-mcp) for AI agents.
|
|
63
71
|
|
|
64
72
|
## License
|
|
65
73
|
|
package/package.json
CHANGED