brainchain-verify 0.3.1 → 0.3.2
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/cli.js +1 -1
- package/dist/verify.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ Verdict: match. The published record is exactly what the chain recorded, and the
|
|
|
52
52
|
Not checked: that Jev produced the answer. See https://docs.usebrainchain.com/trust-model
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Each line is one check. `ok` passed and `FAIL` means the record and the chain disagree. `skip` is a check that could not run, with the reason on the line. `ERROR` means the record host did not answer after three tries,
|
|
55
|
+
Each line is one check. `ok` passed and `FAIL` means the record and the chain disagree. `skip` is a check that could not run, with the reason on the line. `ERROR` means the record could not be fetched, so the checks that need it did not run: the host did not answer after three tries, or it no longer has the record.
|
|
56
56
|
|
|
57
57
|
## What it checks
|
|
58
58
|
|
package/dist/cli.js
CHANGED
|
@@ -90,7 +90,7 @@ function verdict(failed, errors, skipped, many) {
|
|
|
90
90
|
if (failed > 0)
|
|
91
91
|
return `Verdict: MISMATCH. ${failed} check${failed === 1 ? "" : "s"} failed; see the FAIL lines.`;
|
|
92
92
|
if (errors > 0)
|
|
93
|
-
return "Verdict: UNVERIFIED. A record could not be fetched, so its checks did not run; see the ERROR lines
|
|
93
|
+
return "Verdict: UNVERIFIED. A record could not be fetched, so its checks did not run; see the ERROR lines.";
|
|
94
94
|
if (skipped > 0)
|
|
95
95
|
return "Verdict: match. Every check that could run passed; the skip lines say what could not be checked.";
|
|
96
96
|
return many
|
package/dist/verify.js
CHANGED
|
@@ -140,6 +140,8 @@ async function fetchBytes(uri) {
|
|
|
140
140
|
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
141
141
|
throw new Error(`${url.protocol} URIs are not supported`);
|
|
142
142
|
const response = await get(url);
|
|
143
|
+
if (response.status === 404)
|
|
144
|
+
throw new Error(`${display(uri)} answered with status 404: the host no longer has this record, so trying again will not help`);
|
|
143
145
|
if (!response.ok)
|
|
144
146
|
throw new Error(`${display(uri)} answered with status ${response.status}`);
|
|
145
147
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainchain-verify",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Check a BrainChain decision against the chain: the published record, its hashes, its confidence and the thresholds the contracts applied.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "BrainChain",
|