@svta/cml-c2pa 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import { ValueOf } from "@svta/cml-utils";
2
-
3
2
  //#region src/C2paAssertion.d.ts
4
-
5
3
  /**
6
- * A C2PA assertion within a manifest
7
- *
8
- * @public
9
- */
4
+ * A C2PA assertion within a manifest
5
+ *
6
+ * @public
7
+ */
10
8
  type C2paAssertion = {
11
9
  readonly label: string;
12
10
  readonly data: unknown;
@@ -14,10 +12,10 @@ type C2paAssertion = {
14
12
  //#endregion
15
13
  //#region src/C2paSignatureInfo.d.ts
16
14
  /**
17
- * Signature information extracted from a C2PA claim
18
- *
19
- * @public
20
- */
15
+ * Signature information extracted from a C2PA claim
16
+ *
17
+ * @public
18
+ */
21
19
  type C2paSignatureInfo = {
22
20
  readonly issuer: string | null;
23
21
  readonly certNotBefore: string | null;
@@ -25,10 +23,10 @@ type C2paSignatureInfo = {
25
23
  //#endregion
26
24
  //#region src/C2paManifest.d.ts
27
25
  /**
28
- * A C2PA manifest (the active manifest within a manifest store)
29
- *
30
- * @public
31
- */
26
+ * A C2PA manifest (the active manifest within a manifest store)
27
+ *
28
+ * @public
29
+ */
32
30
  type C2paManifest = {
33
31
  readonly label: string;
34
32
  readonly instanceId: string | null;
@@ -39,16 +37,16 @@ type C2paManifest = {
39
37
  //#endregion
40
38
  //#region src/C2paStatusCode.d.ts
41
39
  /**
42
- * Standard C2PA validation status codes for manifest integrity checks,
43
- * as defined in the C2PA specification chapters 15 and 18.
44
- *
45
- * @see {@link https://c2pa.org/specifications/specifications/2.3/specs/C2PA_Specification.html#_claim_validation | C2PA Spec §15.10.3}
46
- *
47
- * @enum
48
- *
49
- * @public
50
- */
51
- declare const C2paStatusCode: {
40
+ * Standard C2PA validation status codes for manifest integrity checks,
41
+ * as defined in the C2PA specification chapters 15 and 18.
42
+ *
43
+ * @see {@link https://c2pa.org/specifications/specifications/2.3/specs/C2PA_Specification.html#_claim_validation | C2PA Spec §15.10.3}
44
+ *
45
+ * @enum
46
+ *
47
+ * @public
48
+ */
49
+ export declare const C2paStatusCode: {
52
50
  /** Assertion hash does not match the hashed URI in the claim (§15.10.3.1) */
53
51
  readonly ASSERTION_HASHEDURI_MISMATCH: "assertion.hashedURI.mismatch";
54
52
  /** The assertion store has no box for a claim reference, or more than one box for its label (§8.4.1, §15.10.3.1) */
@@ -77,19 +75,19 @@ declare const C2paStatusCode: {
77
75
  readonly ASSERTION_BMFFHASH_MISMATCH: "assertion.bmffHash.mismatch";
78
76
  };
79
77
  /**
80
- * Union type of all {@link (C2paStatusCode:variable)} values.
81
- *
82
- * @public
83
- */
84
- type C2paStatusCode = ValueOf<typeof C2paStatusCode>;
78
+ * Union type of all {@link (C2paStatusCode:variable)} values.
79
+ *
80
+ * @public
81
+ */
82
+ export type C2paStatusCode = ValueOf<typeof C2paStatusCode>;
85
83
  //#endregion
86
84
  //#region src/cose/CoseKeyJwk.d.ts
87
85
  /**
88
- * A JWK (JSON Web Key) representation of a COSE public key,
89
- * suitable for use with the WebCrypto `importKey` API.
90
- *
91
- * @public
92
- */
86
+ * A JWK (JSON Web Key) representation of a COSE public key,
87
+ * suitable for use with the WebCrypto `importKey` API.
88
+ *
89
+ * @public
90
+ */
93
91
  type CoseKeyJwk = {
94
92
  readonly kty: string;
95
93
  readonly crv: string;
@@ -99,16 +97,16 @@ type CoseKeyJwk = {
99
97
  //#endregion
100
98
  //#region src/LiveVideoStatusCode.d.ts
101
99
  /**
102
- * Standard C2PA failure status codes for live video validation,
103
- * as defined in the C2PA specification section 19.7.
104
- *
105
- * @see {@link https://c2pa.org/specifications/specifications/2.3/specs/C2PA_Specification.html#_live_video_validation_process | C2PA Spec §19.7}
106
- *
107
- * @enum
108
- *
109
- * @public
110
- */
111
- declare const LiveVideoStatusCode: {
100
+ * Standard C2PA failure status codes for live video validation,
101
+ * as defined in the C2PA specification section 19.7.
102
+ *
103
+ * @see {@link https://c2pa.org/specifications/specifications/2.3/specs/C2PA_Specification.html#_live_video_validation_process | C2PA Spec §19.7}
104
+ *
105
+ * @enum
106
+ *
107
+ * @public
108
+ */
109
+ export declare const LiveVideoStatusCode: {
112
110
  /** Init segment contains an `mdat` box (§19.7.1) */
113
111
  readonly INIT_INVALID: "livevideo.init.invalid";
114
112
  /** C2PA Manifest Box failed standard validation (§19.7.1) */
@@ -116,10 +114,10 @@ declare const LiveVideoStatusCode: {
116
114
  /** Segment invalid: missing Manifest Box/emsg, signature/hash/key failure, or session key outside its validity period (§19.7) */
117
115
  readonly SEGMENT_INVALID: "livevideo.segment.invalid";
118
116
  /**
119
- * Live video assertion field invalid: sequenceNumber or streamId mismatch
120
- * (§19.7.2). Also reused for VOD Merkle per-track location discontinuity
121
- * (§15.12.2), which has no dedicated code.
122
- */
117
+ * Live video assertion field invalid: sequenceNumber or streamId mismatch
118
+ * (§19.7.2). Also reused for VOD Merkle per-track location discontinuity
119
+ * (§15.12.2), which has no dedicated code.
120
+ */
123
121
  readonly ASSERTION_INVALID: "livevideo.assertion.invalid";
124
122
  /** continuityMethod absent, unsupported, or companion fields incorrect (§19.7.2) */
125
123
  readonly CONTINUITY_METHOD_INVALID: "livevideo.continuityMethod.invalid";
@@ -129,32 +127,32 @@ declare const LiveVideoStatusCode: {
129
127
  readonly SESSIONKEY_INVALID: "livevideo.sessionkey.invalid";
130
128
  };
131
129
  /**
132
- * Union type of all {@link (LiveVideoStatusCode:variable)} values.
133
- *
134
- * @public
135
- */
136
- type LiveVideoStatusCode = ValueOf<typeof LiveVideoStatusCode>;
130
+ * Union type of all {@link (LiveVideoStatusCode:variable)} values.
131
+ *
132
+ * @public
133
+ */
134
+ export type LiveVideoStatusCode = ValueOf<typeof LiveVideoStatusCode>;
137
135
  //#endregion
138
136
  //#region src/bmff/BmffHashExclusion.d.ts
139
137
  /**
140
- * A byte-level constraint used to match specific BMFF box content
141
- * within a C2PA BMFF hash exclusion.
142
- *
143
- * @public
144
- */
138
+ * A byte-level constraint used to match specific BMFF box content
139
+ * within a C2PA BMFF hash exclusion.
140
+ *
141
+ * @public
142
+ */
145
143
  type BmffHashConstraint = {
146
144
  readonly offset: number;
147
145
  readonly value: Uint8Array | readonly number[];
148
146
  };
149
147
  /**
150
- * Identifies a BMFF box to exclude from the C2PA content hash (`c2pa.hash.bmff.v3`).
151
- *
152
- * The `xpath` uses C2PA path notation (e.g. `/emsg`, `/moof/traf`).
153
- * Optional `data` constraints narrow the match to specific box content
154
- * by byte offset within the box.
155
- *
156
- * @public
157
- */
148
+ * Identifies a BMFF box to exclude from the C2PA content hash (`c2pa.hash.bmff.v3`).
149
+ *
150
+ * The `xpath` uses C2PA path notation (e.g. `/emsg`, `/moof/traf`).
151
+ * Optional `data` constraints narrow the match to specific box content
152
+ * by byte offset within the box.
153
+ *
154
+ * @public
155
+ */
158
156
  type BmffHashExclusion = {
159
157
  readonly xpath: string;
160
158
  readonly data?: readonly BmffHashConstraint[];
@@ -162,10 +160,10 @@ type BmffHashExclusion = {
162
160
  //#endregion
163
161
  //#region src/merkle/MerkleSegmentValidation.d.ts
164
162
  /**
165
- * One merkle map from the `c2pa.hash.bmff.v3` assertion (§18.6).
166
- *
167
- * @public
168
- */
163
+ * One merkle map from the `c2pa.hash.bmff.v3` assertion (§18.6).
164
+ *
165
+ * @public
166
+ */
169
167
  type MerkleMap = {
170
168
  readonly uniqueId: number;
171
169
  readonly localId: number;
@@ -177,24 +175,24 @@ type MerkleMap = {
177
175
  readonly offsetPrefixSize: number;
178
176
  };
179
177
  /**
180
- * Continuity state carried between calls to `validateC2paMerkleSegment`.
181
- * Reset (pass `undefined`) after a seek.
182
- *
183
- * `lastLocations` is keyed by `${uniqueId}:${localId}`, matching the
184
- * `MerkleMap` fields of the track it tracks. The first location seen for a
185
- * key is always accepted (no prior state to compare against), so a caller
186
- * that needs strict start-at-zero enforcement must seed this map itself.
187
- *
188
- * @public
189
- */
178
+ * Continuity state carried between calls to `validateC2paMerkleSegment`.
179
+ * Reset (pass `undefined`) after a seek.
180
+ *
181
+ * `lastLocations` is keyed by `${uniqueId}:${localId}`, matching the
182
+ * `MerkleMap` fields of the track it tracks. The first location seen for a
183
+ * key is always accepted (no prior state to compare against), so a caller
184
+ * that needs strict start-at-zero enforcement must seed this map itself.
185
+ *
186
+ * @public
187
+ */
190
188
  type MerkleSegmentState = {
191
189
  readonly lastLocations: ReadonlyMap<string, number>;
192
190
  };
193
191
  /**
194
- * Result of `validateC2paMerkleSegment` for one media segment.
195
- *
196
- * @public
197
- */
192
+ * Result of `validateC2paMerkleSegment` for one media segment.
193
+ *
194
+ * @public
195
+ */
198
196
  type MerkleSegmentValidation = {
199
197
  readonly location: number | null;
200
198
  readonly bmffHashHex: string | null;
@@ -204,13 +202,13 @@ type MerkleSegmentValidation = {
204
202
  //#endregion
205
203
  //#region src/init/InitSegmentValidation.d.ts
206
204
  /**
207
- * A session key extracted and verified from a C2PA `c2pa.session-keys` assertion.
208
- *
209
- * Only keys whose signer binding is valid and whose validity period has not expired
210
- * are included in {@link InitSegmentValidation.sessionKeys}.
211
- *
212
- * @public
213
- */
205
+ * A session key extracted and verified from a C2PA `c2pa.session-keys` assertion.
206
+ *
207
+ * Only keys whose signer binding is valid and whose validity period has not expired
208
+ * are included in {@link InitSegmentValidation.sessionKeys}.
209
+ *
210
+ * @public
211
+ */
214
212
  type ValidatedSessionKey = {
215
213
  readonly kid: string;
216
214
  readonly jwk: CoseKeyJwk;
@@ -219,12 +217,12 @@ type ValidatedSessionKey = {
219
217
  readonly createdAt: string;
220
218
  };
221
219
  /**
222
- * Result of validating a C2PA init segment.
223
- *
224
- * Returned by {@link validateC2paInitSegment}.
225
- *
226
- * @public
227
- */
220
+ * Result of validating a C2PA init segment.
221
+ *
222
+ * Returned by {@link validateC2paInitSegment}.
223
+ *
224
+ * @public
225
+ */
228
226
  type InitSegmentValidation = {
229
227
  readonly manifest: C2paManifest | null;
230
228
  readonly certificate: Uint8Array | null;
@@ -237,62 +235,62 @@ type InitSegmentValidation = {
237
235
  //#endregion
238
236
  //#region src/init/validateC2paInitSegment.d.ts
239
237
  /**
240
- * Validates a C2PA init segment: parses the manifest, extracts and verifies
241
- * the certificate, validates the BMFF hard binding hash, verifies all
242
- * session keys from the `c2pa.session-keys` assertion, and performs
243
- * manifest integrity checks (assertion references and hashes, undeclared
244
- * assertions, the hard binding count, duplicate manifest boxes, action
245
- * ingredients, and claim signature verification).
246
- *
247
- * Only session keys with a valid signer binding and an unexpired validity period
248
- * are included in the result. The result holds `sessionKeys` and `merkleMaps` only when
249
- * every manifest integrity check passes, so check `isValid` before you use either list.
250
- *
251
- * The result includes `LiveVideoStatusCode.SESSIONKEY_INVALID` if the function finds an invalid
252
- * session key (C2PA section 19.7.3). A session key is invalid if it does not conform to section 18.25.2,
253
- * or if its signer binding fails verification. The function does not check every rule of section 18.25.2.
254
- * An expired session key does not count as invalid. A `c2pa.session-keys` assertion without a session key,
255
- * or with CBOR that does not decode, also causes `SESSIONKEY_INVALID`.
256
- *
257
- * @param bytes - Raw init segment bytes
258
- * @returns Structured validation result (with `INIT_INVALID` error code if `mdat` box is present)
259
- * @throws If no C2PA UUID box is found
260
- *
261
- * @example
262
- * {@includeCode ../../test/init/validateC2paInitSegment.test.ts#example}
263
- *
264
- * @public
265
- */
266
- declare function validateC2paInitSegment(bytes: Uint8Array): Promise<InitSegmentValidation>;
238
+ * Validates a C2PA init segment: parses the manifest, extracts and verifies
239
+ * the certificate, validates the BMFF hard binding hash, verifies all
240
+ * session keys from the `c2pa.session-keys` assertion, and performs
241
+ * manifest integrity checks (assertion references and hashes, undeclared
242
+ * assertions, the hard binding count, duplicate manifest boxes, action
243
+ * ingredients, and claim signature verification).
244
+ *
245
+ * Only session keys with a valid signer binding and an unexpired validity period
246
+ * are included in the result. The result holds `sessionKeys` and `merkleMaps` only when
247
+ * every manifest integrity check passes, so check `isValid` before you use either list.
248
+ *
249
+ * The result includes `LiveVideoStatusCode.SESSIONKEY_INVALID` if the function finds an invalid
250
+ * session key (C2PA section 19.7.3). A session key is invalid if it does not conform to section 18.25.2,
251
+ * or if its signer binding fails verification. The function does not check every rule of section 18.25.2.
252
+ * An expired session key does not count as invalid. A `c2pa.session-keys` assertion without a session key,
253
+ * or with CBOR that does not decode, also causes `SESSIONKEY_INVALID`.
254
+ *
255
+ * @param bytes - Raw init segment bytes
256
+ * @returns Structured validation result (with `INIT_INVALID` error code if `mdat` box is present)
257
+ * @throws If no C2PA UUID box is found
258
+ *
259
+ * @example
260
+ * {@includeCode ../../test/init/validateC2paInitSegment.test.ts#example}
261
+ *
262
+ * @public
263
+ */
264
+ export declare function validateC2paInitSegment(bytes: Uint8Array): Promise<InitSegmentValidation>;
267
265
  //#endregion
268
266
  //#region src/vsi/SequenceState.d.ts
269
267
  /**
270
- * State and result types for monotonic sequence number validation
271
- * per C2PA Live Streaming Specification §18.4.
272
- *
273
- * @public
274
- */
268
+ * State and result types for monotonic sequence number validation
269
+ * per C2PA Live Streaming Specification §18.4.
270
+ *
271
+ * @public
272
+ */
275
273
  /**
276
- * Immutable state snapshot for a single stream's sequence number history.
277
- *
278
- * Pass to {@link validateC2paSegment} via the `sequenceState` parameter.
279
- *
280
- * @public
281
- */
274
+ * Immutable state snapshot for a single stream's sequence number history.
275
+ *
276
+ * Pass to {@link validateC2paSegment} via the `sequenceState` parameter.
277
+ *
278
+ * @public
279
+ */
282
280
  type SequenceState = {
283
281
  readonly lastSequenceNumber: number | null;
284
282
  readonly seenSequences: ReadonlySet<number>;
285
283
  };
286
284
  /**
287
- * Reason codes for sequence number validation outcomes.
288
- *
289
- * @see {@link SequenceValidationResult}
290
- *
291
- * @enum
292
- *
293
- * @public
294
- */
295
- declare const SequenceValidationReason: {
285
+ * Reason codes for sequence number validation outcomes.
286
+ *
287
+ * @see {@link SequenceValidationResult}
288
+ *
289
+ * @enum
290
+ *
291
+ * @public
292
+ */
293
+ export declare const SequenceValidationReason: {
296
294
  /** Sequence number is the next expected value */
297
295
  readonly VALID: "valid";
298
296
  /** Sequence number was already seen */
@@ -305,19 +303,19 @@ declare const SequenceValidationReason: {
305
303
  readonly SEQUENCE_NUMBER_BELOW_MINIMUM: "sequence_number_below_minimum";
306
304
  };
307
305
  /**
308
- * Union type of all {@link (SequenceValidationReason:variable)} values.
309
- *
310
- * @public
311
- */
312
- type SequenceValidationReason = ValueOf<typeof SequenceValidationReason>;
306
+ * Union type of all {@link (SequenceValidationReason:variable)} values.
307
+ *
308
+ * @public
309
+ */
310
+ export type SequenceValidationReason = ValueOf<typeof SequenceValidationReason>;
313
311
  /**
314
- * Result of validating a single sequence number against the current stream state.
315
- *
316
- * Discriminated on `reason` — narrow to `'gap_detected'` to access
317
- * `missingFrom` / `missingTo`.
318
- *
319
- * @public
320
- */
312
+ * Result of validating a single sequence number against the current stream state.
313
+ *
314
+ * Discriminated on `reason` — narrow to `'gap_detected'` to access
315
+ * `missingFrom` / `missingTo`.
316
+ *
317
+ * @public
318
+ */
321
319
  type SequenceValidationResult = {
322
320
  readonly isValid: true;
323
321
  readonly reason: typeof SequenceValidationReason.VALID;
@@ -333,12 +331,12 @@ type SequenceValidationResult = {
333
331
  //#endregion
334
332
  //#region src/segment/SegmentValidation.d.ts
335
333
  /**
336
- * The result of validating a single C2PA live stream segment (VSI/EMSG method).
337
- *
338
- * Returned by {@link validateC2paSegment}.
339
- *
340
- * @public
341
- */
334
+ * The result of validating a single C2PA live stream segment (VSI/EMSG method).
335
+ *
336
+ * Returned by {@link validateC2paSegment}.
337
+ *
338
+ * @public
339
+ */
342
340
  type SegmentValidationResult = {
343
341
  readonly sequenceNumber: number;
344
342
  readonly manifestId: string;
@@ -351,40 +349,40 @@ type SegmentValidationResult = {
351
349
  //#endregion
352
350
  //#region src/segment/validateC2paSegment.d.ts
353
351
  /**
354
- * Validates a C2PA live stream segment using the VSI/EMSG method (§19.7.3).
355
- *
356
- * Extracts the EMSG box, decodes the COSE_Sign1 and VSI map, matches the
357
- * session key by kid, then performs all cryptographic checks: signature
358
- * verification, BMFF content hash, sequence number floor, and key validity.
359
- *
360
- * Returns `null` if the segment does not contain a C2PA EMSG box.
361
- *
362
- * A segment whose signature, content hash, or key validity does not verify
363
- * returns the received `sequenceState` unchanged.
364
- *
365
- * @param segmentBytes - Raw segment bytes
366
- * @param sessionKeys - Available session keys from the init segment
367
- * @param sequenceState - Current sequence state for this stream
368
- * @returns Validation result and the sequence state for the next call, or `null` if no C2PA EMSG box
369
- *
370
- * @example
371
- * {@includeCode ../../test/segment/validateC2paSegment.test.ts#example}
372
- *
373
- * @public
374
- */
375
- declare function validateC2paSegment(segmentBytes: Uint8Array, sessionKeys: readonly ValidatedSessionKey[], sequenceState?: SequenceState): Promise<{
352
+ * Validates a C2PA live stream segment using the VSI/EMSG method (§19.7.3).
353
+ *
354
+ * Extracts the EMSG box, decodes the COSE_Sign1 and VSI map, matches the
355
+ * session key by kid, then performs all cryptographic checks: signature
356
+ * verification, BMFF content hash, sequence number floor, and key validity.
357
+ *
358
+ * Returns `null` if the segment does not contain a C2PA EMSG box.
359
+ *
360
+ * A segment whose signature, content hash, or key validity does not verify
361
+ * returns the received `sequenceState` unchanged.
362
+ *
363
+ * @param segmentBytes - Raw segment bytes
364
+ * @param sessionKeys - Available session keys from the init segment
365
+ * @param sequenceState - Current sequence state for this stream
366
+ * @returns Validation result and the sequence state for the next call, or `null` if no C2PA EMSG box
367
+ *
368
+ * @example
369
+ * {@includeCode ../../test/segment/validateC2paSegment.test.ts#example}
370
+ *
371
+ * @public
372
+ */
373
+ export declare function validateC2paSegment(segmentBytes: Uint8Array, sessionKeys: readonly ValidatedSessionKey[], sequenceState?: SequenceState): Promise<{
376
374
  readonly result: SegmentValidationResult;
377
375
  readonly nextSequenceState: SequenceState;
378
376
  } | null>;
379
377
  //#endregion
380
378
  //#region src/manifestbox/ManifestBoxValidation.d.ts
381
379
  /**
382
- * The result of validating a single C2PA manifest-box live stream segment.
383
- *
384
- * Returned by {@link validateC2paManifestBoxSegment}.
385
- *
386
- * @public
387
- */
380
+ * The result of validating a single C2PA manifest-box live stream segment.
381
+ *
382
+ * Returned by {@link validateC2paManifestBoxSegment}.
383
+ *
384
+ * @public
385
+ */
388
386
  type ManifestBoxValidationResult = {
389
387
  readonly manifest: C2paManifest | null;
390
388
  readonly issuer: string | null;
@@ -399,16 +397,16 @@ type ManifestBoxValidationResult = {
399
397
  readonly errorCodes: readonly (LiveVideoStatusCode | C2paStatusCode)[];
400
398
  };
401
399
  /**
402
- * Validates continuity for an implementer-defined continuity method (§19.3.2).
403
- *
404
- * @public
405
- */
400
+ * Validates continuity for an implementer-defined continuity method (§19.3.2).
401
+ *
402
+ * @public
403
+ */
406
404
  type ManifestBoxContinuityValidator = (liveVideoAssertion: Readonly<Record<string, unknown>>, manifest: C2paManifest) => boolean | Promise<boolean>;
407
405
  /**
408
- * Options for `validateC2paManifestBoxSegment`.
409
- *
410
- * @public
411
- */
406
+ * Options for `validateC2paManifestBoxSegment`.
407
+ *
408
+ * @public
409
+ */
412
410
  type ManifestBoxValidationOptions = {
413
411
  readonly continuityValidator?: {
414
412
  readonly method: string;
@@ -416,13 +414,13 @@ type ManifestBoxValidationOptions = {
416
414
  };
417
415
  };
418
416
  /**
419
- * State to carry between consecutive manifest-box segment validations.
420
- *
421
- * Pass the `nextState` returned by {@link validateC2paManifestBoxSegment}
422
- * into the next call to enable streamId, sequenceNumber, and continuity checks.
423
- *
424
- * @public
425
- */
417
+ * State to carry between consecutive manifest-box segment validations.
418
+ *
419
+ * Pass the `nextState` returned by {@link validateC2paManifestBoxSegment}
420
+ * into the next call to enable streamId, sequenceNumber, and continuity checks.
421
+ *
422
+ * @public
423
+ */
426
424
  type ManifestBoxValidationState = {
427
425
  readonly lastStreamId?: string | null;
428
426
  readonly lastSequenceNumber?: number | null;
@@ -430,36 +428,36 @@ type ManifestBoxValidationState = {
430
428
  //#endregion
431
429
  //#region src/manifestbox/validateC2paManifestBoxSegment.d.ts
432
430
  /**
433
- * Validates a C2PA manifest-box live stream segment.
434
- *
435
- * Parses the C2PA manifest embedded in the segment and validates per §19.7.1 and §19.7.2.
436
- * Recomputes the `c2pa.hash.bmff.v3` content hash from the raw segment bytes and compares
437
- * it against the expected hash in the manifest assertion. Checks live-video assertions
438
- * (sequenceNumber, streamId, continuityMethod) and manifest-ID chain continuity.
439
- * The live-video and BMFF hash fields of the result come only from assertions whose
440
- * hash matches a claim reference. Check `isValid` before you use any field.
441
- * A validator for an implementer-defined continuity method can be registered
442
- * via {@link ManifestBoxValidationOptions}.
443
- *
444
- * This function is **pure** — it does not access any external state. The
445
- * caller is responsible for persisting `nextManifestId` and `nextState`
446
- * between calls. A segment that fails verification, is on another stream, or
447
- * does not move the sequence number forward returns the received
448
- * `lastManifestId` and `state` unchanged. A segment that fails only the
449
- * continuity check still updates them.
450
- *
451
- * @param bytes - Raw segment bytes
452
- * @param lastManifestId - Manifest ID from the last segment that updated the state, or `null` for the first segment
453
- * @param state - Optional state from the last segment that updated the state, for the streamId and sequenceNumber checks
454
- * @param options - Optional custom continuity method validator
455
- * @returns Validation result, the manifest ID, and state to persist for the next call
456
- *
457
- * @example
458
- * {@includeCode ../../test/manifestbox/validateC2paManifestBoxSegment.test.ts#example}
459
- *
460
- * @public
461
- */
462
- declare function validateC2paManifestBoxSegment(bytes: Uint8Array, lastManifestId: string | null, state?: ManifestBoxValidationState, options?: ManifestBoxValidationOptions): Promise<{
431
+ * Validates a C2PA manifest-box live stream segment.
432
+ *
433
+ * Parses the C2PA manifest embedded in the segment and validates per §19.7.1 and §19.7.2.
434
+ * Recomputes the `c2pa.hash.bmff.v3` content hash from the raw segment bytes and compares
435
+ * it against the expected hash in the manifest assertion. Checks live-video assertions
436
+ * (sequenceNumber, streamId, continuityMethod) and manifest-ID chain continuity.
437
+ * The live-video and BMFF hash fields of the result come only from assertions whose
438
+ * hash matches a claim reference. Check `isValid` before you use any field.
439
+ * A validator for an implementer-defined continuity method can be registered
440
+ * via {@link ManifestBoxValidationOptions}.
441
+ *
442
+ * This function is **pure** — it does not access any external state. The
443
+ * caller is responsible for persisting `nextManifestId` and `nextState`
444
+ * between calls. A segment that fails verification, is on another stream, or
445
+ * does not move the sequence number forward returns the received
446
+ * `lastManifestId` and `state` unchanged. A segment that fails only the
447
+ * continuity check still updates them.
448
+ *
449
+ * @param bytes - Raw segment bytes
450
+ * @param lastManifestId - Manifest ID from the last segment that updated the state, or `null` for the first segment
451
+ * @param state - Optional state from the last segment that updated the state, for the streamId and sequenceNumber checks
452
+ * @param options - Optional custom continuity method validator
453
+ * @returns Validation result, the manifest ID, and state to persist for the next call
454
+ *
455
+ * @example
456
+ * {@includeCode ../../test/manifestbox/validateC2paManifestBoxSegment.test.ts#example}
457
+ *
458
+ * @public
459
+ */
460
+ export declare function validateC2paManifestBoxSegment(bytes: Uint8Array, lastManifestId: string | null, state?: ManifestBoxValidationState, options?: ManifestBoxValidationOptions): Promise<{
463
461
  readonly result: ManifestBoxValidationResult;
464
462
  readonly nextManifestId: string | null;
465
463
  readonly nextState: ManifestBoxValidationState;
@@ -467,23 +465,23 @@ declare function validateC2paManifestBoxSegment(bytes: Uint8Array, lastManifestI
467
465
  //#endregion
468
466
  //#region src/merkle/validateC2paMerkleSegment.d.ts
469
467
  /**
470
- * Validates a fragmented MP4 VOD media segment against the init manifest's
471
- * merkle maps (§15.12.2.2). Pure: the caller persists `nextState` and resets
472
- * `state` after a seek.
473
- *
474
- * `merkleMaps` must be non-empty; the caller is responsible for only calling
475
- * this in VOD Merkle mode (i.e. after `InitSegmentValidation.merkleMaps` came
476
- * back non-empty).
477
- *
478
- * @example
479
- * {@includeCode ../../test/merkle/validateC2paMerkleSegment.test.ts#example}
480
- *
481
- * @public
482
- */
483
- declare function validateC2paMerkleSegment(segmentBytes: Uint8Array, merkleMaps: readonly MerkleMap[], state?: MerkleSegmentState): Promise<{
468
+ * Validates a fragmented MP4 VOD media segment against the init manifest's
469
+ * merkle maps (§15.12.2.2). Pure: the caller persists `nextState` and resets
470
+ * `state` after a seek.
471
+ *
472
+ * `merkleMaps` must be non-empty; the caller is responsible for only calling
473
+ * this in VOD Merkle mode (i.e. after `InitSegmentValidation.merkleMaps` came
474
+ * back non-empty).
475
+ *
476
+ * @example
477
+ * {@includeCode ../../test/merkle/validateC2paMerkleSegment.test.ts#example}
478
+ *
479
+ * @public
480
+ */
481
+ export declare function validateC2paMerkleSegment(segmentBytes: Uint8Array, merkleMaps: readonly MerkleMap[], state?: MerkleSegmentState): Promise<{
484
482
  readonly result: MerkleSegmentValidation;
485
483
  readonly nextState: MerkleSegmentState;
486
484
  }>;
487
485
  //#endregion
488
- export { BmffHashConstraint, BmffHashExclusion, C2paAssertion, C2paManifest, C2paSignatureInfo, C2paStatusCode, CoseKeyJwk, InitSegmentValidation, LiveVideoStatusCode, ManifestBoxContinuityValidator, ManifestBoxValidationOptions, ManifestBoxValidationResult, ManifestBoxValidationState, MerkleMap, MerkleSegmentState, MerkleSegmentValidation, SegmentValidationResult, type SequenceState, SequenceValidationReason, type SequenceValidationResult, ValidatedSessionKey, validateC2paInitSegment, validateC2paManifestBoxSegment, validateC2paMerkleSegment, validateC2paSegment };
486
+ export type { BmffHashConstraint, BmffHashExclusion, C2paAssertion, C2paManifest, C2paSignatureInfo, CoseKeyJwk, InitSegmentValidation, ManifestBoxContinuityValidator, ManifestBoxValidationOptions, ManifestBoxValidationResult, ManifestBoxValidationState, MerkleMap, MerkleSegmentState, MerkleSegmentValidation, SegmentValidationResult, SequenceState, SequenceValidationResult, ValidatedSessionKey };
489
487
  //# sourceMappingURL=index.d.ts.map