@agledger/verify-core 2.2.0 → 4.0.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/LICENSE +18 -18
- package/README.md +797 -29
- package/dist/acknowledgements.d.ts +32 -0
- package/dist/acknowledgements.js +88 -0
- package/dist/anchors.d.ts +349 -0
- package/dist/anchors.js +654 -0
- package/dist/attestation.d.ts +98 -0
- package/dist/attestation.js +145 -0
- package/dist/audit-export.d.ts +343 -20
- package/dist/audit-export.js +400 -22
- package/dist/batch-head.d.ts +28 -0
- package/dist/batch-head.js +169 -0
- package/dist/batch.d.ts +69 -0
- package/dist/batch.js +99 -0
- package/dist/bulk-export.d.ts +161 -0
- package/dist/bulk-export.js +711 -0
- package/dist/chain.d.ts +135 -13
- package/dist/chain.js +229 -24
- package/dist/claim.d.ts +23 -0
- package/dist/claim.js +100 -0
- package/dist/export-anchors.d.ts +84 -0
- package/dist/export-anchors.js +109 -0
- package/dist/export-evidence.d.ts +90 -0
- package/dist/export-evidence.js +186 -0
- package/dist/export-pages.d.ts +476 -0
- package/dist/export-pages.js +586 -0
- package/dist/failures.d.ts +20 -16
- package/dist/failures.js +44 -16
- package/dist/federation-wire.d.ts +78 -11
- package/dist/federation-wire.js +199 -57
- package/dist/history-seal.d.ts +100 -0
- package/dist/history-seal.js +301 -0
- package/dist/index.d.ts +36 -8
- package/dist/index.js +17 -4
- package/dist/key-statements.d.ts +138 -5
- package/dist/key-statements.js +191 -20
- package/dist/ml-dsa-kats.d.ts +18 -0
- package/dist/ml-dsa-kats.js +241 -0
- package/dist/primitives.d.ts +255 -18
- package/dist/primitives.js +612 -55
- package/dist/read-log.d.ts +350 -0
- package/dist/read-log.js +816 -0
- package/dist/schema-chain-export.d.ts +82 -0
- package/dist/schema-chain-export.js +474 -0
- package/dist/walk-anchors.d.ts +115 -0
- package/dist/walk-anchors.js +133 -0
- package/dist/walk-checkpoints.d.ts +125 -0
- package/dist/walk-checkpoints.js +118 -0
- package/package.json +6 -5
package/dist/audit-export.d.ts
CHANGED
|
@@ -19,12 +19,17 @@
|
|
|
19
19
|
* Older exports without these fields stay `skipped_no_input`, surfaced in the
|
|
20
20
|
* result so a caller never mistakes "not checked here" for "checked and passed".
|
|
21
21
|
*/
|
|
22
|
-
import { type CheckApplicability, type EvidenceBindingCounts, type OptionalCheck, type SignatureOutcome } from './chain.js';
|
|
22
|
+
import { type AgentKeyEntry, type CheckApplicability, type EvidenceBindingCounts, type HistorySealCounts, type KeyRegistry, type OptionalCheck, type SignatureCoverage, type SignatureOutcome } from './chain.js';
|
|
23
23
|
import type { FailureCode } from './failures.js';
|
|
24
|
-
import { type
|
|
24
|
+
import { type AcknowledgementReport, type AnchorDocumentInput } from './anchors.js';
|
|
25
|
+
import { type AcknowledgementSource } from './acknowledgements.js';
|
|
26
|
+
import { type AttestationReport, type ComplianceRecordInput } from './attestation.js';
|
|
27
|
+
import { type CheckpointCoverageReport, type ExportAnchorsReport, type ExportAnchorsWalkView } from './export-anchors.js';
|
|
28
|
+
import { type ChainHeldTo, type ListedCheckpointView, type VaultCheckpointRow } from './walk-checkpoints.js';
|
|
29
|
+
import { type AgentPublicKeyJwk, type RuntimeBelowFloor, type Uncomputable } from './primitives.js';
|
|
25
30
|
import { type FederationKeyEntry } from './federation-wire.js';
|
|
26
|
-
import { type
|
|
27
|
-
|
|
31
|
+
import { type CheckpointEvidenceInput, type CheckpointEvidenceReport, type ReceiptCounts } from './export-evidence.js';
|
|
32
|
+
import { type DistrustedKey, type KeyTrust, type KeyTrustReport, type PublishedKeyStatement, type Verdict } from './key-statements.js';
|
|
28
33
|
export interface AuditExportEntryInput {
|
|
29
34
|
/** 1-based chain position. Current exports emit `chainPosition`; pre-v0.25 used `position`. */
|
|
30
35
|
chainPosition?: number;
|
|
@@ -71,6 +76,35 @@ export interface AuditExportEntryInput {
|
|
|
71
76
|
/** Base64-encoded canonical COSE_Sign1 envelope (RFC 9052). */
|
|
72
77
|
coseSign1: string;
|
|
73
78
|
signingKeyId: string | null;
|
|
79
|
+
/** The Server's own verdict on the entry. Never read as one. */
|
|
80
|
+
valid?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Base64 SCITT Receipt (COSE_Sign1, draft-ietf-cose-merkle-tree-proofs)
|
|
83
|
+
* on a `?receipts=true` export: an RFC 9162 inclusion proof of this
|
|
84
|
+
* entry's `coseSign1` bytes in a Merkle tree over the record's chain,
|
|
85
|
+
* signed by the vault signing key. Verified when present (`receipts`).
|
|
86
|
+
*/
|
|
87
|
+
receipt?: string;
|
|
88
|
+
/** On a creation entry: the Server's answer on whether the stored schema still matches the `schemaRef` the entry signs. Unsigned. */
|
|
89
|
+
schemaBinding?: string;
|
|
90
|
+
/**
|
|
91
|
+
* On COMPLIANCE_ATTESTATION and AI_IMPACT_ASSESSMENT entries: the Server's
|
|
92
|
+
* answer on whether the row the entry names still hashes to the signed
|
|
93
|
+
* `payload.contentHash`. Unsigned; the signed hash is in the payload.
|
|
94
|
+
*/
|
|
95
|
+
contentBinding?: string;
|
|
96
|
+
/**
|
|
97
|
+
* On an entry written under the batched signing cadence: the RFC 9162
|
|
98
|
+
* inclusion proof from the entry's leaf to the root its batch head signs
|
|
99
|
+
* (`exportMetadata.batchHeads`). Absent on a batched entry no head covers
|
|
100
|
+
* yet. The entry is verified through it.
|
|
101
|
+
*/
|
|
102
|
+
batch?: {
|
|
103
|
+
batchId: string;
|
|
104
|
+
leafIndex: number;
|
|
105
|
+
treeSize: number;
|
|
106
|
+
auditPath: string[];
|
|
107
|
+
} | null;
|
|
74
108
|
};
|
|
75
109
|
}
|
|
76
110
|
/** Per-key activation/retirement window; drives temporal key-validity (Server 0.26 and later). */
|
|
@@ -110,6 +144,61 @@ export interface RecordAuditExportInput {
|
|
|
110
144
|
* caller's anchors, never used as one: it is the artifact's word.
|
|
111
145
|
*/
|
|
112
146
|
anchoredFrom?: string | null;
|
|
147
|
+
/** The contract type the record was created under, as its creation entry signs it (`payload.schemaRef`). Unsigned copy. */
|
|
148
|
+
/**
|
|
149
|
+
* Absent from exports by older Servers. A field the Server could not
|
|
150
|
+
* resolve is absent, never null.
|
|
151
|
+
*/
|
|
152
|
+
schemaRef?: {
|
|
153
|
+
publisher?: string;
|
|
154
|
+
type?: string;
|
|
155
|
+
version?: string;
|
|
156
|
+
manifestDigest?: string;
|
|
157
|
+
} | null;
|
|
158
|
+
/** The Server's answer on whether the stored schema still matches `schemaRef`. Unsigned. */
|
|
159
|
+
schemaBinding?: string;
|
|
160
|
+
/**
|
|
161
|
+
* The record's latest signed checkpoint and how far it covers the chain
|
|
162
|
+
* (Server 3.0.0 and later). The embedded checkpoint is verified
|
|
163
|
+
* (`checkpoint_evidence`); the coverage fields are the Server's word.
|
|
164
|
+
*/
|
|
165
|
+
checkpointEvidence?: CheckpointEvidenceInput | null;
|
|
166
|
+
/** When the Server cut the export. Unsigned; it dates how long a batched entry with no proof has waited. */
|
|
167
|
+
exportDate?: string;
|
|
168
|
+
/**
|
|
169
|
+
* The signed batch heads the export's batched entries name, each once
|
|
170
|
+
* (a Server on the batched signing cadence). Verified under keys resolved
|
|
171
|
+
* like the entries' keys, at each head's own `createdAt`.
|
|
172
|
+
*/
|
|
173
|
+
batchHeads?: Array<{
|
|
174
|
+
id: string;
|
|
175
|
+
signingKeyId: string;
|
|
176
|
+
coseSign1: string;
|
|
177
|
+
createdAt: string;
|
|
178
|
+
}>;
|
|
179
|
+
/**
|
|
180
|
+
* Every history seal the Server holds, each with this record chain's
|
|
181
|
+
* inclusion proof, or `proof: null` where the seal has no leaf for it (a
|
|
182
|
+
* chain created after the seal).
|
|
183
|
+
*/
|
|
184
|
+
historySeals?: Array<{
|
|
185
|
+
id: string;
|
|
186
|
+
retiredKeyId: string;
|
|
187
|
+
signingKeyId: string;
|
|
188
|
+
treeSize: number;
|
|
189
|
+
rootHash: string;
|
|
190
|
+
coseSign1: string;
|
|
191
|
+
createdAt: string;
|
|
192
|
+
proof: {
|
|
193
|
+
leaf: {
|
|
194
|
+
chainKey: string;
|
|
195
|
+
chainPosition: number;
|
|
196
|
+
entryHash: string;
|
|
197
|
+
};
|
|
198
|
+
leafIndex: number;
|
|
199
|
+
auditPath: string[];
|
|
200
|
+
} | null;
|
|
201
|
+
}>;
|
|
113
202
|
};
|
|
114
203
|
entries: AuditExportEntryInput[];
|
|
115
204
|
/**
|
|
@@ -198,7 +287,7 @@ export interface VerifyExportOptions {
|
|
|
198
287
|
*/
|
|
199
288
|
distrustedKeys?: ReadonlyArray<string | DistrustedKey>;
|
|
200
289
|
/**
|
|
201
|
-
*
|
|
290
|
+
* Public keys of agent ephemeral certs, as JWKs: the `publicKeyJwk`
|
|
202
291
|
* the agent sent to `POST /v1/auth/oidc/cert`, which is also the `cnf.jwk`
|
|
203
292
|
* claim inside the returned `certJws`. The export does not carry them.
|
|
204
293
|
*
|
|
@@ -208,9 +297,9 @@ export interface VerifyExportOptions {
|
|
|
208
297
|
* the cert holder signed that request-body hash without trusting the
|
|
209
298
|
* Server's word for it. A key is matched only through the thumbprint the
|
|
210
299
|
* entry signed, so where a key came from does not need to be trusted.
|
|
211
|
-
* Anything that is not an
|
|
300
|
+
* Anything that is not an agent cert key JWK throws `TypeError`.
|
|
212
301
|
*/
|
|
213
|
-
agentKeys?: ReadonlyArray<AgentPublicKeyJwk>;
|
|
302
|
+
agentKeys?: ReadonlyArray<AgentPublicKeyJwk | AgentKeyEntry>;
|
|
214
303
|
/**
|
|
215
304
|
* Federation keys of the Servers this one peers with, keyed by their hub id:
|
|
216
305
|
* `{ [hubId]: publicKey }` or `[{ hubId, publicKey }]`, each key as base64
|
|
@@ -256,7 +345,72 @@ export interface VerifyExportOptions {
|
|
|
256
345
|
* `TypeError`.
|
|
257
346
|
*/
|
|
258
347
|
expectedEntryCount?: number;
|
|
348
|
+
/**
|
|
349
|
+
* Anchor documents read from the anchor bucket
|
|
350
|
+
* (`vault-anchors/<instanceId>/<chainKey>/<chainPosition>.json`), each as
|
|
351
|
+
* `{ source, document, objectKey? }` with `document` the parsed JSON. Each
|
|
352
|
+
* checkpoint a document carries that verifies under the export's keys is
|
|
353
|
+
* compared with the chain (`anchors`); an unaccounted cut, rewrite or fork
|
|
354
|
+
* fails ANCHOR_CHAIN_CUT, ANCHOR_CHAIN_REWRITTEN or ANCHOR_FORK. Anything
|
|
355
|
+
* else throws `TypeError`.
|
|
356
|
+
*/
|
|
357
|
+
anchorDocuments?: ReadonlyArray<AnchorDocumentInput>;
|
|
358
|
+
/**
|
|
359
|
+
* Compliance records as `GET /v1/records/{id}/compliance-records/{complianceRecordId}`
|
|
360
|
+
* serves them: one response, an array, or the list body `{ data: [...] }`.
|
|
361
|
+
* Each is bound by its `id` to the COMPLIANCE_ATTESTATION entry that names
|
|
362
|
+
* it, and its attestation is held to the signed contentHash
|
|
363
|
+
* (`attestation_bodies`). Anything else throws `TypeError`.
|
|
364
|
+
*/
|
|
365
|
+
complianceRecords?: ComplianceRecordInput | ReadonlyArray<ComplianceRecordInput> | {
|
|
366
|
+
data: ReadonlyArray<ComplianceRecordInput>;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* When the caller read the export (RFC 3339). Anchors are judged through
|
|
370
|
+
* it, less one second, in place of the export's own
|
|
371
|
+
* `checkpointEvidence.anchorsJudgedThroughIat`, which is unsigned. An
|
|
372
|
+
* anchor whose checkpoint verifies and signs a position above the last
|
|
373
|
+
* entry held is set aside as signed after the read only on a read time the
|
|
374
|
+
* caller gave: on the export's own word, or with none, it holds the verdict
|
|
375
|
+
* at best `unanchored` (`capped`). A time earlier than the signed `iat` of
|
|
376
|
+
* an entry or of the embedded checkpoint the export holds throws
|
|
377
|
+
* `TypeError` naming the entry: the export was read after it was signed.
|
|
378
|
+
* Batched entries with no proof are still dated by `exportMetadata.exportDate`.
|
|
379
|
+
*/
|
|
380
|
+
exportDate?: string;
|
|
381
|
+
/**
|
|
382
|
+
* Acknowledgements of lost history the export does not carry, each a parsed
|
|
383
|
+
* document: a record export (read at
|
|
384
|
+
* `exportMetadata.checkpointEvidence.acknowledgedRewinds`), a page of a bulk
|
|
385
|
+
* export walk under a platform key (the RESTORE_EPOCH rows of its
|
|
386
|
+
* platform-ops chain), or `acknowledgedRewinds` items. Each is verified
|
|
387
|
+
* from its own envelope as the export's own are, and only its signed
|
|
388
|
+
* `coveredFindings` are read; `suppliedAcknowledgements` reports each. One
|
|
389
|
+
* that fails reads REWIND_ACKNOWLEDGEMENT_INVALID and covers nothing. A
|
|
390
|
+
* `GET /v1/admin/vault/rewind` response carries no signed envelope, and any
|
|
391
|
+
* other shape, throws `TypeError`.
|
|
392
|
+
*/
|
|
393
|
+
acknowledgements?: ReadonlyArray<AcknowledgementSource>;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Why a result that would read `trusted` reads `unanchored`.
|
|
397
|
+
* - `read_time_not_given`: an anchor or a listed checkpoint above the last
|
|
398
|
+
* entry held was set aside on the artifact's own unsigned read time, or on
|
|
399
|
+
* none; the caller's read time (`exportDate`) decides it.
|
|
400
|
+
* - `walk_not_read_to_end`: an export walk whose pages do not end at a null
|
|
401
|
+
* nextCursor, or show a page missing (`walk.incomplete`).
|
|
402
|
+
* - `chain_set_undecided`: a listed checkpoint or an anchor of a chain the
|
|
403
|
+
* walk holds no entry of could not be placed inside or outside the walk's
|
|
404
|
+
* query (`chainSet`).
|
|
405
|
+
*/
|
|
406
|
+
export type VerdictCapReason = 'read_time_not_given' | 'walk_not_read_to_end' | 'chain_set_undecided';
|
|
407
|
+
/** One reason a result reads at best `unanchored`, with the sentence to show. */
|
|
408
|
+
export interface VerdictCap {
|
|
409
|
+
reason: VerdictCapReason;
|
|
410
|
+
detail: string;
|
|
259
411
|
}
|
|
412
|
+
/** A verdict held at best `unanchored` when any cap applies. */
|
|
413
|
+
export declare function capVerdict(verdict: Verdict, caps: readonly VerdictCap[]): Verdict;
|
|
260
414
|
export interface EntryVerificationResult {
|
|
261
415
|
position: number;
|
|
262
416
|
valid: boolean;
|
|
@@ -268,9 +422,16 @@ export interface EntryVerificationResult {
|
|
|
268
422
|
* The checks `optionalChecks` reports on an export: the chain's, and
|
|
269
423
|
* `entry_count`, which is `applied` when the chain's length was held to a
|
|
270
424
|
* count (the export's own `expectedEntries` / `totalEntries`, or the
|
|
271
|
-
* `expectedEntryCount` option) and `skipped_no_input` when none was given
|
|
425
|
+
* `expectedEntryCount` option) and `skipped_no_input` when none was given;
|
|
426
|
+
* `checkpoint_evidence`, `applied` when the export embeds a checkpoint and it
|
|
427
|
+
* was verified against the chain; and `receipts`, `applied` when the export
|
|
428
|
+
* carries Receipts (`?receipts=true`) and each was verified.
|
|
429
|
+
*
|
|
430
|
+
* `anchors` is `applied` when `anchorDocuments` were given and at least one
|
|
431
|
+
* checkpoint in them was compared with the chain, and `attestation_bodies`
|
|
432
|
+
* when `complianceRecords` were given and at least one was held to an entry.
|
|
272
433
|
*/
|
|
273
|
-
export type ExportOptionalCheck = OptionalCheck | 'entry_count';
|
|
434
|
+
export type ExportOptionalCheck = OptionalCheck | 'entry_count' | 'checkpoint_evidence' | 'receipts' | 'anchors' | 'attestation_bodies';
|
|
274
435
|
export interface VerifyExportResult {
|
|
275
436
|
valid: boolean;
|
|
276
437
|
totalEntries: number;
|
|
@@ -282,12 +443,12 @@ export interface VerifyExportResult {
|
|
|
282
443
|
};
|
|
283
444
|
entries: EntryVerificationResult[];
|
|
284
445
|
recordId: string;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
446
|
+
/**
|
|
447
|
+
* `signed` counts entries whose signature verified, `batched` how many of
|
|
448
|
+
* those are signed through a batch head, `skipped` entries from before the
|
|
449
|
+
* install began signing, and `pending` batched entries no head covers yet.
|
|
450
|
+
*/
|
|
451
|
+
signatureCoverage: SignatureCoverage;
|
|
291
452
|
/**
|
|
292
453
|
* Which input-gated checks ran on this export.
|
|
293
454
|
*
|
|
@@ -364,6 +525,13 @@ export interface VerifyExportResult {
|
|
|
364
525
|
* carry. See `ChainResult.evidenceBinding`.
|
|
365
526
|
*/
|
|
366
527
|
evidenceBinding: EvidenceBindingCounts;
|
|
528
|
+
/**
|
|
529
|
+
* How entries an Ed25519, ES256 or ES384 key signed stand against the
|
|
530
|
+
* export's history seals. `unsealed` entries are valid and rest on their
|
|
531
|
+
* classical signature alone; a result that carries any reads `unanchored`,
|
|
532
|
+
* never `trusted`, and `unsealedKeys` says what would seal each key.
|
|
533
|
+
*/
|
|
534
|
+
historySeal: HistorySealCounts;
|
|
367
535
|
/**
|
|
368
536
|
* The entry counts the export states, which the chain is held to.
|
|
369
537
|
* `expectedEntries` is the position of the record's latest checkpoint
|
|
@@ -378,14 +546,137 @@ export interface VerifyExportResult {
|
|
|
378
546
|
statedEntries: number | null;
|
|
379
547
|
};
|
|
380
548
|
/**
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
549
|
+
* The checkpoint `exportMetadata.checkpointEvidence` embeds, held to the
|
|
550
|
+
* chain the way a dump's checkpoint is: the entry at its position must
|
|
551
|
+
* exist and carry its signed tip hash, and its signature must verify under
|
|
552
|
+
* a key resolved like the entries' keys. `state: 'absent'` when the export
|
|
553
|
+
* embeds none, which holds the chain to nothing signed.
|
|
554
|
+
*/
|
|
555
|
+
checkpointEvidence: CheckpointEvidenceReport;
|
|
556
|
+
/** Receipts on a `?receipts=true` export: present vs verified. */
|
|
557
|
+
receipts: ReceiptCounts;
|
|
558
|
+
/**
|
|
559
|
+
* The coverage fields of `checkpointEvidence` (`lastEntryPosition`,
|
|
560
|
+
* `coveredThroughPosition`, `coverage`, `uncoveredFromPosition`,
|
|
561
|
+
* `uncoveredEntries`) held to the entries and the embedded checkpoint. A
|
|
562
|
+
* disagreement fails CHECKPOINT_COVERAGE_MISMATCH, and a last position above
|
|
563
|
+
* the entries carried CHAIN_POSITION_GAP.
|
|
564
|
+
*/
|
|
565
|
+
checkpointCoverage: CheckpointCoverageReport;
|
|
566
|
+
/**
|
|
567
|
+
* The acknowledgements of lost history `checkpointEvidence.acknowledgedRewinds`
|
|
568
|
+
* lists, each verified from its own envelope. `linkChecked` is false: an
|
|
569
|
+
* acknowledgement's link in the platform-ops chain is established only by a
|
|
570
|
+
* dump of that chain.
|
|
571
|
+
*/
|
|
572
|
+
acknowledgedRewinds: AcknowledgementReport;
|
|
573
|
+
/** The supplied anchor documents against the chain (see `anchorDocuments`). */
|
|
574
|
+
anchors: ExportAnchorsReport;
|
|
575
|
+
/** The acknowledgements the caller gave (`acknowledgements`), each verified from its own envelope. */
|
|
576
|
+
suppliedAcknowledgements: AcknowledgementReport;
|
|
577
|
+
/**
|
|
578
|
+
* Each reason the verdict reads at best `unanchored` although nothing
|
|
579
|
+
* failed: see `VerdictCapReason`. Empty when none applies.
|
|
580
|
+
*/
|
|
581
|
+
capped: VerdictCap[];
|
|
582
|
+
/**
|
|
583
|
+
* The COMPLIANCE_ATTESTATION and AI_IMPACT_ASSESSMENT entries: the signed
|
|
584
|
+
* contentHash and attestedAt in the forms the Server writes, and each
|
|
585
|
+
* supplied compliance record held to its entry (see `complianceRecords`).
|
|
586
|
+
* Each entry's `serverContentBinding` is the export's
|
|
587
|
+
* `integrity.contentBinding`: the Server's own statement, unsigned, and
|
|
588
|
+
* kept out of the verdict.
|
|
589
|
+
*/
|
|
590
|
+
attestations: AttestationReport;
|
|
591
|
+
/**
|
|
592
|
+
* The signature checks that could not be computed on this host or by this
|
|
593
|
+
* build (`CHAIN_UNSUPPORTED_ALGORITHM`, wherever it was reported), and the
|
|
594
|
+
* algorithms of the export's keys behind them, on any verdict. Where the
|
|
595
|
+
* verdict is `unverifiable`, `unverifiableDetail` gives the sentence to show
|
|
596
|
+
* for it.
|
|
597
|
+
*/
|
|
598
|
+
uncomputable: Uncomputable;
|
|
599
|
+
/**
|
|
600
|
+
* Present only when the running Node.js is older than `NODE_FLOOR`, which
|
|
601
|
+
* does not compute ML-DSA. Read it before the verdict: show
|
|
602
|
+
* `belowFloorNotice(result.runtime)` first and do not act on the verdict
|
|
603
|
+
* until the same input is verified on a Node.js at or above the floor.
|
|
604
|
+
*/
|
|
605
|
+
runtime?: RuntimeBelowFloor;
|
|
606
|
+
/**
|
|
607
|
+
* `trusted`, `unanchored`, `unverifiable` or `failed` (see `Verdict`). Read
|
|
608
|
+
* this rather than `valid` alone: a valid result with no `trustAnchors`, or
|
|
609
|
+
* none that anchored a signature, is `unanchored`, which is not a trusted
|
|
610
|
+
* verdict. So is a pinned result that failed only because the pin anchored
|
|
611
|
+
* no signature (`valid: false`; see `verdictOf`). A result that
|
|
612
|
+
* would be valid had the signature checks this host refused, under
|
|
613
|
+
* algorithms this build supports, verified is `unverifiable` (`valid: false`;
|
|
614
|
+
* see `isUnverifiable`): nothing was found wrong, and the signatures this
|
|
615
|
+
* host refused were not verified.
|
|
616
|
+
* A check under an algorithm this build cannot compute stays a failure. On a
|
|
617
|
+
* `failed` result, `brokenAt` is the first failure that is not a check this
|
|
618
|
+
* host or build could not compute.
|
|
386
619
|
*/
|
|
387
620
|
verdict: Verdict;
|
|
388
621
|
}
|
|
622
|
+
/**
|
|
623
|
+
* Which of the Server's cross-record exports a document is, or null: a page
|
|
624
|
+
* of `GET /v1/audit-vault/export` (`'bulk'`) or of
|
|
625
|
+
* `GET /v1/audit-vault/schema-chain/export` (`'schema-chain'`). Both carry
|
|
626
|
+
* their entries in `data` beside `chainMetadata`, where a record's audit
|
|
627
|
+
* export carries `entries`. `verifyAuditExport` reads a record's audit export
|
|
628
|
+
* and names the function that reads these: `verifyBulkExport` and
|
|
629
|
+
* `verifySchemaChainExport`. An NDJSON page parsed line by line is read by
|
|
630
|
+
* those functions as text.
|
|
631
|
+
*/
|
|
632
|
+
export declare function auditVaultExportKind(value: unknown): 'bulk' | 'schema-chain' | null;
|
|
633
|
+
/** What reads a cross-record export page in place of `verifyAuditExport`. */
|
|
634
|
+
export declare const NOT_A_RECORD_EXPORT: Readonly<Record<'bulk' | 'schema-chain', string>>;
|
|
635
|
+
/**
|
|
636
|
+
* How a cross-record export's reader holds one chain it took from the pages:
|
|
637
|
+
* the run of positions the pages carry, and what the entries' signed identity
|
|
638
|
+
* is held to in place of the record id. Set by `bulk-export.ts` and
|
|
639
|
+
* `schema-chain-export.ts` on the document they build for each chain, and
|
|
640
|
+
* read by every run `verifyAuditExport` makes on that document, reruns
|
|
641
|
+
* included.
|
|
642
|
+
*/
|
|
643
|
+
export interface ChainReading {
|
|
644
|
+
slice?: {
|
|
645
|
+
startPosition: number;
|
|
646
|
+
previousHash: string | null;
|
|
647
|
+
openEnd?: boolean;
|
|
648
|
+
};
|
|
649
|
+
identity?: (entries: ReadonlyArray<unknown>) => {
|
|
650
|
+
recordId: string;
|
|
651
|
+
finding?: NonNullable<VerifyExportResult['brokenAt']>;
|
|
652
|
+
};
|
|
653
|
+
/** What the walk adds to the anchor comparison: its judged-through time, the run it holds, its acknowledgements. */
|
|
654
|
+
anchors?: ExportAnchorsWalkView;
|
|
655
|
+
/** Capture the key registry of the outer run, for checks the walk makes outside any one chain. */
|
|
656
|
+
keys?: (keys: KeyRegistry, signingSince: string | null) => void;
|
|
657
|
+
/**
|
|
658
|
+
* Signed checkpoints listed for the chain (GET /v1/audit-vault/checkpoints),
|
|
659
|
+
* held to its entries; `report` receives how far the chain is held, once
|
|
660
|
+
* per run, the outer run last.
|
|
661
|
+
*/
|
|
662
|
+
listedCheckpoints?: {
|
|
663
|
+
rows: ReadonlyArray<{
|
|
664
|
+
row: VaultCheckpointRow;
|
|
665
|
+
source: string;
|
|
666
|
+
}>;
|
|
667
|
+
view: ListedCheckpointView;
|
|
668
|
+
report: (heldTo: ChainHeldTo) => void;
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* The read time of the page each entry was served on, by index into
|
|
672
|
+
* `entries` (RFC 3339, or null where nothing dates that page). A batched
|
|
673
|
+
* entry with no inclusion proof is judged against its own page's read
|
|
674
|
+
* time, in place of `exportMetadata.exportDate`.
|
|
675
|
+
*/
|
|
676
|
+
entryReadTimes?: ReadonlyArray<string | null>;
|
|
677
|
+
}
|
|
678
|
+
/** `verifyAuditExport` on a document built for one chain of a cross-record export. Internal to this package. */
|
|
679
|
+
export declare function verifyExportChain(exportData: RecordAuditExportInput, options: VerifyExportOptions, reading: ChainReading): VerifyExportResult;
|
|
389
680
|
/**
|
|
390
681
|
* Verify one record's `/audit-export` document offline.
|
|
391
682
|
*
|
|
@@ -395,3 +686,35 @@ export interface VerifyExportResult {
|
|
|
395
686
|
* inside a well-formed document is a failure code on that entry, never a throw.
|
|
396
687
|
*/
|
|
397
688
|
export declare function verifyAuditExport(exportData: RecordAuditExportInput, given?: VerifyExportOptions): VerifyExportResult;
|
|
689
|
+
/**
|
|
690
|
+
* The record id the export is about, taken from what it signs. The id in
|
|
691
|
+
* `exportMetadata` is unsigned, so it is held to the id each entry's signed
|
|
692
|
+
* predicate names and to the entry's own `recordId` column: any disagreement,
|
|
693
|
+
* among the entries or with the metadata, fails CHAIN_PAYLOAD_BINDING_MISMATCH,
|
|
694
|
+
* and the id reported is the signed one, never the metadata's.
|
|
695
|
+
*/
|
|
696
|
+
export declare function signedRecordId(stated: unknown, entries: ReadonlyArray<unknown>): {
|
|
697
|
+
recordId: string;
|
|
698
|
+
finding?: NonNullable<VerifyExportResult['brokenAt']>;
|
|
699
|
+
};
|
|
700
|
+
/** The keys a document that carries none of its own is verified under: what `suppliedKeyContext` returns. */
|
|
701
|
+
export interface SuppliedKeyContext {
|
|
702
|
+
/** The supplied keys, marked with the walk's verdict when `trustAnchors` were given. */
|
|
703
|
+
keys: KeyRegistry;
|
|
704
|
+
trust: KeyTrust | null;
|
|
705
|
+
/** The earliest activation among the supplied keys and the keys the walk trusts (see `earliestKeyActivation`). */
|
|
706
|
+
signingSince: string | null;
|
|
707
|
+
/** The walk's report, before it is settled against the signatures that verified. */
|
|
708
|
+
walkReport: KeyTrustReport;
|
|
709
|
+
/** The SPKI of every supplied key, for the could-not-compute accounting. */
|
|
710
|
+
publicKeys: string[];
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Resolve `publicKeys`, `trustAnchors` and `distrustedKeys` exactly as
|
|
714
|
+
* `verifyAuditExport` does for an export that embeds no key of its own: the
|
|
715
|
+
* same shapes accepted (the `/v1/verification-keys` body included), the same
|
|
716
|
+
* `TypeError`s at the boundary, the same walk from the anchors over the
|
|
717
|
+
* statements the supplied keys carry. Internal to this package: the read-log
|
|
718
|
+
* reader verifies documents that carry no keys with it.
|
|
719
|
+
*/
|
|
720
|
+
export declare function suppliedKeyContext(fn: string, given: Pick<VerifyExportOptions, 'publicKeys' | 'trustAnchors' | 'distrustedKeys'>): SuppliedKeyContext;
|