@wildo-ai/platform-config-lib 1.1.13 → 1.1.14

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.
Files changed (36) hide show
  1. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.d.ts +41 -0
  2. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.d.ts.map +1 -0
  3. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.js +53 -0
  4. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.js.map +1 -0
  5. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +64 -0
  6. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +49 -0
  8. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -1
  9. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +14 -0
  10. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/runtime-topology.contracts.js +24 -0
  12. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  13. package/dist/esm/index.d.ts +1 -0
  14. package/dist/esm/index.d.ts.map +1 -1
  15. package/dist/esm/index.js +1 -0
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/key-management/approval-seal-verifier.d.ts +72 -2
  18. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -1
  19. package/dist/esm/key-management/approval-seal-verifier.js +102 -0
  20. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -1
  21. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +1 -1
  22. package/dist/esm/pnpm-settings/application-pnpm-settings.js +1 -1
  23. package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -1
  24. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +10 -0
  25. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  26. package/dist/esm/project-config/provider-runtime-artifacts.js +29 -5
  27. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  28. package/dist/esm/project-config/shared/environment.schemas.d.ts +37 -5
  29. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  30. package/dist/esm/project-config/shared/environment.schemas.js +57 -5
  31. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  32. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +8 -0
  33. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  34. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  35. package/dist/tsconfig.build.tsbuildinfo +1 -1
  36. package/package.json +8 -8
@@ -60,6 +60,13 @@ export interface ApprovalSealVerificationInput {
60
60
  readonly contentErased?: boolean;
61
61
  readonly bytes?: Uint8Array;
62
62
  };
63
+ /**
64
+ * The copies an electronic-signature vendor returned of that deliverable (#2293, #2907): each derived from the approved
65
+ * original as a `VENDOR_SIGNED_COPY`. The host names each one (`fileId`), states which file its row says it was derived
66
+ * from (`derivedFromFileId`) and the hash its row recorded (`contentSha256`), all read as statements, never as proof;
67
+ * whoever holds the file gives its BYTES (`wildo seal verify --vendor-signed-copy`). See {@link ApprovalSealVendorSignedCopyInput}.
68
+ */
69
+ readonly vendorSignedCopies?: readonly ApprovalSealVendorSignedCopyInput[];
63
70
  /**
64
71
  * The record the approval is about, as it is NOW (#2914): its fields as an export of the record states them, or null
65
72
  * for a record that is gone. Compared with the sealed field set the disclosed presentation carries
@@ -79,6 +86,31 @@ export interface ApprovalSealVerificationInput {
79
86
  readonly pins?: CryptoKeyPinSet;
80
87
  };
81
88
  }
89
+ /**
90
+ * One vendor-signed copy of the approved deliverable, as the verifier is given it (#2907's document chain).
91
+ *
92
+ * The chain is: the frozen original the seal binds → its manifested copy (this seal's approval page appended), and the
93
+ * same original → each vendor-signed copy (the vendor's signature appended as an incremental update, which the request's
94
+ * PAdES validation required: its signed revision starts with exactly the bytes sent). So a vendor-signed copy is tied to
95
+ * the approval by its FIRST REVISION: a prefix of the copy, ending at a `%%EOF` marker, must open the seal's commitment to
96
+ * the original (`approvalSealFileCommitmentOf(salt, sha256(prefix))`). That needs the disclosed presentation and the
97
+ * deliverable's salt, exactly like the deliverable itself.
98
+ *
99
+ * What this does NOT check: the vendor's signature over the copy. That was validated at receipt by the engine (chain to the
100
+ * vendor's pinned anchors, revocation data, byte range), and its evidence is the request's `validationEvidence` file. The
101
+ * offline verifier answers the question the seal can answer: does this copy start with the approved file. Whether what
102
+ * follows is the vendor's validated signature is the HOST's record, which is why a copy the host recorded (named, with
103
+ * the hash its row kept, and these bytes) is reported apart from one the host does not record (`recordedByHost`).
104
+ */
105
+ export interface ApprovalSealVendorSignedCopyInput {
106
+ /** The copy's file id, as the host names it. */
107
+ readonly fileId?: string;
108
+ /** The file the host's row says this copy was derived from. When it is not the deliverable the seal binds, it is refused. */
109
+ readonly derivedFromFileId?: string;
110
+ /** The copy's SHA-256 as its file row recorded it: given bytes that do not hash to it are refused. */
111
+ readonly contentSha256?: string;
112
+ readonly bytes?: Uint8Array;
113
+ }
82
114
  /** What corroborated a seal under a compromised key. */
83
115
  export declare enum ApprovalSealCorroborationSource {
84
116
  /** The decision's payload digest, recorded outside the application before the compromise. */
@@ -115,7 +147,13 @@ export declare enum ApprovalSealVerificationFailure {
115
147
  * A manifested copy was given and is not this seal's (#2907): its approval page, its attached JWS or its page tree is
116
148
  * not what the seal rebuilds, or what precedes them is not the file the seal binds.
117
149
  */
118
- MANIFESTED_COPY_MISMATCH = "manifested_copy_mismatch"
150
+ MANIFESTED_COPY_MISMATCH = "manifested_copy_mismatch",
151
+ /**
152
+ * A vendor-signed copy was given or named and is not derived from the file this seal binds (#2907): no prefix of it
153
+ * ending at a `%%EOF` is the approved file, its bytes are not the ones its row recorded, or the host states it was
154
+ * derived from another file.
155
+ */
156
+ VENDOR_SIGNED_COPY_MISMATCH = "vendor_signed_copy_mismatch"
119
157
  }
120
158
  /** What the seal says about the file deliverable it attests (#2904). */
121
159
  export declare enum ApprovalSealDeliverableFileStanding {
@@ -135,7 +173,12 @@ export declare enum ApprovalSealDeliverableFileStanding {
135
173
  * name in clear and a file cannot be scrubbed, so it went; the seal and the original still prove the approval, and the
136
174
  * copy can be rebuilt from both should the name ever lawfully be needed again.
137
175
  */
138
- CONTENT_ERASED = "content_erased"
176
+ CONTENT_ERASED = "content_erased",
177
+ /**
178
+ * A vendor-signed copy (#2907) only: the host's own row says it was derived from another file than the one this seal
179
+ * binds. The copy belongs to another original, whatever its bytes; the seal does not verify with it.
180
+ */
181
+ DERIVED_FROM_ANOTHER_FILE = "derived_from_another_file"
139
182
  }
140
183
  /**
141
184
  * What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they
@@ -212,6 +255,28 @@ export interface ApprovalSealVerification {
212
255
  readonly locale?: string;
213
256
  readonly verificationUrl?: string;
214
257
  };
258
+ /**
259
+ * Each vendor-signed copy named or given (#2907), in the order given: MATCHES (its first revision is the file the seal
260
+ * binds, `derivesFromFileId` naming it, `originalLength` where it ends), CHANGED, DERIVED_FROM_ANOTHER_FILE, NOT_GIVEN
261
+ * or NOT_COMMITTED (the presentation or the deliverable's salt is not disclosed, so there is nothing to tie it to).
262
+ */
263
+ readonly vendorSignedCopies?: ReadonlyArray<{
264
+ readonly fileId?: string;
265
+ readonly standing: ApprovalSealDeliverableFileStanding;
266
+ /** The approved original this copy derives from: the deliverable the seal binds, when the copy MATCHES it. */
267
+ readonly derivesFromFileId?: string;
268
+ /** The original's length in bytes: what follows it is what the vendor appended. */
269
+ readonly originalLength?: number;
270
+ /** What the host stated the copy derives from, when that is another file. */
271
+ readonly statedDerivedFromFileId?: string;
272
+ /**
273
+ * On MATCHES: whether the host RECORDS this exact copy (it named the copy and the bytes are the ones its file row
274
+ * hashed), so the copy is the signed document a request validated at receipt. False for a copy the host names
275
+ * without a recorded hash, or does not name: its first revision is the approved file, and nothing here says what
276
+ * follows it is a vendor's signature.
277
+ */
278
+ readonly recordedByHost?: boolean;
279
+ }>;
215
280
  /**
216
281
  * Whether the approval is still current over its record (#2914), when the record was given: CURRENT,
217
282
  * NO_LONGER_CURRENT (never a failure), SUBJECT_GONE, or NO_SEALED_FIELD_SET when the presentation is not disclosed or
@@ -285,6 +350,11 @@ export declare const ApprovalSealVerificationBundleSchema: z.ZodObject<{
285
350
  contentSha256: z.ZodOptional<z.ZodString>;
286
351
  contentErased: z.ZodOptional<z.ZodLiteral<true>>;
287
352
  }, z.core.$strip>>;
353
+ vendorSignedCopies: z.ZodOptional<z.ZodArray<z.ZodObject<{
354
+ fileId: z.ZodString;
355
+ derivedFromFileId: z.ZodOptional<z.ZodString>;
356
+ contentSha256: z.ZodOptional<z.ZodString>;
357
+ }, z.core.$strip>>>;
288
358
  }, z.core.$strip>;
289
359
  export type ApprovalSealVerificationBundle = z.infer<typeof ApprovalSealVerificationBundleSchema>;
290
360
  //# sourceMappingURL=approval-seal-verifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval-seal-verifier.d.ts","sourceRoot":"","sources":["../../../src/key-management/approval-seal-verifier.ts"],"names":[],"mappings":"AA+CA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAmF,KAAK,qCAAqC,EAAqB,eAAe,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtP,OAAO,EAAE,mBAAmB,EAAgC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAIpG,OAAO,EAEL,2BAA2B,EAG3B,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAAC;AAQnC,8GAA8G;AAC9G,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,kFAAkF;IAClF,QAAQ,CAAC,GAAG,EAAE,OAAO,mBAAmB,CAAC;IACzC,QAAQ,CA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,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,mCAAmC,CAAC;QACvD,8GAA8G;QAC9G,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QACpC,mFAAmF;QACnF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QACjC,6EAA6E;QAC7E,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;QAC1C;;;;;WAKG;QACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;KACnC,CAAC,CAAC;IACH;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,qCAAqC,CAAC;CACxE;AA8MD,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,6BAA6B,GAAG,wBAAwB,CA+EjG;AAED,qHAAqH;AACrH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;iBAA8B,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,+BAA+B;;;iBAAwF,CAAC;AAErI;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6B/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
@@ -95,6 +95,12 @@ export var ApprovalSealVerificationFailure;
95
95
  * not what the seal rebuilds, or what precedes them is not the file the seal binds.
96
96
  */
97
97
  ApprovalSealVerificationFailure["MANIFESTED_COPY_MISMATCH"] = "manifested_copy_mismatch";
98
+ /**
99
+ * A vendor-signed copy was given or named and is not derived from the file this seal binds (#2907): no prefix of it
100
+ * ending at a `%%EOF` is the approved file, its bytes are not the ones its row recorded, or the host states it was
101
+ * derived from another file.
102
+ */
103
+ ApprovalSealVerificationFailure["VENDOR_SIGNED_COPY_MISMATCH"] = "vendor_signed_copy_mismatch";
98
104
  })(ApprovalSealVerificationFailure || (ApprovalSealVerificationFailure = {}));
99
105
  /** What the seal says about the file deliverable it attests (#2904). */
100
106
  export var ApprovalSealDeliverableFileStanding;
@@ -116,6 +122,11 @@ export var ApprovalSealDeliverableFileStanding;
116
122
  * copy can be rebuilt from both should the name ever lawfully be needed again.
117
123
  */
118
124
  ApprovalSealDeliverableFileStanding["CONTENT_ERASED"] = "content_erased";
125
+ /**
126
+ * A vendor-signed copy (#2907) only: the host's own row says it was derived from another file than the one this seal
127
+ * binds. The copy belongs to another original, whatever its bytes; the seal does not verify with it.
128
+ */
129
+ ApprovalSealDeliverableFileStanding["DERIVED_FROM_ANOTHER_FILE"] = "derived_from_another_file";
119
130
  })(ApprovalSealDeliverableFileStanding || (ApprovalSealDeliverableFileStanding = {}));
120
131
  /**
121
132
  * What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they
@@ -214,6 +225,85 @@ function manifestedCopyStandingOf(input, approver, presentation, failures) {
214
225
  }
215
226
  return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, ...printed, ...stated };
216
227
  }
228
+ /**
229
+ * The lengths at which a PDF's revisions end: just past each `%%EOF` marker, and past its end-of-line when one follows
230
+ * (a file may end either way), ascending. An incremental update appends after one of them, so the original a later
231
+ * revision was appended to is one of these prefixes. Read as Latin-1, so a byte offset in the text is a byte offset in
232
+ * the file.
233
+ */
234
+ function pdfRevisionEndsOf(bytes) {
235
+ const text = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('latin1');
236
+ const ends = [];
237
+ for (let index = text.indexOf('%%EOF'); index >= 0; index = text.indexOf('%%EOF', index + 1)) {
238
+ const end = index + 5;
239
+ ends.push(end);
240
+ if (text[end] === '\r' && text[end + 1] === '\n')
241
+ ends.push(end + 2);
242
+ else if (text[end] === '\n' || text[end] === '\r')
243
+ ends.push(end + 1);
244
+ }
245
+ return ends;
246
+ }
247
+ /**
248
+ * The first revision end at which the prefix's SHA-256 satisfies `opens`, or undefined. Hashed INCREMENTALLY, one
249
+ * running digest extended from one candidate end to the next and copied to read it, so a file carrying many `%%EOF`
250
+ * markers costs one pass over its bytes rather than one per marker.
251
+ */
252
+ function firstPrefixOpening(bytes, opens) {
253
+ const running = createHash('sha256');
254
+ let hashedTo = 0;
255
+ for (const end of pdfRevisionEndsOf(bytes)) {
256
+ running.update(bytes.subarray(hashedTo, end));
257
+ hashedTo = end;
258
+ if (opens(running.copy().digest('hex')))
259
+ return end;
260
+ }
261
+ return undefined;
262
+ }
263
+ /**
264
+ * Each vendor-signed copy against the seal (#2907's document chain): its first revision opened against the commitment the
265
+ * disclosed presentation binds the deliverable by. See {@link ApprovalSealVendorSignedCopyInput}. A copy the host states
266
+ * was derived from another file, one whose bytes are not its recorded hash, or one with no prefix that is the approved
267
+ * file, is a failure.
268
+ */
269
+ function vendorSignedCopyStandingsOf(input, presentation, failures) {
270
+ const copies = input.vendorSignedCopies;
271
+ if (!copies || copies.length === 0)
272
+ return undefined;
273
+ const deliverable = input.deliverableFile;
274
+ const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED
275
+ ? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)
276
+ : undefined;
277
+ let mismatched = false;
278
+ const standings = copies.map((copy) => {
279
+ const named = copy.fileId ? { fileId: copy.fileId } : {};
280
+ // The host's own row names another original: the copy is not this approval's, whatever its bytes (refused before they
281
+ // are read, so a copy built to open the commitment cannot pass under another file's lineage either).
282
+ if (deliverable && copy.derivedFromFileId !== undefined && copy.derivedFromFileId !== deliverable.fileId) {
283
+ mismatched = true;
284
+ return { ...named, standing: ApprovalSealDeliverableFileStanding.DERIVED_FROM_ANOTHER_FILE, statedDerivedFromFileId: copy.derivedFromFileId };
285
+ }
286
+ if (!copy.bytes)
287
+ return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };
288
+ if (copy.contentSha256 !== undefined && createHash('sha256').update(copy.bytes).digest('hex') !== copy.contentSha256) {
289
+ mismatched = true;
290
+ return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };
291
+ }
292
+ if (!deliverable || !bound)
293
+ return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };
294
+ const originalLength = firstPrefixOpening(copy.bytes, (prefixSha256) => approvalSealFileCommitmentOf(deliverable.salt, prefixSha256) === bound.commitment);
295
+ if (originalLength === undefined) {
296
+ mismatched = true;
297
+ return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };
298
+ }
299
+ // `contentSha256` was compared with these bytes above, so a named copy carrying one is the copy the host recorded.
300
+ const recordedByHost = copy.fileId !== undefined && copy.contentSha256 !== undefined;
301
+ return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, derivesFromFileId: deliverable.fileId, originalLength, recordedByHost };
302
+ });
303
+ if (mismatched)
304
+ failures.push(ApprovalSealVerificationFailure.VENDOR_SIGNED_COPY_MISMATCH);
305
+ return standings;
306
+ }
217
307
  /**
218
308
  * What corroborates a seal under a compromised key, if anything: evidence of its payload recorded before the compromise,
219
309
  * or a kept export signed before the compromise that lists this exact seal (its issuer, its key, its signed claims).
@@ -297,6 +387,7 @@ export function verifyApprovalSeal(input) {
297
387
  const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);
298
388
  const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);
299
389
  const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);
390
+ const vendorSignedCopies = vendorSignedCopyStandingsOf(input, presentation, failures);
300
391
  // #2914: never a failure; the presentation counts only when it opened its commitment.
301
392
  const subjectRecordCurrency = input.subjectRecord !== undefined
302
393
  ? approvalSealSubjectCurrencyOf(presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? presentation.value : undefined, input.subjectRecord)
@@ -324,6 +415,7 @@ export function verifyApprovalSeal(input) {
324
415
  ...(statement ? { statement } : {}),
325
416
  ...(deliverableFile ? { deliverableFile } : {}),
326
417
  ...(manifestedCopy ? { manifestedCopy } : {}),
418
+ ...(vendorSignedCopies ? { vendorSignedCopies } : {}),
327
419
  ...(subjectRecordCurrency ? { subjectRecordCurrency } : {}),
328
420
  };
329
421
  }
@@ -360,5 +452,15 @@ export const ApprovalSealVerificationBundleSchema = z.object({
360
452
  manifestedCopy: z.object({ fileId: z.string().min(1).optional(), contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(), contentErased: z.literal(true).optional() })
361
453
  .refine((copy) => (copy.fileId === undefined) !== (copy.contentErased === undefined), { message: 'A manifested copy is named by its file id, or stated erased: exactly one of the two' })
362
454
  .optional(),
455
+ /**
456
+ * The document chain's other branch (#2907): the copies an electronic-signature vendor returned of the deliverable, each
457
+ * with the file its row says it was derived from and the hash its row recorded. Never their bytes, which the verifier is
458
+ * given from the files themselves (`--vendor-signed-copy`).
459
+ */
460
+ vendorSignedCopies: z.array(z.object({
461
+ fileId: z.string().min(1),
462
+ derivedFromFileId: z.string().min(1).optional(),
463
+ contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(),
464
+ })).optional(),
363
465
  });
364
466
  //# sourceMappingURL=approval-seal-verifier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval-seal-verifier.js","sourceRoot":"","sources":["../../../src/key-management/approval-seal-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,eAAe,EAA8C,iBAAiB,EAAE,eAAe,EAAE,sBAAsB,EAAwB,MAAM,uBAAuB,CAAC;AACtP,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAA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C,CAAC,CAAC,QAAQ,EAAE;IAChK,6HAA6H;IAC7H,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrE;;;OAGG;IACH,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5F;;;OAGG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;SACxK,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,qFAAqF,EAAE,CAAC;SACxL,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * # Verifying an approval seal, offline (#2903)\n *\n * Everything a verifier needs travels with the seal: the compact JWS, the stored records of the keys that may have signed\n * it (their public half, scope and issuer, as an export carries them), and, when the person's content is to be shown,\n * the disclosures. Nothing here calls the application or the platform, so a seal verifies after the application is gone.\n *\n * ## What is checked, and on whose authority\n *\n * - The header: ES256 is pinned per key from the key RECORD, never read from the header (RFC 8725 §3.1); `jku`, `x5u`,\n * `jwk` and `x5c` are never followed (RFC 8725 §3.10, RFC 7515 §10.7); a `crit` naming anything is refused, since no\n * extension is understood (RFC 7515 §4.1.11); `typ` must be the approval seal's.\n * - The signature, under the key the `kid` names among those given.\n * - The issuer: the payload's `iss` must be the key record's, and the expected issuer when one is given.\n * - The claims: the version-1 shape, strict.\n * - The key's scope, from its stored record and never from a JWKS member: an organization-scoped key verifies only a seal\n * whose tenant is that organization.\n * - The disclosures: each must digest to the commitment its claim names; a commitment with no disclosure is reported as\n * erased (the person's content was removed, the seal stands).\n * - A FILE deliverable (#2904), when the seal attests one: the file's bytes, hashed and salted with the salt its row\n * kept, must give the commitment the disclosed presentation binds it by. One changed byte fails the seal; bytes not\n * given are reported as such (a missing file), never as a match.\n * - A MANIFESTED COPY (#2907), when the seal's deliverable has one: the copy is rebuilt from its own prefix, the JWS, the\n * inputs it carries (its words, its pinned font, its verification address) and the disclosed approver's printed name,\n * and must equal the bytes given, and the host's record of its hash when the bundle states one; its prefix must then open the seal's commitment\n * to the approved file, which ties the copy to the original without the original being supplied. One changed byte in\n * the approval page fails the seal. A copy the approver's erasure deleted is reported CONTENT_ERASED, never missing.\n * - The CURRENCY of the approval over its record (#2914), when the record as it is now is given: the values of the fields\n * the approval covers, as the disclosed presentation carries them, compared with the record. A record changed since is\n * NOT a failure: the seal still proves what was approved; it is reported NO_LONGER_CURRENT. Without the presentation\n * disclosed there is nothing to compare, and it is reported as having no sealed field set, never as current.\n * - A COMPROMISED key: the signature may still verify, but the seal is not PROVABLE unless corroborated by evidence the\n * key's holder could not have forged: the decision's payload digest recorded outside the application before the\n * compromise instant (an exported audit event, an immutable sink).\n * - The OPERATOR'S PIN SET, when one is given (#2932): the key must be pinned, by the RFC 7638 thumbprint of the public\n * half the verifier was handed (so a key record that names a pinned `kid` over another key is refused), and the pin's\n * state, scope and compromise instant are used instead of the record's. The record (from a bundle, from the host)\n * only supplies the public half and the issuer; the operator's pin decides whether that half is theirs and what became\n * of it. Without a pin set the records are trusted as given, as before.\n * - The OPERATOR'S KEPT SIGNING-LOG EXPORTS, when given (#2932): a seal under a key compromised after an export that lists\n * it is corroborated by that export, which the host could not have signed after the compromise without the operator's\n * copy disagreeing. Each export is verified here, with the operator's pin set for the export key.\n *\n * spec-cite: RFC 8725 §3.1 (algorithm verification), §3.10 (do not trust received URLs); RFC 7515 §4.1.11 (`crit`),\n * §10.7 (key selection from header parameters). Cited by section; the behaviour is this file's decision.\n */\nimport { createHash } from 'node:crypto';\nimport { z } from 'zod';\nimport { approvalSealSubjectCurrencyOf, humanDecisionBoundDeliverableOf, singleJwsTypeOf, type ApprovalSealSubjectCurrencyAssessment, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';\nimport { ES256_JWS_ALGORITHM, isP256PublicJwk, verifyEs256, type P256PublicJwk } from './es256-jws';\nimport { decisionPayloadDigestOf, sealClaimsDigestOf } from './signature-request.contracts';\nimport { VerificationKeyRecordSchema, compareSigningLogExports, pinnedVerificationKeyOf, verifySigningLogExport } from './signing-log-export.contracts';\nimport { checkApprovalSealManifestedCopy } from './approval-seal-manifested-copy';\nimport {\n ApprovalSealClaimsV1Schema,\n ApprovalSealDisclosureClaim,\n approvalSealDisclosureDigestOf,\n approvalSealFileCommitmentOf,\n type ApprovalSealClaimsV1,\n type ApprovalSealDisclosureValue,\n} from './approval-seal.contracts';\n\n/** The approval seal's JWS `typ`. */\nconst APPROVAL_SEAL_TYP = singleJwsTypeOf(CryptoKey_Purpose.APPROVAL_SEAL);\n\n/** The payload members the custodian sets; the rest is the decision's committed payload. */\nconst CUSTODIAN_SET_CLAIMS = ['iss', 'iat', 'lateSeal'] as const;\n\n/** One key that may have signed a seal: its STORED record (scope, issuer, state), as an export carries it. */\nexport interface ApprovalSealVerificationKey {\n readonly kid: string;\n readonly publicJwk: P256PublicJwk;\n /** The algorithm the key record pins. ES256 for every approval-seal key today. */\n readonly alg: typeof ES256_JWS_ALGORITHM;\n readonly scope: CryptoKey_Scope;\n /** The application's id for an APPLICATION key, the organization's for an ORGANIZATION key. */\n readonly scopeId: string;\n readonly iss: string;\n readonly state: CryptoKey_VersionState;\n /** ISO 8601, for a COMPROMISED key: the earliest instant its private half may have been exposed. */\n readonly compromiseInstant?: string;\n}\n\n/** Evidence recorded OUTSIDE the application that the decision's payload existed before a key's compromise. */\nexport interface ApprovalSealCorroboration {\n readonly decisionPayloadDigest: string;\n /** ISO 8601: when the evidence was recorded where the key's holder could not rewrite it. */\n readonly recordedAt: string;\n}\n\nexport interface ApprovalSealVerificationInput {\n readonly jws: string;\n readonly keys: readonly ApprovalSealVerificationKey[];\n /** The issuer the seal must carry, when the verifier knows which application it expects. */\n readonly expectedIssuer?: string;\n readonly disclosures?: readonly ApprovalSealDisclosureValue[];\n /**\n * The committed claims whose content the host no longer holds because an ERASURE removed it (#2924): the approver's\n * own erasure, or a later erasure of the requester or of a person the presentation named (#3001). The host's\n * statement, read as a reason and never as proof: a claim it names and does not give reads ERASED, one it neither\n * names nor gives reads WITHHELD, and either way the seal stands.\n */\n readonly erasedClaims?: readonly ApprovalSealDisclosureClaim[];\n readonly corroboration?: ApprovalSealCorroboration;\n /**\n * The file deliverable the seal attests (#2904): its id and the salt the seal's row kept (a bundle carries both), and\n * the file's BYTES, which the verifier is given by whoever holds the file (`wildo seal verify --deliverable`). Without\n * the bytes the file is reported NOT_GIVEN.\n */\n readonly deliverableFile?: { readonly fileId: string; readonly salt: string; readonly bytes?: Uint8Array };\n /**\n * The manifested copy of that deliverable (#2907): its id as the host names it, or the host's statement that the\n * approver's erasure deleted it (`contentErased`, read as a reason, never as proof), and the copy's BYTES from whoever\n * holds the file (`wildo seal verify --manifested-copy`). Checking it needs the approver disclosed (the copy prints\n * their name) and, to tie it to the approved file, the presentation and `deliverableFile`'s salt. `contentSha256` is\n * the host's record of the copy's hash: it binds what the rebuild takes from the copy itself (its words, its\n * verification address), so a copy reworded since does not verify.\n */\n readonly manifestedCopy?: { readonly fileId?: string; readonly contentSha256?: string; readonly contentErased?: boolean; readonly bytes?: Uint8Array };\n /**\n * The record the approval is about, as it is NOW (#2914): its fields as an export of the record states them, or null\n * for a record that is gone. Compared with the sealed field set the disclosed presentation carries\n * (`wildo seal verify --subject-record`).\n */\n readonly subjectRecord?: Readonly<Record<string, unknown>> | null;\n /** The operator's pin set for approval seals (#2932), from a channel the host does not control. */\n readonly pins?: CryptoKeyPinSet;\n /**\n * The signing-log exports the operator kept (#2932), with the records of the keys that signed them and the operator's\n * pin set for SIGNING_LOG_EXPORT. An export that does not verify, or was signed after its own key's compromise, is\n * ignored: it corroborates nothing.\n */\n readonly signingLogExports?: {\n readonly exports: readonly string[];\n readonly keys: readonly ApprovalSealVerificationKey[];\n readonly pins?: CryptoKeyPinSet;\n };\n}\n\n/** What corroborated a seal under a compromised key. */\nexport enum ApprovalSealCorroborationSource {\n /** The decision's payload digest, recorded outside the application before the compromise. */\n RECORDED_EVIDENCE = 'recorded_evidence',\n /** A signing-log export the operator kept, signed before the compromise, lists the seal. */\n SIGNING_LOG_EXPORT = 'signing_log_export',\n}\n\n/** Why a seal does not verify. */\nexport enum ApprovalSealVerificationFailure {\n /** Not a compact JWS with a JSON header and payload. */\n MALFORMED = 'malformed',\n /** The header's `alg` is not the one the key record pins. */\n ALGORITHM_NOT_PINNED = 'algorithm_not_pinned',\n /** The header names a critical extension, and none is understood. */\n CRITICAL_EXTENSION = 'critical_extension',\n /** The header's `typ` is not the approval seal's. */\n TYPE_MISMATCH = 'type_mismatch',\n /** No given key has the header's `kid`. */\n UNKNOWN_KEY = 'unknown_key',\n SIGNATURE_INVALID = 'signature_invalid',\n /** The payload's issuer is not the key record's, or not the expected one. */\n ISSUER_MISMATCH = 'issuer_mismatch',\n /** The payload is not the version-1 claims shape. */\n CLAIMS_INVALID = 'claims_invalid',\n /** The key's stored scope does not cover the seal's tenant (or is not a scope a seal is signed under). */\n TENANT_OUTSIDE_KEY_SCOPE = 'tenant_outside_key_scope',\n /** A disclosure does not digest to the commitment its claim names. */\n DISCLOSURE_MISMATCH = 'disclosure_mismatch',\n /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */\n UNPINNED = 'unpinned',\n /** A file deliverable's bytes were given and are not the ones the seal binds (#2904). */\n DELIVERABLE_FILE_MISMATCH = 'deliverable_file_mismatch',\n /**\n * A manifested copy was given and is not this seal's (#2907): its approval page, its attached JWS or its page tree is\n * not what the seal rebuilds, or what precedes them is not the file the seal binds.\n */\n MANIFESTED_COPY_MISMATCH = 'manifested_copy_mismatch',\n}\n\n/** What the seal says about the file deliverable it attests (#2904). */\nexport enum ApprovalSealDeliverableFileStanding {\n /** The bytes given hash, with the row's salt, to the commitment the presentation binds: the file approved. */\n MATCHES = 'matches',\n /** The bytes given are not the file approved: one changed byte is enough. The seal does not verify. */\n CHANGED = 'changed',\n /** The seal binds the file and its bytes were not given: the file is missing, or was not supplied. */\n NOT_GIVEN = 'not_given',\n /**\n * Nothing to compare with: the presentation that holds the commitment is not disclosed (erased with a person it\n * named, or withheld), or it binds no such file.\n */\n NOT_COMMITTED = 'not_committed',\n /**\n * A manifested copy (#2907) only: the host states the approver's erasure deleted it. The copy printed the approver's\n * name in clear and a file cannot be scrubbed, so it went; the seal and the original still prove the approval, and the\n * copy can be rebuilt from both should the name ever lawfully be needed again.\n */\n CONTENT_ERASED = 'content_erased',\n}\n\n/**\n * What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they\n * answered. In none of the three is the seal failed: the signature covers the commitments, never the content (#2924).\n */\nexport enum ApprovalSealDisclosureStanding {\n /** Given, and it digests to the commitment. */\n DISCLOSED = 'disclosed',\n /**\n * Committed to, not given, and the bundle states an erasure removed it (`erasedClaims`): UNDISCLOSED (erased). For the\n * presentation this is PRESENTATION_ERASED: an erasure rewrote the stored presentation, and the seal still proves that\n * a presentation with this digest was shown.\n */\n ERASED = 'erased',\n /** Committed to, and not given, with no erasure stated: withheld, or a bundle that does not carry it. */\n WITHHELD = 'withheld',\n}\n\nexport interface ApprovalSealVerification {\n /** The signature verifies, under a key whose record covers the seal, over well-formed claims and matching disclosures. */\n readonly valid: boolean;\n readonly failures: readonly ApprovalSealVerificationFailure[];\n /**\n * The seal proves what it says: valid, and its key not compromised, or corroborated before the compromise. A valid seal\n * under a compromised key, uncorroborated, is reported valid and NOT provable.\n */\n readonly provable: boolean;\n /** For a seal under a compromised key, what corroborated it; absent when nothing did (or nothing needed to). */\n readonly corroboratedBy?: ApprovalSealCorroborationSource;\n readonly kid?: string;\n readonly keyState?: CryptoKey_VersionState;\n readonly claims?: ApprovalSealClaimsV1;\n readonly iss?: string;\n /** The signing instant, epoch seconds. */\n readonly iat?: number;\n readonly lateSeal?: boolean;\n /** Seconds between the decision and its signature: what the database held at signing is what is sealed. */\n readonly signingWindowSeconds?: number;\n /** The digest of the decision's committed payload, to compare with the RESOLVED row of an exported trail. */\n readonly decisionPayloadDigest?: string;\n readonly approver?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n readonly requester?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person was shown (#2903 S6), when the seal binds it: DISCLOSED, ERASED (PRESENTATION_ERASED) or WITHHELD. */\n readonly presentation?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person answered, when the seal binds it. */\n readonly statement?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** The file deliverable the seal attests, checked against its bytes (#2904), when one was named. */\n readonly deliverableFile?: { readonly fileId: string; readonly argument?: string; readonly standing: ApprovalSealDeliverableFileStanding };\n /**\n * The manifested copy (#2907), when one was named: MATCHES (the original the seal binds, followed by exactly this seal's\n * approval page naming the disclosed approver), CHANGED, NOT_GIVEN, NOT_COMMITTED (the approver or the commitment is\n * not disclosed, so there is nothing to rebuild or tie it to) or CONTENT_ERASED. `approverName` is the name it prints.\n */\n readonly manifestedCopy?: {\n readonly fileId?: string;\n readonly standing: ApprovalSealDeliverableFileStanding;\n readonly approverName?: string;\n /** What the copy states it was made with, when it rebuilt: its words' language, its verification address. */\n readonly locale?: string;\n readonly verificationUrl?: string;\n };\n /**\n * Whether the approval is still current over its record (#2914), when the record was given: CURRENT,\n * NO_LONGER_CURRENT (never a failure), SUBJECT_GONE, or NO_SEALED_FIELD_SET when the presentation is not disclosed or\n * covers no record field.\n */\n readonly subjectRecordCurrency?: ApprovalSealSubjectCurrencyAssessment;\n}\n\nfunction decodeJson(part: string | undefined): Record<string, unknown> | null {\n if (!part) return null;\n try {\n const value: unknown = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : null;\n } catch {\n return null;\n }\n}\n\nfunction disclosureStanding(\n claimName: ApprovalSealDisclosureClaim,\n commitment: string | undefined,\n disclosures: readonly ApprovalSealDisclosureValue[],\n erasedClaims: readonly ApprovalSealDisclosureClaim[],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['approver'] {\n if (!commitment) return undefined;\n const given = disclosures.filter((disclosure) => disclosure.claimName === claimName);\n if (given.length === 0) {\n return { standing: erasedClaims.includes(claimName) ? ApprovalSealDisclosureStanding.ERASED : ApprovalSealDisclosureStanding.WITHHELD };\n }\n const matching = given.find((disclosure) => approvalSealDisclosureDigestOf(disclosure) === commitment);\n if (!matching) {\n // A disclosure that does not open its commitment is not the content: the seal fails, and nothing was disclosed.\n failures.push(ApprovalSealVerificationFailure.DISCLOSURE_MISMATCH);\n return { standing: ApprovalSealDisclosureStanding.WITHHELD };\n }\n return { standing: ApprovalSealDisclosureStanding.DISCLOSED, value: matching.value };\n}\n\n/**\n * The file deliverable against the commitment the disclosed presentation binds it by (#2904). A mismatch is a failure:\n * the seal does not attest those bytes.\n */\nfunction deliverableFileStandingOf(\n given: ApprovalSealVerificationInput['deliverableFile'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['deliverableFile'] {\n if (!given) return undefined;\n const bound = presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? humanDecisionBoundDeliverableOf(presentation.value, given.fileId) : undefined;\n if (!bound) return { fileId: given.fileId, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n if (!given.bytes) return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n const contentSha256 = createHash('sha256').update(given.bytes).digest('hex');\n if (approvalSealFileCommitmentOf(given.salt, contentSha256) === bound.commitment) {\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.MATCHES };\n }\n failures.push(ApprovalSealVerificationFailure.DELIVERABLE_FILE_MISMATCH);\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n}\n\n/**\n * The manifested copy against the seal (#2907): rebuilt and compared, then its prefix opened against the commitment the\n * disclosed presentation binds the deliverable by. A mismatch at either step is a failure.\n */\nfunction manifestedCopyStandingOf(\n input: ApprovalSealVerificationInput,\n approver: ApprovalSealVerification['approver'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['manifestedCopy'] {\n const given = input.manifestedCopy;\n if (!given) return undefined;\n const named = given.fileId ? { fileId: given.fileId } : {};\n if (!given.bytes) {\n return { ...named, standing: given.contentErased ? ApprovalSealDeliverableFileStanding.CONTENT_ERASED : ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n }\n if (approver?.standing !== ApprovalSealDisclosureStanding.DISCLOSED || !approver.value) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n const approverName = typeof approver.value.name === 'string' ? approver.value.name : undefined;\n const printed = approverName !== undefined ? { approverName } : {};\n const statedHash = given.contentSha256 === undefined || createHash('sha256').update(given.bytes).digest('hex') === given.contentSha256;\n const check = checkApprovalSealManifestedCopy(given.bytes, { jws: input.jws, ...printed });\n if (!check.matches || !statedHash) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n const deliverable = input.deliverableFile;\n const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED\n ? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)\n : undefined;\n const stated = { locale: check.statement.locale, ...(check.statement.verificationUrl ? { verificationUrl: check.statement.verificationUrl } : {}) };\n if (!deliverable || !bound) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED, ...printed, ...stated };\n if (approvalSealFileCommitmentOf(deliverable.salt, createHash('sha256').update(check.original).digest('hex')) !== bound.commitment) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, ...printed, ...stated };\n}\n\n/**\n * What corroborates a seal under a compromised key, if anything: evidence of its payload recorded before the compromise,\n * or a kept export signed before the compromise that lists this exact seal (its issuer, its key, its signed claims).\n */\nfunction corroborationOf(\n input: ApprovalSealVerificationInput,\n key: ApprovalSealVerificationKey,\n payload: Readonly<Record<string, unknown>>,\n decisionPayloadDigest: string,\n): ApprovalSealCorroborationSource | undefined {\n if (key.compromiseInstant === undefined) return undefined;\n const compromisedFrom = Date.parse(key.compromiseInstant);\n if (input.corroboration && input.corroboration.decisionPayloadDigest === decisionPayloadDigest && Date.parse(input.corroboration.recordedAt) < compromisedFrom) {\n return ApprovalSealCorroborationSource.RECORDED_EVIDENCE;\n }\n const logged = input.signingLogExports;\n if (!logged) return undefined;\n const claimsDigest = sealClaimsDigestOf(payload);\n const evidence = logged.exports.flatMap((jws) => {\n const exported = verifySigningLogExport({ jws, keys: logged.keys, ...(logged.pins ? { pins: logged.pins } : {}), expectedIssuer: key.iss });\n return exported.provable && exported.claims ? [exported.claims] : [];\n });\n // The exports must agree with each other first (#2932 review M3): an export is dated by the instant it states for\n // itself, so a host holding the export key could sign one dated before the compromise; it disagrees with the operator's\n // kept exports (a different hash at some sequence, or a head behind an earlier one), and then none of them corroborates.\n if (!compareSigningLogExports(evidence).consistent) return undefined;\n for (const claims of evidence) {\n if (claims.iat * 1000 >= compromisedFrom) continue;\n const lists = claims.entries.some((entry) =>\n entry.purpose === CryptoKey_Purpose.APPROVAL_SEAL && entry.kid === key.kid && entry.iss === key.iss && entry.claimsDigest === claimsDigest);\n if (lists) return ApprovalSealCorroborationSource.SIGNING_LOG_EXPORT;\n }\n return undefined;\n}\n\n/** See the file's header. Pure and offline. */\nexport function verifyApprovalSeal(input: ApprovalSealVerificationInput): ApprovalSealVerification {\n const failures: ApprovalSealVerificationFailure[] = [];\n const fail = (failure: ApprovalSealVerificationFailure, extra: Partial<ApprovalSealVerification> = {}): ApprovalSealVerification =>\n ({ valid: false, provable: false, failures: [...failures, failure], ...extra });\n\n const parts = input.jws.split('.');\n const header = parts.length === 3 ? decodeJson(parts[0]) : null;\n const payload = parts.length === 3 ? decodeJson(parts[1]) : null;\n if (!header || !payload || !parts[2]) return fail(ApprovalSealVerificationFailure.MALFORMED);\n\n const kid = typeof header.kid === 'string' ? header.kid : undefined;\n // The key is chosen by `kid` among the keys the verifier was GIVEN; `jku`/`x5u`/`jwk`/`x5c` are never read.\n const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;\n if (!record || !isP256PublicJwk(record.publicJwk)) return fail(ApprovalSealVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});\n // The operator's pin, when given: the key handed over must be the one the pinned thumbprint names, and the pin (not\n // the record) says what became of it.\n const key = pinnedVerificationKeyOf(record, input.pins);\n if (!key) return fail(ApprovalSealVerificationFailure.UNPINNED, { kid });\n if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM) return fail(ApprovalSealVerificationFailure.ALGORITHM_NOT_PINNED, { kid });\n if (header.crit !== undefined) return fail(ApprovalSealVerificationFailure.CRITICAL_EXTENSION, { kid });\n if (header.typ !== APPROVAL_SEAL_TYP) return fail(ApprovalSealVerificationFailure.TYPE_MISMATCH, { kid });\n if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {\n return fail(ApprovalSealVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });\n }\n\n const iss = typeof payload.iss === 'string' ? payload.iss : undefined;\n const iat = typeof payload.iat === 'number' ? payload.iat : undefined;\n const lateSeal = payload.lateSeal === true;\n if (!iss || iss !== key.iss || (input.expectedIssuer !== undefined && iss !== input.expectedIssuer)) failures.push(ApprovalSealVerificationFailure.ISSUER_MISMATCH);\n\n const committed = Object.fromEntries(Object.entries(payload).filter(([name]) => !(CUSTODIAN_SET_CLAIMS as readonly string[]).includes(name)));\n const parsed = ApprovalSealClaimsV1Schema.safeParse(committed);\n if (!parsed.success) return fail(ApprovalSealVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state, ...(iss ? { iss } : {}) });\n const claims = parsed.data;\n\n // The key's scope from its RECORD: an organization key covers only that organization's decisions.\n const scopeCovers = key.scope === CryptoKey_Scope.APPLICATION || (key.scope === CryptoKey_Scope.ORGANIZATION && claims.tenant === key.scopeId);\n if (!scopeCovers) failures.push(ApprovalSealVerificationFailure.TENANT_OUTSIDE_KEY_SCOPE);\n\n const disclosures = input.disclosures ?? [];\n const erased = input.erasedClaims ?? [];\n const approver = disclosureStanding(ApprovalSealDisclosureClaim.APPROVER, claims.approver, disclosures, erased, failures);\n const requester = disclosureStanding(ApprovalSealDisclosureClaim.REQUESTER, claims.requester?.disclosure, disclosures, erased, failures);\n const presentation = disclosureStanding(ApprovalSealDisclosureClaim.PRESENTATION, claims.presentation?.digest, disclosures, erased, failures);\n const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);\n const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);\n const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);\n // #2914: never a failure; the presentation counts only when it opened its commitment.\n const subjectRecordCurrency = input.subjectRecord !== undefined\n ? approvalSealSubjectCurrencyOf(presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? presentation.value : undefined, input.subjectRecord)\n : undefined;\n\n const decisionPayloadDigest = decisionPayloadDigestOf(committed);\n const valid = failures.length === 0;\n const compromised = key.state === CryptoKey_VersionState.COMPROMISED;\n const corroboratedBy = compromised ? corroborationOf(input, key, payload, decisionPayloadDigest) : undefined;\n const corroborated = !compromised || corroboratedBy !== undefined;\n return {\n valid,\n failures,\n provable: valid && corroborated,\n ...(corroboratedBy ? { corroboratedBy } : {}),\n kid,\n keyState: key.state,\n claims,\n iss,\n ...(iat !== undefined ? { iat, signingWindowSeconds: Math.max(0, iat - claims.decidedAt) } : {}),\n lateSeal,\n decisionPayloadDigest,\n ...(approver ? { approver } : {}),\n ...(requester ? { requester } : {}),\n ...(presentation ? { presentation } : {}),\n ...(statement ? { statement } : {}),\n ...(deliverableFile ? { deliverableFile } : {}),\n ...(manifestedCopy ? { manifestedCopy } : {}),\n ...(subjectRecordCurrency ? { subjectRecordCurrency } : {}),\n };\n}\n\n/** A verification key as an export or a CLI file states it (dates as ISO strings): the one shape of a key record. */\nexport const ApprovalSealVerificationKeySchema = VerificationKeyRecordSchema;\n\n/**\n * Evidence recorded outside the application that a decision's payload existed before a key's compromise, as the file an\n * operator keeps it in (`wildo seal verify --corroboration <file>`).\n */\nexport const ApprovalSealCorroborationSchema = z.object({ decisionPayloadDigest: z.string().min(1), recordedAt: z.string().min(1) });\n\n/**\n * What `wildo seal verify` reads: one seal and everything it needs to verify, offline. A bundle is what the HOST exports,\n * so it carries no pin set, no signing-log exports and no corroboration: each is evidence against the host, and reaches\n * the verifier only from the operator's own files (`ApprovalSealVerificationInput.pins` / `signingLogExports` /\n * `corroboration`). The schema is not strict, so a bundle naming any of them has it stripped on parse rather than\n * believed (#2932 review H1, R1).\n */\nexport const ApprovalSealVerificationBundleSchema = z.object({\n jws: z.string().min(1),\n keys: z.array(ApprovalSealVerificationKeySchema).min(1),\n expectedIssuer: z.string().min(1).optional(),\n disclosures: z.array(z.object({ claimName: z.enum(ApprovalSealDisclosureClaim), salt: z.string().min(1), value: z.record(z.string(), z.unknown()) })).optional(),\n /** The committed claims an erasure removed from the host's row (#2924): see `ApprovalSealVerificationInput.erasedClaims`. */\n erasedClaims: z.array(z.enum(ApprovalSealDisclosureClaim)).optional(),\n /**\n * The file deliverable the seal attests (#2904): its id and the salt its row kept. Never the bytes, which the verifier\n * is given from the file itself (`--deliverable`), and never the clear hash.\n */\n deliverableFile: z.object({ fileId: z.string().min(1), salt: z.string().min(1) }).optional(),\n /**\n * The deliverable's manifested copy (#2907): its file id, or `contentErased` when the approver's erasure deleted it.\n * Never its bytes, which the verifier is given from the file itself (`--manifested-copy`).\n */\n manifestedCopy: z.object({ fileId: z.string().min(1).optional(), contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(), contentErased: z.literal(true).optional() })\n .refine((copy) => (copy.fileId === undefined) !== (copy.contentErased === undefined), { message: 'A manifested copy is named by its file id, or stated erased: exactly one of the two' })\n .optional(),\n});\nexport type ApprovalSealVerificationBundle = z.infer<typeof ApprovalSealVerificationBundleSchema>;\n"]}
1
+ {"version":3,"file":"approval-seal-verifier.js","sourceRoot":"","sources":["../../../src/key-management/approval-seal-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,eAAe,EAA8C,iBAAiB,EAAE,eAAe,EAAE,sBAAsB,EAAwB,MAAM,uBAAuB,CAAC;AACtP,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AACpG,O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;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QAC/C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;KAC7D,CAAC,CAAC,CAAC,QAAQ,EAAE;CACf,CAAC,CAAC","sourcesContent":["/**\n * # Verifying an approval seal, offline (#2903)\n *\n * Everything a verifier needs travels with the seal: the compact JWS, the stored records of the keys that may have signed\n * it (their public half, scope and issuer, as an export carries them), and, when the person's content is to be shown,\n * the disclosures. Nothing here calls the application or the platform, so a seal verifies after the application is gone.\n *\n * ## What is checked, and on whose authority\n *\n * - The header: ES256 is pinned per key from the key RECORD, never read from the header (RFC 8725 §3.1); `jku`, `x5u`,\n * `jwk` and `x5c` are never followed (RFC 8725 §3.10, RFC 7515 §10.7); a `crit` naming anything is refused, since no\n * extension is understood (RFC 7515 §4.1.11); `typ` must be the approval seal's.\n * - The signature, under the key the `kid` names among those given.\n * - The issuer: the payload's `iss` must be the key record's, and the expected issuer when one is given.\n * - The claims: the version-1 shape, strict.\n * - The key's scope, from its stored record and never from a JWKS member: an organization-scoped key verifies only a seal\n * whose tenant is that organization.\n * - The disclosures: each must digest to the commitment its claim names; a commitment with no disclosure is reported as\n * erased (the person's content was removed, the seal stands).\n * - A FILE deliverable (#2904), when the seal attests one: the file's bytes, hashed and salted with the salt its row\n * kept, must give the commitment the disclosed presentation binds it by. One changed byte fails the seal; bytes not\n * given are reported as such (a missing file), never as a match.\n * - A MANIFESTED COPY (#2907), when the seal's deliverable has one: the copy is rebuilt from its own prefix, the JWS, the\n * inputs it carries (its words, its pinned font, its verification address) and the disclosed approver's printed name,\n * and must equal the bytes given, and the host's record of its hash when the bundle states one; its prefix must then open the seal's commitment\n * to the approved file, which ties the copy to the original without the original being supplied. One changed byte in\n * the approval page fails the seal. A copy the approver's erasure deleted is reported CONTENT_ERASED, never missing.\n * - The CURRENCY of the approval over its record (#2914), when the record as it is now is given: the values of the fields\n * the approval covers, as the disclosed presentation carries them, compared with the record. A record changed since is\n * NOT a failure: the seal still proves what was approved; it is reported NO_LONGER_CURRENT. Without the presentation\n * disclosed there is nothing to compare, and it is reported as having no sealed field set, never as current.\n * - A COMPROMISED key: the signature may still verify, but the seal is not PROVABLE unless corroborated by evidence the\n * key's holder could not have forged: the decision's payload digest recorded outside the application before the\n * compromise instant (an exported audit event, an immutable sink).\n * - The OPERATOR'S PIN SET, when one is given (#2932): the key must be pinned, by the RFC 7638 thumbprint of the public\n * half the verifier was handed (so a key record that names a pinned `kid` over another key is refused), and the pin's\n * state, scope and compromise instant are used instead of the record's. The record (from a bundle, from the host)\n * only supplies the public half and the issuer; the operator's pin decides whether that half is theirs and what became\n * of it. Without a pin set the records are trusted as given, as before.\n * - The OPERATOR'S KEPT SIGNING-LOG EXPORTS, when given (#2932): a seal under a key compromised after an export that lists\n * it is corroborated by that export, which the host could not have signed after the compromise without the operator's\n * copy disagreeing. Each export is verified here, with the operator's pin set for the export key.\n *\n * spec-cite: RFC 8725 §3.1 (algorithm verification), §3.10 (do not trust received URLs); RFC 7515 §4.1.11 (`crit`),\n * §10.7 (key selection from header parameters). Cited by section; the behaviour is this file's decision.\n */\nimport { createHash } from 'node:crypto';\nimport { z } from 'zod';\nimport { approvalSealSubjectCurrencyOf, humanDecisionBoundDeliverableOf, singleJwsTypeOf, type ApprovalSealSubjectCurrencyAssessment, CryptoKey_Purpose, CryptoKey_Scope, CryptoKey_VersionState, type CryptoKeyPinSet } from '@wildo-ai/saas-models';\nimport { ES256_JWS_ALGORITHM, isP256PublicJwk, verifyEs256, type P256PublicJwk } from './es256-jws';\nimport { decisionPayloadDigestOf, sealClaimsDigestOf } from './signature-request.contracts';\nimport { VerificationKeyRecordSchema, compareSigningLogExports, pinnedVerificationKeyOf, verifySigningLogExport } from './signing-log-export.contracts';\nimport { checkApprovalSealManifestedCopy } from './approval-seal-manifested-copy';\nimport {\n ApprovalSealClaimsV1Schema,\n ApprovalSealDisclosureClaim,\n approvalSealDisclosureDigestOf,\n approvalSealFileCommitmentOf,\n type ApprovalSealClaimsV1,\n type ApprovalSealDisclosureValue,\n} from './approval-seal.contracts';\n\n/** The approval seal's JWS `typ`. */\nconst APPROVAL_SEAL_TYP = singleJwsTypeOf(CryptoKey_Purpose.APPROVAL_SEAL);\n\n/** The payload members the custodian sets; the rest is the decision's committed payload. */\nconst CUSTODIAN_SET_CLAIMS = ['iss', 'iat', 'lateSeal'] as const;\n\n/** One key that may have signed a seal: its STORED record (scope, issuer, state), as an export carries it. */\nexport interface ApprovalSealVerificationKey {\n readonly kid: string;\n readonly publicJwk: P256PublicJwk;\n /** The algorithm the key record pins. ES256 for every approval-seal key today. */\n readonly alg: typeof ES256_JWS_ALGORITHM;\n readonly scope: CryptoKey_Scope;\n /** The application's id for an APPLICATION key, the organization's for an ORGANIZATION key. */\n readonly scopeId: string;\n readonly iss: string;\n readonly state: CryptoKey_VersionState;\n /** ISO 8601, for a COMPROMISED key: the earliest instant its private half may have been exposed. */\n readonly compromiseInstant?: string;\n}\n\n/** Evidence recorded OUTSIDE the application that the decision's payload existed before a key's compromise. */\nexport interface ApprovalSealCorroboration {\n readonly decisionPayloadDigest: string;\n /** ISO 8601: when the evidence was recorded where the key's holder could not rewrite it. */\n readonly recordedAt: string;\n}\n\nexport interface ApprovalSealVerificationInput {\n readonly jws: string;\n readonly keys: readonly ApprovalSealVerificationKey[];\n /** The issuer the seal must carry, when the verifier knows which application it expects. */\n readonly expectedIssuer?: string;\n readonly disclosures?: readonly ApprovalSealDisclosureValue[];\n /**\n * The committed claims whose content the host no longer holds because an ERASURE removed it (#2924): the approver's\n * own erasure, or a later erasure of the requester or of a person the presentation named (#3001). The host's\n * statement, read as a reason and never as proof: a claim it names and does not give reads ERASED, one it neither\n * names nor gives reads WITHHELD, and either way the seal stands.\n */\n readonly erasedClaims?: readonly ApprovalSealDisclosureClaim[];\n readonly corroboration?: ApprovalSealCorroboration;\n /**\n * The file deliverable the seal attests (#2904): its id and the salt the seal's row kept (a bundle carries both), and\n * the file's BYTES, which the verifier is given by whoever holds the file (`wildo seal verify --deliverable`). Without\n * the bytes the file is reported NOT_GIVEN.\n */\n readonly deliverableFile?: { readonly fileId: string; readonly salt: string; readonly bytes?: Uint8Array };\n /**\n * The manifested copy of that deliverable (#2907): its id as the host names it, or the host's statement that the\n * approver's erasure deleted it (`contentErased`, read as a reason, never as proof), and the copy's BYTES from whoever\n * holds the file (`wildo seal verify --manifested-copy`). Checking it needs the approver disclosed (the copy prints\n * their name) and, to tie it to the approved file, the presentation and `deliverableFile`'s salt. `contentSha256` is\n * the host's record of the copy's hash: it binds what the rebuild takes from the copy itself (its words, its\n * verification address), so a copy reworded since does not verify.\n */\n readonly manifestedCopy?: { readonly fileId?: string; readonly contentSha256?: string; readonly contentErased?: boolean; readonly bytes?: Uint8Array };\n /**\n * The copies an electronic-signature vendor returned of that deliverable (#2293, #2907): each derived from the approved\n * original as a `VENDOR_SIGNED_COPY`. The host names each one (`fileId`), states which file its row says it was derived\n * from (`derivedFromFileId`) and the hash its row recorded (`contentSha256`), all read as statements, never as proof;\n * whoever holds the file gives its BYTES (`wildo seal verify --vendor-signed-copy`). See {@link ApprovalSealVendorSignedCopyInput}.\n */\n readonly vendorSignedCopies?: readonly ApprovalSealVendorSignedCopyInput[];\n /**\n * The record the approval is about, as it is NOW (#2914): its fields as an export of the record states them, or null\n * for a record that is gone. Compared with the sealed field set the disclosed presentation carries\n * (`wildo seal verify --subject-record`).\n */\n readonly subjectRecord?: Readonly<Record<string, unknown>> | null;\n /** The operator's pin set for approval seals (#2932), from a channel the host does not control. */\n readonly pins?: CryptoKeyPinSet;\n /**\n * The signing-log exports the operator kept (#2932), with the records of the keys that signed them and the operator's\n * pin set for SIGNING_LOG_EXPORT. An export that does not verify, or was signed after its own key's compromise, is\n * ignored: it corroborates nothing.\n */\n readonly signingLogExports?: {\n readonly exports: readonly string[];\n readonly keys: readonly ApprovalSealVerificationKey[];\n readonly pins?: CryptoKeyPinSet;\n };\n}\n\n/**\n * One vendor-signed copy of the approved deliverable, as the verifier is given it (#2907's document chain).\n *\n * The chain is: the frozen original the seal binds → its manifested copy (this seal's approval page appended), and the\n * same original → each vendor-signed copy (the vendor's signature appended as an incremental update, which the request's\n * PAdES validation required: its signed revision starts with exactly the bytes sent). So a vendor-signed copy is tied to\n * the approval by its FIRST REVISION: a prefix of the copy, ending at a `%%EOF` marker, must open the seal's commitment to\n * the original (`approvalSealFileCommitmentOf(salt, sha256(prefix))`). That needs the disclosed presentation and the\n * deliverable's salt, exactly like the deliverable itself.\n *\n * What this does NOT check: the vendor's signature over the copy. That was validated at receipt by the engine (chain to the\n * vendor's pinned anchors, revocation data, byte range), and its evidence is the request's `validationEvidence` file. The\n * offline verifier answers the question the seal can answer: does this copy start with the approved file. Whether what\n * follows is the vendor's validated signature is the HOST's record, which is why a copy the host recorded (named, with\n * the hash its row kept, and these bytes) is reported apart from one the host does not record (`recordedByHost`).\n */\nexport interface ApprovalSealVendorSignedCopyInput {\n /** The copy's file id, as the host names it. */\n readonly fileId?: string;\n /** The file the host's row says this copy was derived from. When it is not the deliverable the seal binds, it is refused. */\n readonly derivedFromFileId?: string;\n /** The copy's SHA-256 as its file row recorded it: given bytes that do not hash to it are refused. */\n readonly contentSha256?: string;\n readonly bytes?: Uint8Array;\n}\n\n/** What corroborated a seal under a compromised key. */\nexport enum ApprovalSealCorroborationSource {\n /** The decision's payload digest, recorded outside the application before the compromise. */\n RECORDED_EVIDENCE = 'recorded_evidence',\n /** A signing-log export the operator kept, signed before the compromise, lists the seal. */\n SIGNING_LOG_EXPORT = 'signing_log_export',\n}\n\n/** Why a seal does not verify. */\nexport enum ApprovalSealVerificationFailure {\n /** Not a compact JWS with a JSON header and payload. */\n MALFORMED = 'malformed',\n /** The header's `alg` is not the one the key record pins. */\n ALGORITHM_NOT_PINNED = 'algorithm_not_pinned',\n /** The header names a critical extension, and none is understood. */\n CRITICAL_EXTENSION = 'critical_extension',\n /** The header's `typ` is not the approval seal's. */\n TYPE_MISMATCH = 'type_mismatch',\n /** No given key has the header's `kid`. */\n UNKNOWN_KEY = 'unknown_key',\n SIGNATURE_INVALID = 'signature_invalid',\n /** The payload's issuer is not the key record's, or not the expected one. */\n ISSUER_MISMATCH = 'issuer_mismatch',\n /** The payload is not the version-1 claims shape. */\n CLAIMS_INVALID = 'claims_invalid',\n /** The key's stored scope does not cover the seal's tenant (or is not a scope a seal is signed under). */\n TENANT_OUTSIDE_KEY_SCOPE = 'tenant_outside_key_scope',\n /** A disclosure does not digest to the commitment its claim names. */\n DISCLOSURE_MISMATCH = 'disclosure_mismatch',\n /** A pin set was given and does not pin the key, or the key handed over is not the one its pinned `kid` names. */\n UNPINNED = 'unpinned',\n /** A file deliverable's bytes were given and are not the ones the seal binds (#2904). */\n DELIVERABLE_FILE_MISMATCH = 'deliverable_file_mismatch',\n /**\n * A manifested copy was given and is not this seal's (#2907): its approval page, its attached JWS or its page tree is\n * not what the seal rebuilds, or what precedes them is not the file the seal binds.\n */\n MANIFESTED_COPY_MISMATCH = 'manifested_copy_mismatch',\n /**\n * A vendor-signed copy was given or named and is not derived from the file this seal binds (#2907): no prefix of it\n * ending at a `%%EOF` is the approved file, its bytes are not the ones its row recorded, or the host states it was\n * derived from another file.\n */\n VENDOR_SIGNED_COPY_MISMATCH = 'vendor_signed_copy_mismatch',\n}\n\n/** What the seal says about the file deliverable it attests (#2904). */\nexport enum ApprovalSealDeliverableFileStanding {\n /** The bytes given hash, with the row's salt, to the commitment the presentation binds: the file approved. */\n MATCHES = 'matches',\n /** The bytes given are not the file approved: one changed byte is enough. The seal does not verify. */\n CHANGED = 'changed',\n /** The seal binds the file and its bytes were not given: the file is missing, or was not supplied. */\n NOT_GIVEN = 'not_given',\n /**\n * Nothing to compare with: the presentation that holds the commitment is not disclosed (erased with a person it\n * named, or withheld), or it binds no such file.\n */\n NOT_COMMITTED = 'not_committed',\n /**\n * A manifested copy (#2907) only: the host states the approver's erasure deleted it. The copy printed the approver's\n * name in clear and a file cannot be scrubbed, so it went; the seal and the original still prove the approval, and the\n * copy can be rebuilt from both should the name ever lawfully be needed again.\n */\n CONTENT_ERASED = 'content_erased',\n /**\n * A vendor-signed copy (#2907) only: the host's own row says it was derived from another file than the one this seal\n * binds. The copy belongs to another original, whatever its bytes; the seal does not verify with it.\n */\n DERIVED_FROM_ANOTHER_FILE = 'derived_from_another_file',\n}\n\n/**\n * What the seal says about one committed disclosure: a person's (approver, requester), what they were shown, what they\n * answered. In none of the three is the seal failed: the signature covers the commitments, never the content (#2924).\n */\nexport enum ApprovalSealDisclosureStanding {\n /** Given, and it digests to the commitment. */\n DISCLOSED = 'disclosed',\n /**\n * Committed to, not given, and the bundle states an erasure removed it (`erasedClaims`): UNDISCLOSED (erased). For the\n * presentation this is PRESENTATION_ERASED: an erasure rewrote the stored presentation, and the seal still proves that\n * a presentation with this digest was shown.\n */\n ERASED = 'erased',\n /** Committed to, and not given, with no erasure stated: withheld, or a bundle that does not carry it. */\n WITHHELD = 'withheld',\n}\n\nexport interface ApprovalSealVerification {\n /** The signature verifies, under a key whose record covers the seal, over well-formed claims and matching disclosures. */\n readonly valid: boolean;\n readonly failures: readonly ApprovalSealVerificationFailure[];\n /**\n * The seal proves what it says: valid, and its key not compromised, or corroborated before the compromise. A valid seal\n * under a compromised key, uncorroborated, is reported valid and NOT provable.\n */\n readonly provable: boolean;\n /** For a seal under a compromised key, what corroborated it; absent when nothing did (or nothing needed to). */\n readonly corroboratedBy?: ApprovalSealCorroborationSource;\n readonly kid?: string;\n readonly keyState?: CryptoKey_VersionState;\n readonly claims?: ApprovalSealClaimsV1;\n readonly iss?: string;\n /** The signing instant, epoch seconds. */\n readonly iat?: number;\n readonly lateSeal?: boolean;\n /** Seconds between the decision and its signature: what the database held at signing is what is sealed. */\n readonly signingWindowSeconds?: number;\n /** The digest of the decision's committed payload, to compare with the RESOLVED row of an exported trail. */\n readonly decisionPayloadDigest?: string;\n readonly approver?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n readonly requester?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person was shown (#2903 S6), when the seal binds it: DISCLOSED, ERASED (PRESENTATION_ERASED) or WITHHELD. */\n readonly presentation?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** What the person answered, when the seal binds it. */\n readonly statement?: { readonly standing: ApprovalSealDisclosureStanding; readonly value?: Readonly<Record<string, unknown>> };\n /** The file deliverable the seal attests, checked against its bytes (#2904), when one was named. */\n readonly deliverableFile?: { readonly fileId: string; readonly argument?: string; readonly standing: ApprovalSealDeliverableFileStanding };\n /**\n * The manifested copy (#2907), when one was named: MATCHES (the original the seal binds, followed by exactly this seal's\n * approval page naming the disclosed approver), CHANGED, NOT_GIVEN, NOT_COMMITTED (the approver or the commitment is\n * not disclosed, so there is nothing to rebuild or tie it to) or CONTENT_ERASED. `approverName` is the name it prints.\n */\n readonly manifestedCopy?: {\n readonly fileId?: string;\n readonly standing: ApprovalSealDeliverableFileStanding;\n readonly approverName?: string;\n /** What the copy states it was made with, when it rebuilt: its words' language, its verification address. */\n readonly locale?: string;\n readonly verificationUrl?: string;\n };\n /**\n * Each vendor-signed copy named or given (#2907), in the order given: MATCHES (its first revision is the file the seal\n * binds, `derivesFromFileId` naming it, `originalLength` where it ends), CHANGED, DERIVED_FROM_ANOTHER_FILE, NOT_GIVEN\n * or NOT_COMMITTED (the presentation or the deliverable's salt is not disclosed, so there is nothing to tie it to).\n */\n readonly vendorSignedCopies?: ReadonlyArray<{\n readonly fileId?: string;\n readonly standing: ApprovalSealDeliverableFileStanding;\n /** The approved original this copy derives from: the deliverable the seal binds, when the copy MATCHES it. */\n readonly derivesFromFileId?: string;\n /** The original's length in bytes: what follows it is what the vendor appended. */\n readonly originalLength?: number;\n /** What the host stated the copy derives from, when that is another file. */\n readonly statedDerivedFromFileId?: string;\n /**\n * On MATCHES: whether the host RECORDS this exact copy (it named the copy and the bytes are the ones its file row\n * hashed), so the copy is the signed document a request validated at receipt. False for a copy the host names\n * without a recorded hash, or does not name: its first revision is the approved file, and nothing here says what\n * follows it is a vendor's signature.\n */\n readonly recordedByHost?: boolean;\n }>;\n /**\n * Whether the approval is still current over its record (#2914), when the record was given: CURRENT,\n * NO_LONGER_CURRENT (never a failure), SUBJECT_GONE, or NO_SEALED_FIELD_SET when the presentation is not disclosed or\n * covers no record field.\n */\n readonly subjectRecordCurrency?: ApprovalSealSubjectCurrencyAssessment;\n}\n\nfunction decodeJson(part: string | undefined): Record<string, unknown> | null {\n if (!part) return null;\n try {\n const value: unknown = JSON.parse(Buffer.from(part, 'base64url').toString('utf8'));\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : null;\n } catch {\n return null;\n }\n}\n\nfunction disclosureStanding(\n claimName: ApprovalSealDisclosureClaim,\n commitment: string | undefined,\n disclosures: readonly ApprovalSealDisclosureValue[],\n erasedClaims: readonly ApprovalSealDisclosureClaim[],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['approver'] {\n if (!commitment) return undefined;\n const given = disclosures.filter((disclosure) => disclosure.claimName === claimName);\n if (given.length === 0) {\n return { standing: erasedClaims.includes(claimName) ? ApprovalSealDisclosureStanding.ERASED : ApprovalSealDisclosureStanding.WITHHELD };\n }\n const matching = given.find((disclosure) => approvalSealDisclosureDigestOf(disclosure) === commitment);\n if (!matching) {\n // A disclosure that does not open its commitment is not the content: the seal fails, and nothing was disclosed.\n failures.push(ApprovalSealVerificationFailure.DISCLOSURE_MISMATCH);\n return { standing: ApprovalSealDisclosureStanding.WITHHELD };\n }\n return { standing: ApprovalSealDisclosureStanding.DISCLOSED, value: matching.value };\n}\n\n/**\n * The file deliverable against the commitment the disclosed presentation binds it by (#2904). A mismatch is a failure:\n * the seal does not attest those bytes.\n */\nfunction deliverableFileStandingOf(\n given: ApprovalSealVerificationInput['deliverableFile'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['deliverableFile'] {\n if (!given) return undefined;\n const bound = presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? humanDecisionBoundDeliverableOf(presentation.value, given.fileId) : undefined;\n if (!bound) return { fileId: given.fileId, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n if (!given.bytes) return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n const contentSha256 = createHash('sha256').update(given.bytes).digest('hex');\n if (approvalSealFileCommitmentOf(given.salt, contentSha256) === bound.commitment) {\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.MATCHES };\n }\n failures.push(ApprovalSealVerificationFailure.DELIVERABLE_FILE_MISMATCH);\n return { fileId: given.fileId, argument: bound.argument, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n}\n\n/**\n * The manifested copy against the seal (#2907): rebuilt and compared, then its prefix opened against the commitment the\n * disclosed presentation binds the deliverable by. A mismatch at either step is a failure.\n */\nfunction manifestedCopyStandingOf(\n input: ApprovalSealVerificationInput,\n approver: ApprovalSealVerification['approver'],\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['manifestedCopy'] {\n const given = input.manifestedCopy;\n if (!given) return undefined;\n const named = given.fileId ? { fileId: given.fileId } : {};\n if (!given.bytes) {\n return { ...named, standing: given.contentErased ? ApprovalSealDeliverableFileStanding.CONTENT_ERASED : ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n }\n if (approver?.standing !== ApprovalSealDisclosureStanding.DISCLOSED || !approver.value) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n const approverName = typeof approver.value.name === 'string' ? approver.value.name : undefined;\n const printed = approverName !== undefined ? { approverName } : {};\n const statedHash = given.contentSha256 === undefined || createHash('sha256').update(given.bytes).digest('hex') === given.contentSha256;\n const check = checkApprovalSealManifestedCopy(given.bytes, { jws: input.jws, ...printed });\n if (!check.matches || !statedHash) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n const deliverable = input.deliverableFile;\n const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED\n ? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)\n : undefined;\n const stated = { locale: check.statement.locale, ...(check.statement.verificationUrl ? { verificationUrl: check.statement.verificationUrl } : {}) };\n if (!deliverable || !bound) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED, ...printed, ...stated };\n if (approvalSealFileCommitmentOf(deliverable.salt, createHash('sha256').update(check.original).digest('hex')) !== bound.commitment) {\n failures.push(ApprovalSealVerificationFailure.MANIFESTED_COPY_MISMATCH);\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, ...printed, ...stated };\n}\n\n/**\n * The lengths at which a PDF's revisions end: just past each `%%EOF` marker, and past its end-of-line when one follows\n * (a file may end either way), ascending. An incremental update appends after one of them, so the original a later\n * revision was appended to is one of these prefixes. Read as Latin-1, so a byte offset in the text is a byte offset in\n * the file.\n */\nfunction pdfRevisionEndsOf(bytes: Uint8Array): number[] {\n const text = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('latin1');\n const ends: number[] = [];\n for (let index = text.indexOf('%%EOF'); index >= 0; index = text.indexOf('%%EOF', index + 1)) {\n const end = index + 5;\n ends.push(end);\n if (text[end] === '\\r' && text[end + 1] === '\\n') ends.push(end + 2);\n else if (text[end] === '\\n' || text[end] === '\\r') ends.push(end + 1);\n }\n return ends;\n}\n\n/**\n * The first revision end at which the prefix's SHA-256 satisfies `opens`, or undefined. Hashed INCREMENTALLY, one\n * running digest extended from one candidate end to the next and copied to read it, so a file carrying many `%%EOF`\n * markers costs one pass over its bytes rather than one per marker.\n */\nfunction firstPrefixOpening(bytes: Uint8Array, opens: (prefixSha256: string) => boolean): number | undefined {\n const running = createHash('sha256');\n let hashedTo = 0;\n for (const end of pdfRevisionEndsOf(bytes)) {\n running.update(bytes.subarray(hashedTo, end));\n hashedTo = end;\n if (opens(running.copy().digest('hex'))) return end;\n }\n return undefined;\n}\n\n/**\n * Each vendor-signed copy against the seal (#2907's document chain): its first revision opened against the commitment the\n * disclosed presentation binds the deliverable by. See {@link ApprovalSealVendorSignedCopyInput}. A copy the host states\n * was derived from another file, one whose bytes are not its recorded hash, or one with no prefix that is the approved\n * file, is a failure.\n */\nfunction vendorSignedCopyStandingsOf(\n input: ApprovalSealVerificationInput,\n presentation: ApprovalSealVerification['presentation'],\n failures: ApprovalSealVerificationFailure[],\n): ApprovalSealVerification['vendorSignedCopies'] {\n const copies = input.vendorSignedCopies;\n if (!copies || copies.length === 0) return undefined;\n const deliverable = input.deliverableFile;\n const bound = deliverable && presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED\n ? humanDecisionBoundDeliverableOf(presentation.value, deliverable.fileId)\n : undefined;\n let mismatched = false;\n const standings = copies.map((copy) => {\n const named = copy.fileId ? { fileId: copy.fileId } : {};\n // The host's own row names another original: the copy is not this approval's, whatever its bytes (refused before they\n // are read, so a copy built to open the commitment cannot pass under another file's lineage either).\n if (deliverable && copy.derivedFromFileId !== undefined && copy.derivedFromFileId !== deliverable.fileId) {\n mismatched = true;\n return { ...named, standing: ApprovalSealDeliverableFileStanding.DERIVED_FROM_ANOTHER_FILE, statedDerivedFromFileId: copy.derivedFromFileId };\n }\n if (!copy.bytes) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_GIVEN };\n if (copy.contentSha256 !== undefined && createHash('sha256').update(copy.bytes).digest('hex') !== copy.contentSha256) {\n mismatched = true;\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n if (!deliverable || !bound) return { ...named, standing: ApprovalSealDeliverableFileStanding.NOT_COMMITTED };\n const originalLength = firstPrefixOpening(copy.bytes, (prefixSha256) => approvalSealFileCommitmentOf(deliverable.salt, prefixSha256) === bound.commitment);\n if (originalLength === undefined) {\n mismatched = true;\n return { ...named, standing: ApprovalSealDeliverableFileStanding.CHANGED };\n }\n // `contentSha256` was compared with these bytes above, so a named copy carrying one is the copy the host recorded.\n const recordedByHost = copy.fileId !== undefined && copy.contentSha256 !== undefined;\n return { ...named, standing: ApprovalSealDeliverableFileStanding.MATCHES, derivesFromFileId: deliverable.fileId, originalLength, recordedByHost };\n });\n if (mismatched) failures.push(ApprovalSealVerificationFailure.VENDOR_SIGNED_COPY_MISMATCH);\n return standings;\n}\n\n/**\n * What corroborates a seal under a compromised key, if anything: evidence of its payload recorded before the compromise,\n * or a kept export signed before the compromise that lists this exact seal (its issuer, its key, its signed claims).\n */\nfunction corroborationOf(\n input: ApprovalSealVerificationInput,\n key: ApprovalSealVerificationKey,\n payload: Readonly<Record<string, unknown>>,\n decisionPayloadDigest: string,\n): ApprovalSealCorroborationSource | undefined {\n if (key.compromiseInstant === undefined) return undefined;\n const compromisedFrom = Date.parse(key.compromiseInstant);\n if (input.corroboration && input.corroboration.decisionPayloadDigest === decisionPayloadDigest && Date.parse(input.corroboration.recordedAt) < compromisedFrom) {\n return ApprovalSealCorroborationSource.RECORDED_EVIDENCE;\n }\n const logged = input.signingLogExports;\n if (!logged) return undefined;\n const claimsDigest = sealClaimsDigestOf(payload);\n const evidence = logged.exports.flatMap((jws) => {\n const exported = verifySigningLogExport({ jws, keys: logged.keys, ...(logged.pins ? { pins: logged.pins } : {}), expectedIssuer: key.iss });\n return exported.provable && exported.claims ? [exported.claims] : [];\n });\n // The exports must agree with each other first (#2932 review M3): an export is dated by the instant it states for\n // itself, so a host holding the export key could sign one dated before the compromise; it disagrees with the operator's\n // kept exports (a different hash at some sequence, or a head behind an earlier one), and then none of them corroborates.\n if (!compareSigningLogExports(evidence).consistent) return undefined;\n for (const claims of evidence) {\n if (claims.iat * 1000 >= compromisedFrom) continue;\n const lists = claims.entries.some((entry) =>\n entry.purpose === CryptoKey_Purpose.APPROVAL_SEAL && entry.kid === key.kid && entry.iss === key.iss && entry.claimsDigest === claimsDigest);\n if (lists) return ApprovalSealCorroborationSource.SIGNING_LOG_EXPORT;\n }\n return undefined;\n}\n\n/** See the file's header. Pure and offline. */\nexport function verifyApprovalSeal(input: ApprovalSealVerificationInput): ApprovalSealVerification {\n const failures: ApprovalSealVerificationFailure[] = [];\n const fail = (failure: ApprovalSealVerificationFailure, extra: Partial<ApprovalSealVerification> = {}): ApprovalSealVerification =>\n ({ valid: false, provable: false, failures: [...failures, failure], ...extra });\n\n const parts = input.jws.split('.');\n const header = parts.length === 3 ? decodeJson(parts[0]) : null;\n const payload = parts.length === 3 ? decodeJson(parts[1]) : null;\n if (!header || !payload || !parts[2]) return fail(ApprovalSealVerificationFailure.MALFORMED);\n\n const kid = typeof header.kid === 'string' ? header.kid : undefined;\n // The key is chosen by `kid` among the keys the verifier was GIVEN; `jku`/`x5u`/`jwk`/`x5c` are never read.\n const record = kid ? input.keys.find((candidate) => candidate.kid === kid) : undefined;\n if (!record || !isP256PublicJwk(record.publicJwk)) return fail(ApprovalSealVerificationFailure.UNKNOWN_KEY, kid ? { kid } : {});\n // The operator's pin, when given: the key handed over must be the one the pinned thumbprint names, and the pin (not\n // the record) says what became of it.\n const key = pinnedVerificationKeyOf(record, input.pins);\n if (!key) return fail(ApprovalSealVerificationFailure.UNPINNED, { kid });\n if (header.alg !== key.alg || key.alg !== ES256_JWS_ALGORITHM) return fail(ApprovalSealVerificationFailure.ALGORITHM_NOT_PINNED, { kid });\n if (header.crit !== undefined) return fail(ApprovalSealVerificationFailure.CRITICAL_EXTENSION, { kid });\n if (header.typ !== APPROVAL_SEAL_TYP) return fail(ApprovalSealVerificationFailure.TYPE_MISMATCH, { kid });\n if (!verifyEs256(`${parts[0]}.${parts[1]}`, Buffer.from(parts[2], 'base64url'), key.publicJwk)) {\n return fail(ApprovalSealVerificationFailure.SIGNATURE_INVALID, { kid, keyState: key.state });\n }\n\n const iss = typeof payload.iss === 'string' ? payload.iss : undefined;\n const iat = typeof payload.iat === 'number' ? payload.iat : undefined;\n const lateSeal = payload.lateSeal === true;\n if (!iss || iss !== key.iss || (input.expectedIssuer !== undefined && iss !== input.expectedIssuer)) failures.push(ApprovalSealVerificationFailure.ISSUER_MISMATCH);\n\n const committed = Object.fromEntries(Object.entries(payload).filter(([name]) => !(CUSTODIAN_SET_CLAIMS as readonly string[]).includes(name)));\n const parsed = ApprovalSealClaimsV1Schema.safeParse(committed);\n if (!parsed.success) return fail(ApprovalSealVerificationFailure.CLAIMS_INVALID, { kid, keyState: key.state, ...(iss ? { iss } : {}) });\n const claims = parsed.data;\n\n // The key's scope from its RECORD: an organization key covers only that organization's decisions.\n const scopeCovers = key.scope === CryptoKey_Scope.APPLICATION || (key.scope === CryptoKey_Scope.ORGANIZATION && claims.tenant === key.scopeId);\n if (!scopeCovers) failures.push(ApprovalSealVerificationFailure.TENANT_OUTSIDE_KEY_SCOPE);\n\n const disclosures = input.disclosures ?? [];\n const erased = input.erasedClaims ?? [];\n const approver = disclosureStanding(ApprovalSealDisclosureClaim.APPROVER, claims.approver, disclosures, erased, failures);\n const requester = disclosureStanding(ApprovalSealDisclosureClaim.REQUESTER, claims.requester?.disclosure, disclosures, erased, failures);\n const presentation = disclosureStanding(ApprovalSealDisclosureClaim.PRESENTATION, claims.presentation?.digest, disclosures, erased, failures);\n const statement = disclosureStanding(ApprovalSealDisclosureClaim.STATEMENT, claims.statementDigest, disclosures, erased, failures);\n const deliverableFile = deliverableFileStandingOf(input.deliverableFile, presentation, failures);\n const manifestedCopy = manifestedCopyStandingOf(input, approver, presentation, failures);\n const vendorSignedCopies = vendorSignedCopyStandingsOf(input, presentation, failures);\n // #2914: never a failure; the presentation counts only when it opened its commitment.\n const subjectRecordCurrency = input.subjectRecord !== undefined\n ? approvalSealSubjectCurrencyOf(presentation?.standing === ApprovalSealDisclosureStanding.DISCLOSED ? presentation.value : undefined, input.subjectRecord)\n : undefined;\n\n const decisionPayloadDigest = decisionPayloadDigestOf(committed);\n const valid = failures.length === 0;\n const compromised = key.state === CryptoKey_VersionState.COMPROMISED;\n const corroboratedBy = compromised ? corroborationOf(input, key, payload, decisionPayloadDigest) : undefined;\n const corroborated = !compromised || corroboratedBy !== undefined;\n return {\n valid,\n failures,\n provable: valid && corroborated,\n ...(corroboratedBy ? { corroboratedBy } : {}),\n kid,\n keyState: key.state,\n claims,\n iss,\n ...(iat !== undefined ? { iat, signingWindowSeconds: Math.max(0, iat - claims.decidedAt) } : {}),\n lateSeal,\n decisionPayloadDigest,\n ...(approver ? { approver } : {}),\n ...(requester ? { requester } : {}),\n ...(presentation ? { presentation } : {}),\n ...(statement ? { statement } : {}),\n ...(deliverableFile ? { deliverableFile } : {}),\n ...(manifestedCopy ? { manifestedCopy } : {}),\n ...(vendorSignedCopies ? { vendorSignedCopies } : {}),\n ...(subjectRecordCurrency ? { subjectRecordCurrency } : {}),\n };\n}\n\n/** A verification key as an export or a CLI file states it (dates as ISO strings): the one shape of a key record. */\nexport const ApprovalSealVerificationKeySchema = VerificationKeyRecordSchema;\n\n/**\n * Evidence recorded outside the application that a decision's payload existed before a key's compromise, as the file an\n * operator keeps it in (`wildo seal verify --corroboration <file>`).\n */\nexport const ApprovalSealCorroborationSchema = z.object({ decisionPayloadDigest: z.string().min(1), recordedAt: z.string().min(1) });\n\n/**\n * What `wildo seal verify` reads: one seal and everything it needs to verify, offline. A bundle is what the HOST exports,\n * so it carries no pin set, no signing-log exports and no corroboration: each is evidence against the host, and reaches\n * the verifier only from the operator's own files (`ApprovalSealVerificationInput.pins` / `signingLogExports` /\n * `corroboration`). The schema is not strict, so a bundle naming any of them has it stripped on parse rather than\n * believed (#2932 review H1, R1).\n */\nexport const ApprovalSealVerificationBundleSchema = z.object({\n jws: z.string().min(1),\n keys: z.array(ApprovalSealVerificationKeySchema).min(1),\n expectedIssuer: z.string().min(1).optional(),\n disclosures: z.array(z.object({ claimName: z.enum(ApprovalSealDisclosureClaim), salt: z.string().min(1), value: z.record(z.string(), z.unknown()) })).optional(),\n /** The committed claims an erasure removed from the host's row (#2924): see `ApprovalSealVerificationInput.erasedClaims`. */\n erasedClaims: z.array(z.enum(ApprovalSealDisclosureClaim)).optional(),\n /**\n * The file deliverable the seal attests (#2904): its id and the salt its row kept. Never the bytes, which the verifier\n * is given from the file itself (`--deliverable`), and never the clear hash.\n */\n deliverableFile: z.object({ fileId: z.string().min(1), salt: z.string().min(1) }).optional(),\n /**\n * The deliverable's manifested copy (#2907): its file id, or `contentErased` when the approver's erasure deleted it.\n * Never its bytes, which the verifier is given from the file itself (`--manifested-copy`).\n */\n manifestedCopy: z.object({ fileId: z.string().min(1).optional(), contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(), contentErased: z.literal(true).optional() })\n .refine((copy) => (copy.fileId === undefined) !== (copy.contentErased === undefined), { message: 'A manifested copy is named by its file id, or stated erased: exactly one of the two' })\n .optional(),\n /**\n * The document chain's other branch (#2907): the copies an electronic-signature vendor returned of the deliverable, each\n * with the file its row says it was derived from and the hash its row recorded. Never their bytes, which the verifier is\n * given from the files themselves (`--vendor-signed-copy`).\n */\n vendorSignedCopies: z.array(z.object({\n fileId: z.string().min(1),\n derivedFromFileId: z.string().min(1).optional(),\n contentSha256: z.string().regex(/^[0-9a-f]{64}$/).optional(),\n })).optional(),\n});\nexport type ApprovalSealVerificationBundle = z.infer<typeof ApprovalSealVerificationBundleSchema>;\n"]}
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * ## Where the settings live, measured rather than assumed (2026-11-09, scratch workspaces with local tarballs)
7
7
  *
8
- * | setting | pnpm 10.6.4 (the pin) | pnpm 11.20.0 |
8
+ * | setting | pnpm 10.6.4 (the pin at the time; 10.34.9 since #3014 behaves the same here) | pnpm 11.20.0 |
9
9
  * |---|---|---|
10
10
  * | `overrides` in `pnpm-workspace.yaml` | read | read |
11
11
  * | `overrides` in `package.json` → `pnpm` | read, and it REPLACES the YAML block whole (a `package.json` block holding one unrelated key switched off every YAML override) | ignored, with a warning naming the key |
@@ -7,7 +7,7 @@ import { join } from 'node:path';
7
7
  *
8
8
  * ## Where the settings live, measured rather than assumed (2026-11-09, scratch workspaces with local tarballs)
9
9
  *
10
- * | setting | pnpm 10.6.4 (the pin) | pnpm 11.20.0 |
10
+ * | setting | pnpm 10.6.4 (the pin at the time; 10.34.9 since #3014 behaves the same here) | pnpm 11.20.0 |
11
11
  * |---|---|---|
12
12
  * | `overrides` in `pnpm-workspace.yaml` | read | read |
13
13
  * | `overrides` in `package.json` → `pnpm` | read, and it REPLACES the YAML block whole (a `package.json` block holding one unrelated key switched off every YAML override) | ignored, with a warning naming the key |