@sanning/proof 0.19.1 → 0.20.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 +30 -29
- package/dist/agent-record.d.ts +62 -0
- package/dist/agent-record.js +527 -0
- package/dist/agent-schemas.generated.d.ts +15 -0
- package/dist/agent-schemas.generated.js +5759 -0
- package/dist/case-file.d.ts +32 -89
- package/dist/case-file.js +41 -93
- package/dist/case.d.ts +339 -822
- package/dist/case.js +667 -1160
- package/dist/chain.d.ts +19 -47
- package/dist/chain.js +78 -205
- package/dist/claims.d.ts +211 -0
- package/dist/claims.js +1081 -0
- package/dist/cli.d.ts +45 -68
- package/dist/cli.js +618 -1022
- package/dist/compose.js +23 -65
- package/dist/crypto.d.ts +7 -8
- package/dist/crypto.js +60 -147
- package/dist/declaration.d.ts +68 -194
- package/dist/declaration.js +175 -518
- package/dist/environment.d.ts +9 -30
- package/dist/environment.js +17 -66
- package/dist/evidence.d.ts +119 -160
- package/dist/evidence.js +744 -1103
- package/dist/exit-codes.d.ts +11 -27
- package/dist/exit-codes.js +24 -59
- package/dist/file-match.d.ts +33 -79
- package/dist/file-match.js +33 -69
- package/dist/grading.d.ts +98 -135
- package/dist/grading.js +224 -380
- package/dist/handoff.d.ts +62 -160
- package/dist/handoff.js +153 -393
- package/dist/index.d.ts +14 -10
- package/dist/index.js +60 -167
- package/dist/json-schema.d.ts +29 -0
- package/dist/json-schema.js +298 -0
- package/dist/merkle.js +16 -28
- package/dist/message-parts.d.ts +56 -212
- package/dist/message-parts.js +142 -502
- package/dist/side-content.d.ts +11 -22
- package/dist/side-content.js +22 -65
- package/dist/types.d.ts +17 -0
- package/dist/types.js +19 -5
- package/dist/verifier.d.ts +40 -114
- package/dist/verifier.js +196 -535
- package/dist/witness-cache.d.ts +24 -45
- package/dist/witness-cache.js +38 -81
- package/dist/witness-lookup.d.ts +36 -57
- package/dist/witness-lookup.js +89 -139
- package/dist/zip-reader.d.ts +18 -33
- package/dist/zip-reader.js +19 -34
- package/package.json +11 -3
- package/src/agent-record.ts +608 -0
- package/src/agent-schemas.generated.ts +5764 -0
- package/src/case-file.ts +45 -109
- package/src/case.ts +814 -1328
- package/src/chain.ts +85 -224
- package/src/claims.ts +1253 -0
- package/src/cli.ts +714 -1176
- package/src/compose.ts +33 -79
- package/src/crypto.ts +60 -147
- package/src/declaration.ts +219 -656
- package/src/environment.ts +17 -65
- package/src/evidence.ts +958 -1381
- package/src/exit-codes.ts +24 -63
- package/src/file-match.ts +40 -89
- package/src/grading.ts +287 -421
- package/src/handoff.ts +175 -427
- package/src/index.ts +131 -177
- package/src/json-schema.ts +295 -0
- package/src/merkle.ts +16 -28
- package/src/message-parts.ts +155 -533
- package/src/side-content.ts +25 -68
- package/src/types.ts +55 -36
- package/src/verifier.ts +202 -526
- package/src/witness-cache.ts +45 -94
- package/src/witness-lookup.ts +107 -177
- package/src/zip-reader.ts +20 -38
- package/vectors/README.md +52 -34
- package/vectors/agent-record.json +2175 -0
- package/vectors/case-file-index.json +1 -1
- package/vectors/case-split.json +2 -2
- package/vectors/chain-reading.json +3 -3
- package/vectors/file-match.json +285 -148
- package/vectors/jcs-reader.json +6 -6
- package/vectors/pack-grading.json +102 -25
- package/vectors/sandbox-evidence.json +573 -581
- package/vectors/stamp-on-chain.json +18 -18
- package/vectors/witness-cache.json +49 -49
- package/dist/agent-proof.d.ts +0 -28
- package/dist/agent-proof.js +0 -226
- package/dist/run-adapters.d.ts +0 -10
- package/dist/run-adapters.js +0 -35
- package/dist/run.d.ts +0 -209
- package/dist/run.js +0 -1405
- package/src/agent-proof.ts +0 -264
- package/src/run-adapters.ts +0 -44
- package/src/run.ts +0 -1598
package/dist/cli.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ interface Cli {
|
|
|
6
6
|
err: (s: string) => void;
|
|
7
7
|
fetchImpl?: typeof fetch;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
/**
|
|
10
|
+
* Each control character in `text` as a visible escape (`\x1b`, ``).
|
|
11
|
+
* Every other character, a backslash included, is unchanged.
|
|
12
|
+
*/
|
|
12
13
|
export declare function escapeControl(text: string): string;
|
|
13
14
|
export declare function runCli(argv: string[], stream: Cli): Promise<number>;
|
|
14
15
|
export declare const MAX_FOLDER_BYTES: number;
|
|
@@ -48,7 +49,7 @@ export declare const MAX_WALK_ENTRIES = 50000;
|
|
|
48
49
|
export declare const MAX_JSON_DEPTH = 512;
|
|
49
50
|
/**
|
|
50
51
|
* The input could not be read as a case. The message is the whole report,
|
|
51
|
-
* identical in both kernels, and the command exits
|
|
52
|
+
* identical in both kernels, and the command exits 4 on it. `hint` is an
|
|
52
53
|
* optional second line naming a way through.
|
|
53
54
|
*/
|
|
54
55
|
export declare class CaseInputError extends Error {
|
|
@@ -64,11 +65,10 @@ export declare class CaseInputError extends Error {
|
|
|
64
65
|
export declare class WholeReadRefused extends CaseInputError {
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
|
-
* `bundle.json` bytes
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* (`duplicate key "<name>"`, proof#144), so both commands print it.
|
|
68
|
+
* `bundle.json` bytes `readBundleBytes` will not read. `tooDeep` marks the one
|
|
69
|
+
* refusal that is not a parse error. `detail` is the parser's words, which
|
|
70
|
+
* differ by kernel, so only `verify` prints it; `duplicate` marks the one
|
|
71
|
+
* `detail` both kernels word identically.
|
|
72
72
|
*/
|
|
73
73
|
export declare class BundleReadError extends Error {
|
|
74
74
|
readonly tooDeep: boolean;
|
|
@@ -78,12 +78,12 @@ export declare class BundleReadError extends Error {
|
|
|
78
78
|
}
|
|
79
79
|
export declare const NOT_I_JSON = "is not I-JSON (RFC 7493)";
|
|
80
80
|
/**
|
|
81
|
-
* How
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
81
|
+
* How `verify` and `case` turn `bundle.json` bytes into JSON, in both kernels:
|
|
82
|
+
* UTF-8 with ill-formed sequences as U+FFFD and a BOM kept; nesting past
|
|
83
|
+
* MAX_JSON_DEPTH refused before parsing; then `JSON.parse`, refusing a repeated
|
|
84
|
+
* member name.
|
|
85
|
+
*
|
|
86
|
+
* @throws BundleReadError
|
|
87
87
|
*/
|
|
88
88
|
export declare function readBundleBytes(bytes: Uint8Array): unknown;
|
|
89
89
|
export interface SplitPack {
|
|
@@ -91,16 +91,15 @@ export interface SplitPack {
|
|
|
91
91
|
bundlePath: string;
|
|
92
92
|
bundleBytes: Uint8Array;
|
|
93
93
|
/**
|
|
94
|
-
* `logs/<event_id>.json` bytes by event id. A `Map
|
|
95
|
-
*
|
|
96
|
-
* replaces the prototype instead of storing the disclosure.
|
|
94
|
+
* `logs/<event_id>.json` bytes by event id. A `Map`, because an event id is
|
|
95
|
+
* written by the audited party and `obj["__proto__"]` would not store it.
|
|
97
96
|
*/
|
|
98
97
|
content: Map<string, Uint8Array>;
|
|
99
98
|
unaccounted: string[];
|
|
100
99
|
}
|
|
101
100
|
export interface SplitCase {
|
|
102
101
|
packs: SplitPack[];
|
|
103
|
-
/** Paths that belong to no pack, sorted. Never read as part of a pack; a regular one is hashed
|
|
102
|
+
/** Paths that belong to no pack, sorted. Never read as part of a pack; a regular one is hashed. */
|
|
104
103
|
outside: string[];
|
|
105
104
|
/** The part of `outside` that is not a regular file. Never followed, never opened. */
|
|
106
105
|
notRegular: string[];
|
|
@@ -116,47 +115,35 @@ export interface TreeEntry {
|
|
|
116
115
|
regular: boolean;
|
|
117
116
|
/** The bytes of an entry read out of a case-file `.zip`. */
|
|
118
117
|
data?: Uint8Array | null;
|
|
119
|
-
/**
|
|
120
|
-
* `true` for a symbolic link, on disk or an entry of a `.zip`: the one reason
|
|
121
|
-
* a link is skipped under, here and under `--files`.
|
|
122
|
-
*/
|
|
118
|
+
/** `true` for a symbolic link, on disk or in a `.zip`. */
|
|
123
119
|
link?: boolean;
|
|
124
120
|
/** The `.zip` reader's own words for an entry it refused (not a link). */
|
|
125
121
|
refused?: string;
|
|
126
122
|
}
|
|
127
123
|
/**
|
|
128
|
-
* The page's `splitCase`
|
|
129
|
-
*
|
|
130
|
-
* nothing else.
|
|
124
|
+
* The page's `splitCase` then `assemble` per pack, over the walk's tree. `read`
|
|
125
|
+
* is called only for the files a pack owns.
|
|
131
126
|
*/
|
|
132
127
|
export declare function splitCase(tree: Map<string, TreeEntry>, read: (entry: TreeEntry, key: string) => Promise<Uint8Array>): Promise<SplitCase>;
|
|
133
128
|
/**
|
|
134
129
|
* The bytes of the `witness-cache.json` beside a pack's `bundle.json`
|
|
135
|
-
* (evidence-bundle 5.6.6
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* outside files (A41). It is read as a cache only where it is a regular file the split left outside every pack, so a file under another
|
|
140
|
-
* pack's `logs/` is that pack's, and a link is never followed. A file that
|
|
141
|
-
* cannot be read is no cache, never a refusal of the drop. One the run's
|
|
142
|
-
* whole-read total has no room for is pushed onto `refused` when it is given,
|
|
143
|
-
* so the output says so.
|
|
130
|
+
* (evidence-bundle.md §5.6.6), or `null`. Read only where it is a regular file
|
|
131
|
+
* the split left outside every pack, and it stays outside. An unreadable file
|
|
132
|
+
* is no cache, never a refusal; one the whole-read total has no room for is
|
|
133
|
+
* pushed onto `refused` when given.
|
|
144
134
|
*/
|
|
145
135
|
export declare function witnessCacheBytes(tree: Map<string, TreeEntry>, split: SplitCase, pack: SplitPack, budget?: {
|
|
146
136
|
n: number;
|
|
147
137
|
}, refused?: string[]): Promise<Uint8Array | null>;
|
|
148
|
-
/** `verify`'s reader, with the refusal named by the pack's path. */
|
|
149
|
-
export declare function loadBundle(pack: SplitPack): unknown;
|
|
150
138
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
139
|
+
* `verify`'s reader over one pack's `bundle.json`: the bundle, or an empty object and why
|
|
140
|
+
* it could not be read. One pack that cannot be read is that pack's problem, never the
|
|
141
|
+
* case's: every other pack is still read.
|
|
153
142
|
*/
|
|
143
|
+
export declare function loadBundle(pack: SplitPack): [unknown, string | null];
|
|
144
|
+
/** The refusal for a file `case` would read whole past the run's 1 GiB. Same words in both kernels. */
|
|
154
145
|
export declare const wholeReadRefusal: (key: string) => string;
|
|
155
|
-
/**
|
|
156
|
-
* Why `contents.json` reads as an unreadable index when the run's whole-read
|
|
157
|
-
* total has no room for it, and when it cannot be read. The same words in both
|
|
158
|
-
* kernels.
|
|
159
|
-
*/
|
|
146
|
+
/** Why `contents.json` reads as unreadable when it is over budget or cannot be read. */
|
|
160
147
|
export declare const INDEX_OVER_BUDGET = "it would take case past the 1 GiB it reads whole in one run, so it was not read";
|
|
161
148
|
export declare const INDEX_NOT_READ = "it could not be read";
|
|
162
149
|
/** The note for a `witness-cache.json` the whole-read total had no room for. */
|
|
@@ -164,15 +151,13 @@ export declare const witnessCacheRefusedNote: (path: string) => string;
|
|
|
164
151
|
/** The refusal for an archive file larger than MAX_ZIP_ARCHIVE_BYTES. */
|
|
165
152
|
export declare const zipFileRefusal: (arg: string) => string;
|
|
166
153
|
/**
|
|
167
|
-
* A regular file's bytes
|
|
168
|
-
*
|
|
169
|
-
* the walk listed it is refused rather than followed or waited on.
|
|
154
|
+
* A regular file's bytes, opened without following a link or blocking, then
|
|
155
|
+
* rechecked, so a swapped-in link or pipe is refused.
|
|
170
156
|
*
|
|
171
|
-
* `budget` is the bytes a run may still hold whole
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* already in memory, inside the archive's own cap, and is not charged.
|
|
157
|
+
* `budget` is the bytes a run may still hold whole (MAX_FOLDER_BYTES at the
|
|
158
|
+
* start). A file larger than that, or that grows past it, is refused before it
|
|
159
|
+
* is held. A `.zip` entry is already in memory under the archive cap and is not
|
|
160
|
+
* charged.
|
|
176
161
|
*/
|
|
177
162
|
export declare function readFileEntry(entry: TreeEntry, key: string, budget?: {
|
|
178
163
|
n: number;
|
|
@@ -184,36 +169,28 @@ export declare function readFileEntry(entry: TreeEntry, key: string, budget?: {
|
|
|
184
169
|
*/
|
|
185
170
|
export declare function treeFromArguments(paths: readonly string[]): Promise<Map<string, TreeEntry>>;
|
|
186
171
|
export declare const CASE_USAGE: string;
|
|
187
|
-
/**
|
|
188
|
-
* The case verdict's code, moved only by an on-chain half that was asked for:
|
|
189
|
-
* a witness that does not match is a failure whatever the reading said, and an
|
|
190
|
-
* on-chain half that could not be settled is never a clean 0.
|
|
191
|
-
*/
|
|
192
|
-
export declare function caseExitCode(verdict: string, onChainVerdict: string): number;
|
|
193
172
|
export interface CaseFileData {
|
|
194
173
|
root: string;
|
|
195
174
|
index: string;
|
|
196
175
|
case_id: string | null;
|
|
197
176
|
findings: {
|
|
177
|
+
kind: string;
|
|
198
178
|
rendered: string;
|
|
199
179
|
}[];
|
|
200
180
|
}
|
|
201
181
|
/**
|
|
202
|
-
* The index comparison, once per argument
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* larger than what is left is reported as too large to hash, never as a match
|
|
207
|
-
* and never as absent. It is never an input to the reading.
|
|
182
|
+
* The index comparison, once per argument with a `contents.json` at its root
|
|
183
|
+
* (§5.6.3). Files under `packs/` and `report/` are hashed in pieces, sharing a
|
|
184
|
+
* 1 GiB total in path order; a file past what is left reports as too large,
|
|
185
|
+
* never as a match or absent. Never an input to the reading.
|
|
208
186
|
*/
|
|
209
187
|
export declare function caseFileReadings(tree: Map<string, TreeEntry>, whole?: {
|
|
210
188
|
n: number;
|
|
211
189
|
}, cap?: number): Promise<CaseFileData[]>;
|
|
212
190
|
/**
|
|
213
|
-
* `proof case <folder>... [--gateways <urls>] [--json]`.
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* command.
|
|
191
|
+
* `proof case <folder>... [--gateways <urls>] [--json]`. An unexpected
|
|
192
|
+
* exception exits 4, never 1: 1 would call the evidence failed over a defect in
|
|
193
|
+
* this command.
|
|
217
194
|
*/
|
|
218
195
|
export declare function runCase(argv: readonly string[], stream: Cli): Promise<number>;
|
|
219
196
|
export declare function looseFiles(tree: Map<string, TreeEntry>, split: SplitCase, cap?: number): Promise<{
|