@sanning/proof 0.9.2 → 0.11.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 +7 -7
- package/dist/agent-proof.js +8 -2
- package/dist/case.d.ts +745 -0
- package/dist/case.js +1318 -0
- package/dist/chain.js +24 -5
- package/dist/cli.js +194 -37
- package/dist/compose.js +3 -3
- package/dist/crypto.d.ts +1 -0
- package/dist/crypto.js +30 -1
- package/dist/declaration.d.ts +284 -0
- package/dist/declaration.js +674 -0
- package/dist/evidence.d.ts +29 -54
- package/dist/evidence.js +622 -206
- package/dist/grading.d.ts +66 -5
- package/dist/grading.js +134 -9
- package/dist/handoff.d.ts +209 -0
- package/dist/handoff.js +598 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +56 -6
- package/dist/message-parts.d.ts +283 -0
- package/dist/message-parts.js +903 -0
- package/dist/verifier.d.ts +36 -0
- package/dist/verifier.js +157 -6
- package/package.json +2 -2
- package/src/agent-proof.ts +8 -2
- package/src/case.ts +1573 -0
- package/src/chain.ts +24 -5
- package/src/cli.ts +226 -39
- package/src/compose.ts +4 -4
- package/src/crypto.ts +29 -1
- package/src/declaration.ts +1005 -0
- package/src/evidence.ts +707 -259
- package/src/grading.ts +168 -11
- package/src/handoff.ts +674 -0
- package/src/index.ts +132 -8
- package/src/message-parts.ts +998 -0
- package/src/verifier.ts +157 -6
- package/vectors/README.md +37 -2
- package/vectors/chain-reading.json +4 -4
- package/vectors/jcs-reader.json +166 -0
- package/vectors/pack-grading.json +131 -3
- package/vectors/stamp-on-chain.json +3 -3
package/dist/evidence.d.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import type { Envelope } from "./types.js";
|
|
2
|
-
export declare const ANCHOR_TRACE_BODY_TYPE = "sanning.anchor.trace/
|
|
2
|
+
export declare const ANCHOR_TRACE_BODY_TYPE = "sanning.anchor.trace/v3";
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* defend (DL-30). Nothing new emits it.
|
|
4
|
+
* The name `event_bytes` replaced. Under the new majors a body entry that still
|
|
5
|
+
* carries it is a hard reject, never an ignored unknown field: ignored, it
|
|
6
|
+
* would read as a withheld record and the event would verify with nothing
|
|
7
|
+
* checked, the fail-open the new majors exist to prevent (governance.md §8,
|
|
8
|
+
* W-3).
|
|
10
9
|
*/
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
export declare const ANCHOR_TRACE_BODY_TYPES: readonly ["sanning.anchor.trace/v2", "sanning.anchor.trace/v1"];
|
|
14
|
-
export declare const EXPORT_BODY_TYPE = "sanning.evidence.export/v1";
|
|
10
|
+
export declare const LEGACY_EVENT_BYTES_FIELD = "record_bytes";
|
|
11
|
+
export declare const EXPORT_BODY_TYPE = "sanning.evidence.export/v2";
|
|
15
12
|
/**
|
|
16
13
|
* The Sanning-signed interval stamp body (evidence-bundle.md §5.2, DL-58).
|
|
17
14
|
*
|
|
18
15
|
* Its own `body_type` rather than a widened anchor-trace body, and the reason
|
|
19
16
|
* is the whole decision: an anchor-trace checkpoint carries a PRODUCER-signed
|
|
20
|
-
* `sanning.events/
|
|
17
|
+
* `sanning.events/v2` envelope, and a stamp has no producer signature at all:
|
|
21
18
|
* Sanning places it, under DL-52, for a customer who holds no chain identity.
|
|
22
19
|
* The two rejected options were making `envelope` optional and synthesising an
|
|
23
20
|
* envelope that Sanning signs; the second would have made a Sanning
|
|
@@ -25,7 +22,7 @@ export declare const EXPORT_BODY_TYPE = "sanning.evidence.export/v1";
|
|
|
25
22
|
* unrecoverable once witnessed.
|
|
26
23
|
*/
|
|
27
24
|
export declare const STAMP_TRACE_BODY_TYPE = "sanning.stamp.trace/v1";
|
|
28
|
-
export declare const STAMP_EVIDENCE_BODY_TYPE = "sanning.stamp.evidence/
|
|
25
|
+
export declare const STAMP_EVIDENCE_BODY_TYPE = "sanning.stamp.evidence/v2";
|
|
29
26
|
/**
|
|
30
27
|
* The version string INSIDE a witnessed stamp body — a different string from
|
|
31
28
|
* the `body_type` above, and the two are easy to confuse.
|
|
@@ -42,7 +39,6 @@ export interface EvidenceIssuer {
|
|
|
42
39
|
kind: string;
|
|
43
40
|
tenant_id?: string;
|
|
44
41
|
agent_id?: string;
|
|
45
|
-
producer_id?: string;
|
|
46
42
|
[k: string]: unknown;
|
|
47
43
|
}
|
|
48
44
|
export interface EvidenceVerdict {
|
|
@@ -71,9 +67,8 @@ export interface AnchorRef {
|
|
|
71
67
|
export interface TraceCheckpoint {
|
|
72
68
|
/**
|
|
73
69
|
* The checkpoint's identity and the join key, DERIVED: hex SHA-256 of the
|
|
74
|
-
* decoded `
|
|
75
|
-
*
|
|
76
|
-
* relabel a checkpoint and the bundle still verified.
|
|
70
|
+
* decoded `event_bytes`. Recomputed by the verifier, never taken from the
|
|
71
|
+
* label.
|
|
77
72
|
*/
|
|
78
73
|
checkpoint_ref: string;
|
|
79
74
|
/**
|
|
@@ -83,14 +78,7 @@ export interface TraceCheckpoint {
|
|
|
83
78
|
*/
|
|
84
79
|
anchor_ref?: AnchorRef;
|
|
85
80
|
envelope: Envelope;
|
|
86
|
-
|
|
87
|
-
merkle_root: string;
|
|
88
|
-
}
|
|
89
|
-
/** The frozen `sanning.anchor.trace/v1` checkpoint (§5.1.3). Read, never written. */
|
|
90
|
-
export interface TraceCheckpointV1 {
|
|
91
|
-
tx_id: string;
|
|
92
|
-
envelope: Envelope;
|
|
93
|
-
record_bytes: string;
|
|
81
|
+
event_bytes: string;
|
|
94
82
|
merkle_root: string;
|
|
95
83
|
}
|
|
96
84
|
export interface TraceInclusion {
|
|
@@ -98,12 +86,12 @@ export interface TraceInclusion {
|
|
|
98
86
|
leaf_index: number;
|
|
99
87
|
leaf_count: number;
|
|
100
88
|
audit_path: string[];
|
|
101
|
-
/** Resolves against `checkpoints[].checkpoint_ref`.
|
|
89
|
+
/** Resolves against `checkpoints[].checkpoint_ref`. */
|
|
102
90
|
checkpoint_ref: string;
|
|
103
91
|
}
|
|
104
92
|
export interface TraceEvent {
|
|
105
93
|
envelope: Envelope;
|
|
106
|
-
|
|
94
|
+
event_bytes?: string;
|
|
107
95
|
content?: string;
|
|
108
96
|
inclusion: TraceInclusion;
|
|
109
97
|
}
|
|
@@ -174,7 +162,7 @@ export interface StampEvidenceInclusion {
|
|
|
174
162
|
}
|
|
175
163
|
export interface StampEvidenceEvent {
|
|
176
164
|
envelope: Envelope;
|
|
177
|
-
|
|
165
|
+
event_bytes?: string;
|
|
178
166
|
content?: string;
|
|
179
167
|
inclusion: StampEvidenceInclusion;
|
|
180
168
|
}
|
|
@@ -211,23 +199,12 @@ export interface OnChainResult {
|
|
|
211
199
|
perGateway: PerGatewayOutcome[];
|
|
212
200
|
}
|
|
213
201
|
export interface CheckpointResult {
|
|
214
|
-
/**
|
|
215
|
-
* The checkpoint's join key AS THE BUNDLE SPELLS IT — the derived
|
|
216
|
-
* `checkpoint_ref` for a v2 body, the legacy `tx_id` for a frozen v1 body.
|
|
217
|
-
* Never re-derived across forms: a v1 bundle's key is its `tx_id`, because
|
|
218
|
-
* that is what its own events resolve against and what an attestation
|
|
219
|
-
* written against it carries.
|
|
220
|
-
*/
|
|
202
|
+
/** The derived `checkpoint_ref`, empty when it could not be derived. */
|
|
221
203
|
checkpointRef: string;
|
|
222
204
|
/**
|
|
223
|
-
* Where this checkpoint was witnessed
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* witnessed, which is a normal state and NOT a deficiency. For a frozen v1
|
|
227
|
-
* checkpoint this is synthesised as `{ kind: "arweave", id: tx_id }`, which
|
|
228
|
-
* is exactly what v1's spec said the field was ("the Arweave TX the
|
|
229
|
-
* checkpoint envelope was anchored as"). The synthesis is reader-side only
|
|
230
|
-
* and never re-enters a signed artifact or a verdict.
|
|
205
|
+
* Where this checkpoint was witnessed. `null` when the checkpoint carries no
|
|
206
|
+
* `anchor_ref`: placed but not yet witnessed, which is a normal state and NOT
|
|
207
|
+
* a deficiency.
|
|
231
208
|
*/
|
|
232
209
|
anchorRef: AnchorRef | null;
|
|
233
210
|
envelopeOk: boolean;
|
|
@@ -299,12 +276,14 @@ export interface StampResult {
|
|
|
299
276
|
* ── The four states, and why none of them collapses ──
|
|
300
277
|
*
|
|
301
278
|
* `null` means not checked — no gateways were supplied, or this stamp names
|
|
302
|
-
* no witness to check
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
279
|
+
* no witness to check, or its `anchor_ref.kind` has no witness adapter, or
|
|
280
|
+
* its id is not one the adapter accepts; the witness was not checked. It is
|
|
281
|
+
* a statement about the RUN, never about the stamp. The other three are
|
|
282
|
+
* statements about the stamp and live in `onChain.rollup`: `confirm` (a
|
|
283
|
+
* gateway returned the witnessed bytes), `mismatch` (a gateway returned
|
|
284
|
+
* DIFFERENT bytes: a finding, and the only one of the four that fails
|
|
285
|
+
* anything), `unreachable` (we asked and nobody answered: an availability
|
|
286
|
+
* gap, never an accusation).
|
|
308
287
|
*
|
|
309
288
|
* Keeping "not checked" distinct from "unreachable" is the whole point. A
|
|
310
289
|
* surface handed a collapsed boolean cannot tell "no gateway could be
|
|
@@ -339,11 +318,7 @@ export interface EvidenceBundleResult {
|
|
|
339
318
|
errors: string[];
|
|
340
319
|
}
|
|
341
320
|
export interface AttestationRecord {
|
|
342
|
-
/**
|
|
343
|
-
* The source checkpoint this attestation binds to, spelled in the SOURCE
|
|
344
|
-
* bundle's vocabulary: `checkpoint_ref` for a v2 source, the legacy `tx_id`
|
|
345
|
-
* for a frozen v1 one. Not re-derived across forms.
|
|
346
|
-
*/
|
|
321
|
+
/** The source checkpoint's derived `checkpoint_ref` this attestation binds to. */
|
|
347
322
|
checkpoint_ref: string;
|
|
348
323
|
payload: AttestationPayload;
|
|
349
324
|
signature_alg: string;
|