@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/src/index.ts
CHANGED
|
@@ -46,9 +46,9 @@ export {
|
|
|
46
46
|
export type { ContentRole, Envelope, Subject, VerificationResult, VerifyOptions } from "./types.js";
|
|
47
47
|
|
|
48
48
|
// Evidence-bundle verification (specs/evidence-bundle.md): the signed
|
|
49
|
-
// sanning.evidence/v1 wrapper carrying the sanning.anchor.trace/
|
|
49
|
+
// sanning.evidence/v1 wrapper carrying the sanning.anchor.trace/v3 body. The CLI
|
|
50
50
|
// (`npx @sanning/proof verify`) is built on this. The same path dispatches on the
|
|
51
|
-
// issuer-composed sanning.evidence.export/
|
|
51
|
+
// issuer-composed sanning.evidence.export/v2 body (specs/evidence-export.md) to
|
|
52
52
|
// verifyExportBody (embedded RSA-PSS operator attestations + a recomputed §4
|
|
53
53
|
// verdict object with per-gateway on-chain outcomes).
|
|
54
54
|
//
|
|
@@ -61,8 +61,6 @@ export type { ContentRole, Envelope, Subject, VerificationResult, VerifyOptions
|
|
|
61
61
|
// content_hash. Additive; verifyEvidenceBundle's behavior is unchanged.
|
|
62
62
|
export {
|
|
63
63
|
ANCHOR_TRACE_BODY_TYPE,
|
|
64
|
-
ANCHOR_TRACE_BODY_TYPE_V1,
|
|
65
|
-
ANCHOR_TRACE_BODY_TYPES,
|
|
66
64
|
EXPORT_BODY_TYPE,
|
|
67
65
|
STAMP_BODY_VERSION,
|
|
68
66
|
STAMP_TRACE_BODY_TYPE,
|
|
@@ -103,7 +101,6 @@ export type {
|
|
|
103
101
|
StampEvidenceEvent,
|
|
104
102
|
StampEvidenceInclusion,
|
|
105
103
|
TraceCheckpoint,
|
|
106
|
-
TraceCheckpointV1,
|
|
107
104
|
TraceEvent,
|
|
108
105
|
TraceInclusion,
|
|
109
106
|
VerdictAttestation,
|
|
@@ -148,7 +145,81 @@ export type {
|
|
|
148
145
|
PackVerdict,
|
|
149
146
|
} from "./grading.js";
|
|
150
147
|
|
|
151
|
-
//
|
|
148
|
+
// The declaration (src/declaration.ts): what a pack SAYS it holds, checked
|
|
149
|
+
// against what it does (evidence-bundle.md §5.4).
|
|
150
|
+
//
|
|
151
|
+
// Every other check in this kernel checks a record that is PRESENT, so a pack
|
|
152
|
+
// with half its records dropped verifies perfectly and an auditor cannot tell
|
|
153
|
+
// a full hand-over from a trimmed one. The declaration is the pack's own
|
|
154
|
+
// statement of what it was meant to contain, inside `body` and therefore under
|
|
155
|
+
// the bundle's signature. Any deviation FAILS and every deviation is NAMED; a
|
|
156
|
+
// pack that carries no declaration is `partial`, never `verified`; and a
|
|
157
|
+
// reading that rests on the UNSIGNED content handed in beside the pack is
|
|
158
|
+
// named on its own and carries the weaker word, because whoever assembles a
|
|
159
|
+
// case chose those bytes (proof#147).
|
|
160
|
+
//
|
|
161
|
+
// Pure: data in, data out, no I/O. `gradePack` takes the result as an
|
|
162
|
+
// optional fourth argument, so a surface gets one verdict; omitting it is the
|
|
163
|
+
// pre-§5.4 behavior, unchanged. Additive: no existing export changes.
|
|
164
|
+
export {
|
|
165
|
+
DECLARATION_VERSION,
|
|
166
|
+
checkDeclaration,
|
|
167
|
+
declarationClaims,
|
|
168
|
+
packRecords,
|
|
169
|
+
renderContentFinding,
|
|
170
|
+
renderDeclarationSummary,
|
|
171
|
+
renderDeviation,
|
|
172
|
+
renderNote,
|
|
173
|
+
} from "./declaration.js";
|
|
174
|
+
export type {
|
|
175
|
+
DeclarationCheck,
|
|
176
|
+
DeclarationClaims,
|
|
177
|
+
DeclarationContentFinding,
|
|
178
|
+
DeclarationContentKind,
|
|
179
|
+
DeclarationDeviation,
|
|
180
|
+
DeclarationDeviationKind,
|
|
181
|
+
DeclarationNote,
|
|
182
|
+
DeclarationNoteKind,
|
|
183
|
+
DeclarationVerdict,
|
|
184
|
+
PackRecord,
|
|
185
|
+
} from "./declaration.js";
|
|
186
|
+
|
|
187
|
+
// The case (src/case.ts): one verdict over SEVERAL packs, across organizations
|
|
188
|
+
// (anchor#198). The layer above the declaration, and the closure for what a
|
|
189
|
+
// declaration cannot reach.
|
|
190
|
+
//
|
|
191
|
+
// A pack a party assembles about itself is not self-proving about what that
|
|
192
|
+
// party LEFT OUT (envelope-spec.md §4.1 A15, evidence-bundle.md §5.4.2 rule 7),
|
|
193
|
+
// because the omission happens before any reader runs. Reading several parties'
|
|
194
|
+
// packs at once is what closes it: a `handoff.sent` with no counterpart is
|
|
195
|
+
// always named, and where a pack signed by the key it names is in the case, the
|
|
196
|
+
// reading says that pack holds no counterpart. Whether a party that presented
|
|
197
|
+
// no such pack recorded anything is not established (proof#143). `readCase`
|
|
198
|
+
// verifies every pack itself, offline, so it is async. Matching is on keys and hashes alone and NEVER on tenancy, so a pair from two
|
|
199
|
+
// organizations verifies (DL-60).
|
|
200
|
+
//
|
|
201
|
+
// Pure: data in, data out, no I/O. Additive: a new module, no existing export
|
|
202
|
+
// changes, and no new verdict word anywhere.
|
|
203
|
+
export {
|
|
204
|
+
CASE_BODY_TYPES,
|
|
205
|
+
CASE_EXCEPTION_KINDS,
|
|
206
|
+
CASE_QUARANTINED_PROFILES,
|
|
207
|
+
CASE_RECORD_PROFILES,
|
|
208
|
+
CASE_VERDICTS,
|
|
209
|
+
readCase,
|
|
210
|
+
renderCaseSummary,
|
|
211
|
+
renderException,
|
|
212
|
+
} from "./case.js";
|
|
213
|
+
export type {
|
|
214
|
+
CaseException,
|
|
215
|
+
CaseExceptionKind,
|
|
216
|
+
CasePack,
|
|
217
|
+
CaseReading,
|
|
218
|
+
CaseRecordReading,
|
|
219
|
+
CaseVerdict,
|
|
220
|
+
} from "./case.js";
|
|
221
|
+
|
|
222
|
+
// Chain reading (src/chain.ts): following the pointer every sanning.events/v2
|
|
152
223
|
// record carries to the record before it, over the records ONE bundle presents.
|
|
153
224
|
//
|
|
154
225
|
// Every anchored event has carried that pointer since the profile was ratified
|
|
@@ -164,7 +235,7 @@ export type {
|
|
|
164
235
|
//
|
|
165
236
|
// It returns FINDINGS, never a verdict, and it feeds no status. Chain links are
|
|
166
237
|
// deletion/reorder-evidence for the events present and NOT a completeness proof
|
|
167
|
-
// (`anchor/docs/profile-sanning.events-
|
|
238
|
+
// (`anchor/docs/profile-sanning.events-v2.md` §5), drop the last N events of a
|
|
168
239
|
// chain and nothing dangles. `CHAIN_READING_SCOPE` is that sentence, exported so
|
|
169
240
|
// every surface prints the same limit rather than paraphrasing it into a claim.
|
|
170
241
|
// Additive — no existing export changes.
|
|
@@ -183,7 +254,7 @@ export type {
|
|
|
183
254
|
} from "./chain.js";
|
|
184
255
|
|
|
185
256
|
// The `proof export` composer (specs/evidence-export.md §5, phase 2): produce a
|
|
186
|
-
// signed, offline-verifiable sanning.evidence.export/
|
|
257
|
+
// signed, offline-verifiable sanning.evidence.export/v2 artifact from a source
|
|
187
258
|
// anchor-trace bundle + operator attestations + an exporter Ed25519 key. The
|
|
188
259
|
// inverse of verifyEvidenceBundle's verifyExportBody dispatch.
|
|
189
260
|
export { attestationSignatureToHex, composeExport } from "./compose.js";
|
|
@@ -198,3 +269,56 @@ export type {
|
|
|
198
269
|
AgentProofResult,
|
|
199
270
|
VerifyAgentProofOptions,
|
|
200
271
|
} from "./agent-proof.js";
|
|
272
|
+
|
|
273
|
+
// The hand-off pairing rule (src/handoff.ts): which records are candidates to
|
|
274
|
+
// be the counterpart of a hand-off record, how a candidate set of more than one
|
|
275
|
+
// is ordered, and what a formed pair grades to (specs/envelope-spec.md §4.1
|
|
276
|
+
// v1.9, proof#132 and proof#136). The Python half is src/sanning_proof/handoff.py and the two
|
|
277
|
+
// answer identically on identical bytes. Additive: a new module, and no
|
|
278
|
+
// existing export changes.
|
|
279
|
+
export {
|
|
280
|
+
CANDIDATE_NAMESPACE,
|
|
281
|
+
DEFINED_EVENT_TYPES,
|
|
282
|
+
NOT_A_HANDOFF_FINDING,
|
|
283
|
+
isConformantHandoffRecord,
|
|
284
|
+
readHandoff,
|
|
285
|
+
readHandoffs,
|
|
286
|
+
recordIsMalformed,
|
|
287
|
+
} from "./handoff.js";
|
|
288
|
+
export type {
|
|
289
|
+
CandidateReading,
|
|
290
|
+
HandoffReading,
|
|
291
|
+
HandoffRecord,
|
|
292
|
+
HandoffVerdict,
|
|
293
|
+
HeldRecord,
|
|
294
|
+
} from "./handoff.js";
|
|
295
|
+
|
|
296
|
+
// A file part's BYTES (src/message-parts.ts): what a file part is, and what a
|
|
297
|
+
// receiver that HOLDS a part's bytes commits to (envelope-spec.md section 4.1
|
|
298
|
+
// v1.13, A18, proof#145). A receiver that holds the bytes hashes them and, on a
|
|
299
|
+
// mismatch, commits to the message AS IT HELD IT, so the pair fails on
|
|
300
|
+
// `message_hash` rather than verifying over bytes nobody checked. The Python
|
|
301
|
+
// half is src/sanning_proof/message_parts.py and the two are held together by
|
|
302
|
+
// cross-kernel/run_parts.sh. Pure: it neither canonicalizes nor hashes the
|
|
303
|
+
// message.
|
|
304
|
+
export {
|
|
305
|
+
BYTES_FOR_UNKNOWN_PART,
|
|
306
|
+
CONFLICTING_PART_BYTES,
|
|
307
|
+
INLINE_BYTES_KEYS,
|
|
308
|
+
MESSAGE_RESULT_ORDER,
|
|
309
|
+
PARTS_NOT_AN_ARRAY,
|
|
310
|
+
PART_ENCODING_MISMATCH,
|
|
311
|
+
PART_INLINE_BYTES,
|
|
312
|
+
PART_INLINE_MISMATCHED,
|
|
313
|
+
PART_MALFORMED_DESCRIPTOR,
|
|
314
|
+
PART_MATCHED,
|
|
315
|
+
PART_MISMATCHED,
|
|
316
|
+
PART_NOT_A_FILE,
|
|
317
|
+
PART_SUPPLIED_TWICE,
|
|
318
|
+
PART_UNCHECKED,
|
|
319
|
+
REFUSAL_ORDER,
|
|
320
|
+
commitHeldMessage,
|
|
321
|
+
isFilePart,
|
|
322
|
+
uncheckedHeldParts,
|
|
323
|
+
} from "./message-parts.js";
|
|
324
|
+
export type { HeldMessage, Note, PartReading, Refusal, SuppliedPart } from "./message-parts.js";
|