@sanning/proof 0.13.0 → 0.14.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/case-file.js +6 -2
- package/dist/case.d.ts +51 -7
- package/dist/case.js +81 -16
- package/dist/cli.d.ts +31 -8
- package/dist/cli.js +256 -25
- package/dist/compose.js +6 -1
- package/dist/evidence.d.ts +36 -0
- package/dist/evidence.js +104 -3
- package/dist/file-match.d.ts +105 -0
- package/dist/file-match.js +374 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +9 -2
- package/dist/message-parts.d.ts +12 -6
- package/dist/message-parts.js +18 -10
- package/dist/verifier.d.ts +54 -2
- package/dist/verifier.js +195 -3
- package/dist/witness-cache.d.ts +85 -0
- package/dist/witness-cache.js +264 -0
- package/package.json +1 -1
- package/src/case-file.ts +5 -2
- package/src/case.ts +101 -15
- package/src/cli.ts +297 -27
- package/src/compose.ts +8 -1
- package/src/evidence.ts +115 -2
- package/src/file-match.ts +461 -0
- package/src/index.ts +43 -0
- package/src/message-parts.ts +18 -10
- package/src/verifier.ts +190 -3
- package/src/witness-cache.ts +306 -0
- package/vectors/README.md +43 -3
- package/vectors/file-match.json +1808 -0
- package/vectors/jcs-reader.json +82 -3
- package/vectors/stamp-on-chain.json +18 -3
- package/vectors/witness-cache.json +1304 -0
package/vectors/README.md
CHANGED
|
@@ -26,12 +26,33 @@ on a run that contacted none — a false accusation manufactured by a missing
|
|
|
26
26
|
state, and the defect this table was written after. Vendoring rules are the same
|
|
27
27
|
three steps as below, against `vectors/stamp-on-chain.json`.
|
|
28
28
|
|
|
29
|
+
## `witness-cache.json`
|
|
30
|
+
|
|
31
|
+
The rule that decides what a reader does with the witnessed-time cache, the
|
|
32
|
+
unsigned `witness-cache.json` beside a pack's `bundle.json` (`evidence-bundle.md`
|
|
33
|
+
§5.5.6 and §5.6.6, v1.25, A30). Implemented by [`../src/witness-cache.ts`](../src/witness-cache.ts)
|
|
34
|
+
and the `case` command in [`../src/cli.ts`](../src/cli.ts), and asserted against
|
|
35
|
+
this table by
|
|
36
|
+
[`../test/witness-cache-vectors.test.ts`](../test/witness-cache-vectors.test.ts)
|
|
37
|
+
**and by the Python kernel against the same bytes**, in
|
|
38
|
+
`tests/test_witness_cache_vectors.py`. Every expectation is written by hand in
|
|
39
|
+
`tools/gen-vectors/gen_witness_cache_table.py`, which writes this file.
|
|
40
|
+
|
|
41
|
+
**The one thing a consumer must not do with it: print a cached time as
|
|
42
|
+
anything but not checked.** Nobody signs the file, and anyone holding the pack
|
|
43
|
+
can write it. The only time a surface may print as the public record's is one a
|
|
44
|
+
gateway returned; a cached time the record contradicts is a finding, and one no
|
|
45
|
+
lookup settled stays labelled not checked.
|
|
46
|
+
|
|
29
47
|
## `jcs-reader.json`
|
|
30
48
|
|
|
31
49
|
The rule that decides how a kernel reads bytes that claim to be `JCS(value)`
|
|
32
|
-
(RFC 8785).
|
|
33
|
-
**strict UTF-8**, **no leading byte-order mark**, **no non-finite literal**,
|
|
34
|
-
**no
|
|
50
|
+
(RFC 8785). Five checks, none of them left to a built-in decoder's defaults:
|
|
51
|
+
**strict UTF-8**, **no leading byte-order mark**, **no non-finite literal**,
|
|
52
|
+
**no object that names one member twice** (I-JSON, RFC 7493; rule version 3,
|
|
53
|
+
proof#144), and **no unpaired surrogate in the parsed value**. A duplicate is
|
|
54
|
+
refused with the same message in both kernels, `duplicate key "<name>"`, and a
|
|
55
|
+
case that carries `error` pins that exact string. The fourth is not the first one
|
|
35
56
|
twice: a surrogate written as the ASCII escape `\ud800` survives every
|
|
36
57
|
byte-level check, because the bytes are ASCII, and the parser produces the
|
|
37
58
|
malformed code unit afterwards (proof#154).
|
|
@@ -135,6 +156,25 @@ whoever assembled the drop. Written by
|
|
|
135
156
|
`tools/gen-vectors/gen_case_file_index_vectors.py`, whose expectations are
|
|
136
157
|
literals.
|
|
137
158
|
|
|
159
|
+
## `file-match.json`
|
|
160
|
+
|
|
161
|
+
How a reader matches files handed in beside a pack against the commitments its
|
|
162
|
+
signed records make (`evidence-bundle.md` §5.7, v1.24 A29, proof#92). One pure
|
|
163
|
+
reading in both kernels, `matchFiles` and `matchCaseFiles` in
|
|
164
|
+
[`../src/file-match.ts`](../src/file-match.ts) and `match_files` and
|
|
165
|
+
`match_case_files` in `src/sanning_proof/file_match.py`, asserted against this
|
|
166
|
+
table by [`../test/file-match.test.ts`](../test/file-match.test.ts) **and by the
|
|
167
|
+
Python kernel against the same bytes**, in `tests/test_file_match.py`. `packs`
|
|
168
|
+
holds real signed packs, keyed by name, with any side content beside them as
|
|
169
|
+
`content_hex`; each row names the packs it reads (one for `mode: pack`, several
|
|
170
|
+
for `mode: case`), the files it offers as names and bytes, and the reading it
|
|
171
|
+
expects, with each `not_read` entry's rendered line left out. **A file is
|
|
172
|
+
matched by its SHA-256 and by nothing else**, and **no match moves a verdict**:
|
|
173
|
+
a surface that matched by name, or took a hash from a field no record's key
|
|
174
|
+
signed, would vouch for a file the pack never committed to. Written by
|
|
175
|
+
`tools/gen-vectors/gen_file_match_vectors.py`, whose expectations are written
|
|
176
|
+
by hand from what it built.
|
|
177
|
+
|
|
138
178
|
## `case-split.json`
|
|
139
179
|
|
|
140
180
|
How `case` turns the folders it was handed into packs: the verify page's
|