@sanning/proof 0.12.0 → 0.13.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 +25 -12
- package/dist/agent-proof.d.ts +2 -2
- package/dist/agent-proof.js +4 -4
- package/dist/case-file.d.ts +126 -0
- package/dist/case-file.js +349 -0
- package/dist/case.d.ts +173 -26
- package/dist/case.js +469 -123
- package/dist/cli.d.ts +38 -5
- package/dist/cli.js +557 -208
- package/dist/crypto.d.ts +1 -1
- package/dist/crypto.js +5 -1
- package/dist/declaration.d.ts +58 -52
- package/dist/declaration.js +256 -33
- package/dist/evidence.d.ts +2 -0
- package/dist/evidence.js +134 -19
- package/dist/exit-codes.d.ts +17 -0
- package/dist/exit-codes.js +50 -0
- package/dist/grading.d.ts +28 -13
- package/dist/grading.js +90 -31
- package/dist/index.d.ts +10 -7
- package/dist/index.js +13 -6
- package/dist/message-parts.d.ts +11 -9
- package/dist/message-parts.js +11 -9
- package/dist/types.d.ts +1 -0
- package/dist/verifier.d.ts +9 -2
- package/dist/verifier.js +28 -12
- package/dist/zip-reader.d.ts +50 -0
- package/dist/zip-reader.js +220 -0
- package/package.json +2 -2
- package/src/agent-proof.ts +4 -4
- package/src/case-file.ts +419 -0
- package/src/case.ts +586 -132
- package/src/cli.ts +651 -206
- package/src/crypto.ts +5 -1
- package/src/declaration.ts +248 -52
- package/src/evidence.ts +142 -21
- package/src/exit-codes.ts +54 -0
- package/src/grading.ts +109 -52
- package/src/index.ts +58 -2
- package/src/message-parts.ts +11 -9
- package/src/types.ts +5 -0
- package/src/verifier.ts +35 -13
- package/src/zip-reader.ts +229 -0
- package/vectors/README.md +23 -5
- package/vectors/case-file-index.json +668 -0
- package/vectors/case-split.json +218 -9
- package/vectors/pack-grading.json +68 -4
- package/vectors/stamp-on-chain.json +3 -3
package/dist/cli.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { type WitnessLine } from "./case.js";
|
|
2
3
|
interface Cli {
|
|
3
4
|
out: (s: string) => void;
|
|
4
5
|
err: (s: string) => void;
|
|
5
6
|
fetchImpl?: typeof fetch;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
/** Each control character in `text` as a visible escape: `\x1b` for ESC,
|
|
9
|
+
* `\u202e` for RIGHT-TO-LEFT OVERRIDE. Every other character is unchanged, a
|
|
10
|
+
* backslash included, so a line with none is printed as it was. */
|
|
11
|
+
export declare function escapeControl(text: string): string;
|
|
12
|
+
export declare function runCli(argv: string[], stream: Cli): Promise<number>;
|
|
8
13
|
/** The error text for an input with no pack in it, word for word the page's. */
|
|
9
14
|
export declare const NO_BUNDLE = "No bundle.json found. An evidence pack contains bundle.json plus logs/.";
|
|
10
15
|
/** A directory nested deeper than this below an argument refuses the input. */
|
|
@@ -64,9 +69,15 @@ export interface SplitCase {
|
|
|
64
69
|
}
|
|
65
70
|
/** One name the walk found that is not a directory. */
|
|
66
71
|
export interface TreeEntry {
|
|
72
|
+
/** Where it sits on disk. Empty for an entry read out of a case-file `.zip`. */
|
|
67
73
|
fsPath: string;
|
|
68
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* `true` for a regular file; `false` for a link or anything else, including a
|
|
76
|
+
* `.zip` entry the reader refused.
|
|
77
|
+
*/
|
|
69
78
|
regular: boolean;
|
|
79
|
+
/** The bytes of an entry read out of a case-file `.zip`. */
|
|
80
|
+
data?: Uint8Array | null;
|
|
70
81
|
}
|
|
71
82
|
/**
|
|
72
83
|
* The page's `splitCase` followed by its `assemble` per pack, over the walk's
|
|
@@ -88,8 +99,30 @@ export declare function readFileEntry(entry: TreeEntry, key: string): Promise<Ui
|
|
|
88
99
|
* with the way through.
|
|
89
100
|
*/
|
|
90
101
|
export declare function treeFromArguments(paths: readonly string[]): Promise<Map<string, TreeEntry>>;
|
|
91
|
-
export declare const
|
|
92
|
-
|
|
102
|
+
export declare const CASE_USAGE: string;
|
|
103
|
+
interface OnChainRow {
|
|
104
|
+
ref: string;
|
|
105
|
+
witnesses: number;
|
|
106
|
+
confirmed: number;
|
|
107
|
+
mismatched: number;
|
|
108
|
+
unreachable: number;
|
|
109
|
+
not_checked: number;
|
|
110
|
+
}
|
|
111
|
+
interface OnChainHalf {
|
|
112
|
+
/** Present only where a lookup ran: each gateway that answered, in the order given. */
|
|
113
|
+
answered?: string[];
|
|
114
|
+
checked: boolean;
|
|
115
|
+
gateways: string[];
|
|
116
|
+
packs: OnChainRow[];
|
|
117
|
+
verdict: "not_checked" | "confirmed" | "failed" | "undetermined";
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The witness line (evidence-bundle 5.5.6 v1.20, A24, D7) from the on-chain
|
|
121
|
+
* half: `confirmed` is `confirmed`, `not_checked` and `undetermined` are
|
|
122
|
+
* `not_checked` with the reason, and `failed` is `differs`. It never moves the
|
|
123
|
+
* headline.
|
|
124
|
+
*/
|
|
125
|
+
export declare function witnessLine(onChain: OnChainHalf): WitnessLine;
|
|
93
126
|
/**
|
|
94
127
|
* The case verdict's code, moved only by an on-chain half that was asked for:
|
|
95
128
|
* a witness that does not match is a failure whatever the reading said, and an
|
|
@@ -102,5 +135,5 @@ export declare function caseExitCode(verdict: string, onChainVerdict: string): n
|
|
|
102
135
|
* never 1, because 1 would name the evidence failed over a defect in this
|
|
103
136
|
* command.
|
|
104
137
|
*/
|
|
105
|
-
export declare function runCase(argv: readonly string[],
|
|
138
|
+
export declare function runCase(argv: readonly string[], stream: Cli): Promise<number>;
|
|
106
139
|
export {};
|