@agledger/verify-core 2.1.0 → 2.2.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 CHANGED
@@ -4,7 +4,7 @@ The shared offline verification core for AGLedger audit chains. Decodes
4
4
  canonical **COSE_Sign1** envelopes (RFC 9052, tag 18) over in-toto v1
5
5
  Statement payloads, walks the per-record hash chain, and verifies the
6
6
  signature over each `Sig_structure` under the algorithm the verification key
7
- commits to (Ed25519 or ES256), with no engine, no database, and no network.
7
+ commits to (Ed25519 or ES256), with no Server, no database, and no network.
8
8
 
9
9
  Reads exports and dumps from an AGLedger Server 2.0 or later. For a 1.x Server's, use `npm i @agledger/verify-core@1.5.0`, the last release that reads them.
10
10
 
@@ -52,8 +52,8 @@ console.log(result.verdict); // 'trusted', or 'unanchored' when nothing pinned b
52
52
  Read `verdict` rather than `valid`: a valid result with no `trustAnchors` is
53
53
  `unanchored`, which is not a trusted verdict. An option the function does not
54
54
  read throws `TypeError` rather than being ignored, so a misspelt option, or
55
- `requireOutOfBandKeys` (renamed `requireSuppliedKeys` in 2.0.0), cannot turn a
56
- check off without a word.
55
+ the old name `requireOutOfBandKeys` (the option is `requireSuppliedKeys`),
56
+ cannot turn a check off without a word.
57
57
 
58
58
  ## What it verifies
59
59
 
@@ -101,16 +101,44 @@ check off without a word.
101
101
  `result.evidenceBinding` counts them. An encrypted-mode completion signs a
102
102
  hash over a cleartext the export does not carry, so its ciphertext is counted
103
103
  as `clientHashed`, not re-bound.
104
+ - **The chain's length**, against the two counts the export states: fewer
105
+ entries than `exportMetadata.expectedEntries` (the position of the record's
106
+ latest checkpoint) fails `CHECKPOINT_ROW_MISSING`, and fewer than
107
+ `exportMetadata.totalEntries` (what the Server wrote) fails
108
+ `CHAIN_POSITION_GAP`. `result.entryCount` reports both, each null when the
109
+ export does not state it. Those counts sit in unsigned metadata, which
110
+ whoever cut the chain can also edit, so pass the count you obtained out of
111
+ band as `expectedEntryCount`: an export carrying a different number of
112
+ entries fails `CHAIN_POSITION_GAP`. `optionalChecks.entry_count` is
113
+ `applied` when any count was held and `skipped_no_input` when none was.
114
+ - **The record id**: `result.recordId` is the id the entries sign, never the
115
+ unsigned `exportMetadata.recordId`. A metadata id that disagrees with what
116
+ the entries sign, or entries that name different records, fails
117
+ `CHAIN_PAYLOAD_BINDING_MISMATCH`.
118
+ - **The format**: an export that does not state `exportFormatVersion` and
119
+ `canonicalization`, or states others than this verifier reads, fails
120
+ `UNSUPPORTED_FORMAT`.
104
121
 
105
122
  The payload, OIDC, attribution and key-window checks run when the export
106
- carries their inputs, which every current Server does. The result's `optionalChecks` says
123
+ carries their inputs, which every current Server does. Once one entry carries
124
+ its `payload` and `entryType`, or you pass `federationKeys`, an entry without
125
+ them fails `CHAIN_PAYLOAD_BINDING_MISMATCH` and the check reads `not_checked`,
126
+ so deleting them cannot switch a check off. The result's `optionalChecks` says
107
127
  which ran, so "not checked" never reads as "passed".
108
128
 
129
+ ### SCITT receipts
130
+
131
+ `verifyAuditExport` does not verify receipts. Verify each Receipt (an export
132
+ taken with `?receipts=true` carries them) by calling
133
+ `verifyReceipt(receiptBytes, signedStatementBytes, transparencyServicePublicKeyBase64)`,
134
+ which returns `'ok'` or the reason it failed.
135
+
109
136
  ## Anchoring keys
110
137
 
111
138
  A vault key the Server publishes comes from its database, and anything with
112
139
  write access to that database can add a key row and entries signed with it.
113
- What it cannot add is a **key statement**: a COSE_Sign1 signed by a key the
140
+ What it cannot add, unless it also holds the private half of a key you trust,
141
+ is a **key statement**: a COSE_Sign1 signed by a key the
114
142
  Server already trusted (and, for a new key, by the new key too). Pass the SPKI
115
143
  digest of a vault key you hold or took out of band as `trustAnchors`, and the
116
144
  verifier walks the statements from it:
@@ -134,11 +162,17 @@ statements sign. `keyTrust.status` says whether a pass can be trusted:
134
162
  - `no_anchored_signature`: the walk ran, but no entry verified under a key it
135
163
  anchors, so `optionalChecks.key_anchoring` is `not_checked`. An export of
136
164
  entries written before the install began signing passes under any pin, and
137
- proves nothing about the pin.
165
+ says nothing about the pin.
138
166
 
139
167
  A pass on `no_anchor` or `no_anchored_signature` is not a trusted verdict; the
140
168
  `detail` says so, and `verdict` (and every AGLedger surface) reports it as
141
- `unanchored`. `distrustedKeys` without `trustAnchors` throws `TypeError`, since
169
+ `unanchored`. So is a pinned result that fails only because the pin reaches no
170
+ key in the export at all, as with an export checked against another Server's
171
+ pin: `valid` is false, but the same export verified without the pin passes,
172
+ so nothing in it was tampered with, and the verdict says the pin was not met
173
+ rather than `failed`. Once the pin anchors any key, an entry under a key it
174
+ does not reach is a substitution and the verdict is `failed`.
175
+ `distrustedKeys` without `trustAnchors` throws `TypeError`, since
142
176
  nothing would apply them, and so does a pinned key distrusted with no instant,
143
177
  which the Server refuses to start with. A pin beside a dated entry
144
178
  (`sha256:<hex>@<instant>`) is how a leaked key's history stays verifiable: the
@@ -197,15 +231,15 @@ no longer trusted and its window no longer graded.
197
231
 
198
232
  Statements are walked in the order the Server's database stored them,
199
233
  `createdAt` then the row `id`, never by an instant a statement signs. A dump
200
- carries that order (`created_at`), and so does every key document an API 2.0
201
- Server serves: each statement in an export's `signingKeyStatements`,
234
+ carries that order (`created_at`), and so does every key document a Server 2.0
235
+ or later serves: each statement in an export's `signingKeyStatements`,
202
236
  `/v1/verification-keys` and `/.well-known/agledger-vault-keys.json` carries
203
237
  its row `id` and `createdAt` at microsecond precision, and `keyTrust.order`
204
238
  reads `written`. A `createdAt` that is not strict RFC 3339 (a `T`, an offset
205
239
  or `Z`, a real calendar date) places nothing, and its statement is
206
240
  `KEY_STATEMENT_INVALID`. Such a document lists under a trusted key its
207
241
  admission, every later admission it signed, and the closures that count for
208
- it, so a walk over it dates each window and cuts each edge back as the engine
242
+ it, so a walk over it dates each window and cuts each edge back as the Server
209
243
  does. Where it cannot (a later succession whose endorser the document does not
210
244
  carry, or a closure by a key it does not list), the walk grades the window
211
245
  more loosely than the listed one, and the listed `activatedAt` or `retiredAt`
@@ -229,14 +263,14 @@ out of a distrusted key never admits a key or keeps one reachable, whatever
229
263
  time it carries. Such a statement still counts for everything that can only
230
264
  narrow trust: it dates its subject's window, cuts the subject's edge back as a
231
265
  later admission, and a closure the key signed still ends a window. Where the
232
- document dates it before the cutoff, so the engine would count it, it is no
266
+ document dates it before the cutoff, so the Server would count it, it is no
233
267
  finding: it is listed in `keyTrust.notes`, which never fails a verdict, and an
234
268
  honest rotation away from the key passes when you pin its successor. Pinned
235
269
  only on the distrusted key, its successor is not anchored. This is narrower
236
- than the engine, which holds the key to the time its statements were really
270
+ than the Server, which holds the key to the time its statements were really
237
271
  stored, and never wider. Only
238
272
  a dump walk holds a distrusted key's statements to their `created_at`, as the
239
- engine does, and that adds assurance only for a dump you took from the Server
273
+ Server does, and that adds assurance only for a dump you took from the Server
240
274
  yourself or over a channel you trust; for any other dump it assures no more
241
275
  than the stored times its holder chose.
242
276
 
@@ -285,17 +319,25 @@ and, once its chains are walked, settles it with
285
319
  verified: with none, the status becomes `no_anchored_signature`.
286
320
  `writtenWhileSigning(rowTime, signingSince)` is the unsigned-row rule for
287
321
  checkpoints and read-log rows, and fails closed on a row with no readable time
288
- once signing began.
322
+ once signing began. `placeInKeyWindow(key, rowTime, 'Checkpoint')` holds a
323
+ vault checkpoint, a read-log leaf or a read-log tree head to the signed window
324
+ of its key by the rule entries are held to (`inside`, `not-yet-active`,
325
+ `expired`, `accounted`, or `unplaceable` when a time cannot be read), and
326
+ `distrustAccounts(key, rowTime)` says whether a `distrustedKeys` entry and the
327
+ trusted retirement account for it. Verify the signature first: an artifact
328
+ that is accounted for is set aside only when its signature verifies under the
329
+ key, and a signature that does not verify is reported ahead of a window
330
+ finding.
289
331
 
290
332
  A dump row repeating an earlier row's signed payload counts once, at its
291
333
  first write: a row copied in the database under a new id and time says
292
- nothing new, as the engine reads it. On a key document a copy stays a second
334
+ nothing new, as the Server reads it. On a key document a copy stays a second
293
335
  statement, since its `createdAt` is the holder's word.
294
336
 
295
337
  On a dump, a `distrustedKeys` key that a key the walk trusts has retired is
296
338
  bounded by that retirement (its `DistrustSpan` in `trust.distrustSpans`; only a
297
- retirement by a key the walk trusts counts, as in the engine), and
298
- what it signed before then is accounted for rather than failed, as the engine's
339
+ retirement by a key the walk trusts counts, as in the Server), and
340
+ what it signed before then is accounted for rather than failed, as the Server's
299
341
  scan lists it: a key statement it signed that counts for nothing is listed in
300
342
  `trust.accounted` (and the report's `accounted`) instead of `findings`, and a
301
343
  chain entry whose signature verifies under it, outside what the key is
@@ -320,8 +362,8 @@ entries under it are `CHAIN_UNSUPPORTED_ALGORITHM` rather than unanchored.
320
362
  An agent that authenticates with an ephemeral cert can sign each request body
321
363
  it sends. The Server checks that signature, then seals it into the chain entry
322
364
  as `predicate.on_behalf_of.agent_signature`, beside the RFC 7638 thumbprint of
323
- the cert's public key. The envelope signature proves the Server wrote that. To
324
- prove the agent itself signed, without taking the Server's word for it,
365
+ the cert's public key. The envelope signature covers it as the Server wrote it. To
366
+ check that the agent itself signed, without taking the Server's word for it,
325
367
  re-verify the agent signature against the cert's public key.
326
368
 
327
369
  The export does not carry cert public keys. Supply them as the Ed25519 JWK the
@@ -387,19 +429,23 @@ The windows come from the signed statements, not the document's `keys`
387
429
  summary. Each message is placed by its sealed `wire.timestamp`, which the peer
388
430
  signed and the receiver sealed under its own signature, and which comes from
389
431
  the peer's clock, the same clock its windows are written by. The entry's
390
- `createdAt` is not signed, so it places nothing. A message signed under a key
391
- before that key's activation fails. One signed under a key after the key's
392
- retirement verifies and is counted in `federationWire.afterRetirement`: a peer
393
- process not yet restarted onto the new key sends exactly that, and it is in
394
- order when the receiver's `federation.peer_revoked` audit row for the peer
395
- comes after it. A key behind a genesis that named it only by digest
432
+ `createdAt` is not signed, so it places nothing. The timestamp is the signing
433
+ process's clock and the window is the peer's database clock, so each edge
434
+ carries an allowance of 300 seconds (`FEDERATION_KEY_WINDOW_SKEW_MS`), as the
435
+ Server's own receiver guidance gives it. A message signed under a key more
436
+ than that before the key's activation fails. One signed under a key more than
437
+ that after the key's retirement fails `CHAIN_FEDERATION_WIRE_INVALID`, since a
438
+ retired key signing later is also what a leaked key does. Pass
439
+ `allowAfterRetirement: true` for the short gap while a peer's publisher
440
+ restarts onto its new key: such a message then verifies and is counted in
441
+ `federationWire.afterRetirement`. A key behind a genesis that named it only by digest
396
442
  (`linked: false`) is not linked to the newer keys; name the hub a second time
397
443
  with that key once its operator confirms it. The same goes for a key the
398
444
  history does not list at all, such as the key in use before a change made with
399
445
  neither predecessor setting: a second entry for the hub pins it, and it is
400
446
  trusted on its own. A history that is another hub's, carries a statement that
401
447
  does not verify, or lists none of the keys pinned for its hub throws
402
- `TypeError` before anything is verified.
448
+ `TypeError` before anything is verified. Federation key histories need a Server 2.2 or later on the peer.
403
449
 
404
450
  A sealed signature that does not verify, a sealed key that is not the one
405
451
  supplied for that hub, a body that no longer hashes to what was signed, or an
@@ -422,12 +468,12 @@ runtime. An active OpenSSL FIPS provider carries no EdDSA, so **an Ed25519
422
468
  chain cannot be verified on a FIPS-locked host**. ES256 chains can.
423
469
 
424
470
  That is reported as `CHAIN_UNSUPPORTED_ALGORITHM`, never as a signature
425
- failure. The distinction is the whole point: "I could not check this" and "I
471
+ failure. The two are kept apart because "I could not check this" and "I
426
472
  checked this and it failed" lead to opposite conclusions, and only one of them
427
473
  is grounds for a tamper investigation. The result still fails closed, because
428
474
  an unverified chain is not a verified one. To actually verify an Ed25519 chain,
429
475
  re-run on a host without the restriction; the export and keys are portable and
430
- the verification is entirely offline, so this costs nothing but a second host.
476
+ the verification is entirely offline, so all it needs is a second host.
431
477
 
432
478
  ### Asking about an algorithm directly
433
479
 
@@ -503,3 +549,5 @@ a key fetched from the Server comes from its database too. Trust is what
503
549
  ## License
504
550
 
505
551
  Proprietary. See [LICENSE](./LICENSE). © AGLedger LLC. All rights reserved.
552
+
553
+ AGLedger is a trademark of AGLedger LLC. All other trademarks are the property of their respective owners. Patent pending.
@@ -6,7 +6,7 @@
6
6
  * normalized entry and runs `verifyChain`.
7
7
  *
8
8
  * The three row-level input-gated checks run on the export path when the wire
9
- * carries their inputs (engine ≥ v0.26.x): the `actorOidcSynthesized` flag +
9
+ * carries their inputs (Server 0.26 and later): the `actorOidcSynthesized` flag +
10
10
  * `actorOidcIss/Sub` enable the OIDC-actor cross-check; `signingKeyWindows` +
11
11
  * per-entry `createdAt` enable temporal key-validity; and the per-entry
12
12
  * denormalized `payload` + `entryType` enable binding-integrity, the export's
@@ -14,14 +14,14 @@
14
14
  * tampering of the human-readable `payload`/`criteria` view: the verifier
15
15
  * re-decodes the signed predicate from `coseSign1` and deep-equals it against
16
16
  * the row `payload`, so a rewritten `payload` with an intact envelope fails
17
- * CHAIN_PAYLOAD_BINDING_MISMATCH (validated against a real engine v0.26.4
17
+ * CHAIN_PAYLOAD_BINDING_MISMATCH (validated against a real Server v0.26.4
18
18
  * export; `buildPredicateForRow` reconstructs the signed predicate exactly).
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
22
  import { type CheckApplicability, type EvidenceBindingCounts, type OptionalCheck, type SignatureOutcome } from './chain.js';
23
23
  import type { FailureCode } from './failures.js';
24
- import type { AgentPublicKeyJwk } from './primitives.js';
24
+ import { type AgentPublicKeyJwk } from './primitives.js';
25
25
  import { type FederationKeyEntry } from './federation-wire.js';
26
26
  import { type DistrustedKey, type KeyTrustReport, type PublishedKeyStatement, type Verdict } from './key-statements.js';
27
27
  /** One entry of a `/audit-export` document. */
@@ -36,11 +36,11 @@ export interface AuditExportEntryInput {
36
36
  * CHAIN_MALFORMED_ENTRY.
37
37
  */
38
38
  createdAt?: string | null;
39
- /** OIDC issuer the actor was synthesized from (engine ≥ v0.26.x). */
39
+ /** OIDC issuer the actor was synthesized from (Server 0.26 and later). */
40
40
  actorOidcIss?: string | null;
41
- /** OIDC subject the actor was synthesized from (engine ≥ v0.26.x). */
41
+ /** OIDC subject the actor was synthesized from (Server 0.26 and later). */
42
42
  actorOidcSub?: string | null;
43
- /** Tri-state from `audit_vault.actor_oidc_synthesized` (engine ≥ v0.26.x). Marker for the OIDC-actor check. */
43
+ /** Tri-state `actor_oidc_synthesized` marker (Server 0.26 and later). Marker for the OIDC-actor check. */
44
44
  actorOidcSynthesized?: boolean | null;
45
45
  /**
46
46
  * API-key id of the credential that performed this state-change, mirroring
@@ -56,7 +56,7 @@ export interface AuditExportEntryInput {
56
56
  recordId?: string | null;
57
57
  /** The audit-vault entry type (e.g. `RECORD_CREATED`); drives the binding check's predicate reconstruction. */
58
58
  entryType?: string;
59
- /** Denormalized row `payload` jsonb. Present → the binding-integrity check runs (verificationGuide step 4). */
59
+ /** The entry's readable `payload`, a projection of the signed predicate. Present → the binding-integrity check runs (verificationGuide step 4). */
60
60
  payload?: Record<string, unknown>;
61
61
  /**
62
62
  * The evidence body `?evidence=true` inlines: the completion evidence on a
@@ -73,7 +73,7 @@ export interface AuditExportEntryInput {
73
73
  signingKeyId: string | null;
74
74
  };
75
75
  }
76
- /** Per-key activation/retirement window; drives temporal key-validity (engine ≥ v0.26.x). */
76
+ /** Per-key activation/retirement window; drives temporal key-validity (Server 0.26 and later). */
77
77
  export interface SigningKeyWindow {
78
78
  activatedAt: string;
79
79
  retiredAt: string | null;
@@ -92,6 +92,14 @@ export interface RecordAuditExportInput {
92
92
  recordId: string;
93
93
  exportFormatVersion?: string;
94
94
  canonicalization?: string;
95
+ /** How many entries the Server wrote into this export. */
96
+ totalEntries?: number;
97
+ /**
98
+ * Position of the record's latest signed checkpoint, or null when no
99
+ * checkpoint has been written for it yet. The chain is held to it: fewer
100
+ * entries than this is CHECKPOINT_ROW_MISSING.
101
+ */
102
+ expectedEntries?: number | null;
95
103
  signingPublicKeys?: Record<string, string>;
96
104
  /** keyId → activation/retirement window, the values the key statements sign. */
97
105
  signingKeyWindows?: Record<string, SigningKeyWindow>;
@@ -105,7 +113,7 @@ export interface RecordAuditExportInput {
105
113
  };
106
114
  entries: AuditExportEntryInput[];
107
115
  /**
108
- * Self-describing verification guidance the engine ships in the export.
116
+ * Self-describing verification guidance the Server ships in the export.
109
117
  * `unsignedFields` lists per-entry fields that are UNSIGNED display projections
110
118
  * (e.g. `actorDisplayName`) resolved at export time, not covered by the COSE_Sign1
111
119
  * signature. A PASS does NOT vouch for these labels. The attribution the guide
@@ -194,11 +202,11 @@ export interface VerifyExportOptions {
194
202
  * the agent sent to `POST /v1/auth/oidc/cert`, which is also the `cnf.jwk`
195
203
  * claim inside the returned `certJws`. The export does not carry them.
196
204
  *
197
- * When an entry's signed payload carries an engine-validated
205
+ * When an entry's signed payload carries a Server-validated
198
206
  * `predicate.on_behalf_of.agent_signature` and its sealed cert thumbprint
199
207
  * matches one of these keys, the signature is re-verified offline, proving
200
208
  * the cert holder signed that request-body hash without trusting the
201
- * engine's word for it. A key is matched only through the thumbprint the
209
+ * Server's word for it. A key is matched only through the thumbprint the
202
210
  * entry signed, so where a key came from does not need to be trusted.
203
211
  * Anything that is not an Ed25519 JWK throws `TypeError`.
204
212
  */
@@ -229,6 +237,25 @@ export interface VerifyExportOptions {
229
237
  * hub's pins throws `TypeError`.
230
238
  */
231
239
  federationKeys?: Readonly<Record<string, string>> | ReadonlyArray<FederationKeyEntry>;
240
+ /**
241
+ * Accept a sealed federation message signed by a key its sender's history
242
+ * had already retired (beyond the 300 second clock-skew allowance), counted
243
+ * in `federationWire.afterRetirement`. For the short gap while a sender's
244
+ * publisher restarts onto its new key. Without it such a message fails
245
+ * CHAIN_FEDERATION_WIRE_INVALID, since a retired key signing later is also
246
+ * what a leaked key does.
247
+ */
248
+ allowAfterRetirement?: boolean;
249
+ /**
250
+ * The number of entries the record's chain holds, obtained out of band (the
251
+ * operator's statement, or your own count when you took the export). The
252
+ * count the export states about itself sits in unsigned metadata, which
253
+ * whoever removed entries can also remove; this one cannot be edited from
254
+ * the document. An export carrying a different number of entries fails
255
+ * CHAIN_POSITION_GAP. A non-negative integer: anything else throws
256
+ * `TypeError`.
257
+ */
258
+ expectedEntryCount?: number;
232
259
  }
233
260
  export interface EntryVerificationResult {
234
261
  position: number;
@@ -237,6 +264,13 @@ export interface EntryVerificationResult {
237
264
  detail?: string;
238
265
  signature?: SignatureOutcome['state'];
239
266
  }
267
+ /**
268
+ * The checks `optionalChecks` reports on an export: the chain's, and
269
+ * `entry_count`, which is `applied` when the chain's length was held to a
270
+ * count (the export's own `expectedEntries` / `totalEntries`, or the
271
+ * `expectedEntryCount` option) and `skipped_no_input` when none was given.
272
+ */
273
+ export type ExportOptionalCheck = OptionalCheck | 'entry_count';
240
274
  export interface VerifyExportResult {
241
275
  valid: boolean;
242
276
  totalEntries: number;
@@ -261,17 +295,20 @@ export interface VerifyExportResult {
261
295
  * `actorId` / `actorRole` / `actorOwnerId` columns and the envelope carries
262
296
  * the signed actor claim, which is every current export.
263
297
  * - `payload_binding`, `oidc_actor` and `key_temporal` flip to `applied`
264
- * when the export wire carries their inputs (engine >= v0.26.x: per-entry
298
+ * when the export wire carries their inputs (Server >= v0.26.x: per-entry
265
299
  * `payload` + `entryType`, `actorOidcSynthesized`, `createdAt`, and
266
300
  * `signingKeyWindows` in exportMetadata). Older exports without those
267
301
  * fields stay `skipped_no_input`.
268
302
  * - `agent_signature` is `applied` only when `agentKeys` supplied the cert
269
- * key for at least one engine-validated agent signature on the chain.
303
+ * key for at least one Server-validated agent signature on the chain.
304
+ * - `entry_count` is `applied` when the chain's length was held to a stated
305
+ * or supplied count, and `skipped_no_input` when the export states none
306
+ * and `expectedEntryCount` was not given.
270
307
  *
271
308
  * The applicability is surfaced so a caller never mistakes "not checked
272
309
  * here" for "checked and passed".
273
310
  */
274
- optionalChecks: Record<OptionalCheck, CheckApplicability>;
311
+ optionalChecks: Record<ExportOptionalCheck, CheckApplicability>;
275
312
  /**
276
313
  * How many signature checks resolved against supplied vs export-embedded
277
314
  * keys. Provenance only; whether a key is trusted is `keyTrust`.
@@ -327,10 +364,25 @@ export interface VerifyExportResult {
327
364
  * carry. See `ChainResult.evidenceBinding`.
328
365
  */
329
366
  evidenceBinding: EvidenceBindingCounts;
367
+ /**
368
+ * The entry counts the export states, which the chain is held to.
369
+ * `expectedEntries` is the position of the record's latest checkpoint
370
+ * (null when the export names none) and `statedEntries` the number of
371
+ * entries the Server wrote into the export (null when it does not say).
372
+ * Fewer entries than `expectedEntries` fails CHECKPOINT_ROW_MISSING, and
373
+ * fewer than `statedEntries` fails CHAIN_POSITION_GAP. With both null the
374
+ * entry count is the file's own and is held to nothing.
375
+ */
376
+ entryCount: {
377
+ expectedEntries: number | null;
378
+ statedEntries: number | null;
379
+ };
330
380
  /**
331
381
  * `trusted`, `unanchored` or `failed` (see `Verdict`). Read this rather
332
382
  * than `valid` alone: a valid result with no `trustAnchors`, or none that
333
- * anchored a signature, is `unanchored`, which is not a trusted verdict.
383
+ * anchored a signature, is `unanchored`, which is not a trusted verdict. So
384
+ * is a pinned result that failed only because the pin anchored no signature
385
+ * (`valid: false`; see `verdictOf`).
334
386
  */
335
387
  verdict: Verdict;
336
388
  }