@contentauth/c2pa-types 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,28 +5,8 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
- /**
9
- * Assertions in C2PA can be stored in several formats
10
- */
11
- export type ManifestAssertionKind = "Cbor" | "Json" | "Binary" | "Uri";
12
8
  export type UriOrResource = ResourceRef | HashedUri;
13
9
  export type DateT = string;
14
- /**
15
- * The type of shape for the range.
16
- */
17
- export type ShapeType = "rectangle" | "circle" | "polygon";
18
- /**
19
- * The type of unit for the range.
20
- */
21
- export type UnitType = "pixel" | "percent";
22
- /**
23
- * The type of time.
24
- */
25
- export type TimeType = "npt";
26
- /**
27
- * The type of range for the region of interest.
28
- */
29
- export type RangeType = "spatial" | "temporal" | "frame" | "textual" | "identified";
30
10
  /**
31
11
  * A role describing the region.
32
12
  */
@@ -41,13 +21,14 @@ export type Role =
41
21
  | "c2pa.styled"
42
22
  | "c2pa.watermarked";
43
23
  /**
44
- * The relationship of the ingredient to the current asset.
24
+ * Assertions in C2PA can be stored in several formats
45
25
  */
46
- export type Relationship = "parentOf" | "componentOf" | "inputTo";
26
+ export type ManifestAssertionKind = "Cbor" | "Json" | "Binary" | "Uri";
47
27
  /**
48
28
  * Represents the type of builder flow being used.
49
29
  *
50
- * This determines how the builder will be used, such as creating a new asset, opening an existing asset, or updating an existing asset.
30
+ * This determines how the builder will be used, such as creating a new asset, opening an existing asset,
31
+ * or updating an existing asset.
51
32
  */
52
33
  export type BuilderIntent =
53
34
  | {
@@ -58,7 +39,9 @@ export type BuilderIntent =
58
39
  /**
59
40
  * Description of the source of an asset.
60
41
  *
61
- * The full list of possible digital source types are found below: <https://spec.c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_digital_source_type> <https://cv.iptc.org/newscodes/digitalsourcetype>
42
+ * The full list of possible digital source types are found below:
43
+ * <https://spec.c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_digital_source_type>
44
+ * <https://cv.iptc.org/newscodes/digitalsourcetype>
62
45
  */
63
46
  export type DigitalSourceType =
64
47
  | "http://c2pa.org/digitalsourcetype/empty"
@@ -83,101 +66,126 @@ export type DigitalSourceType =
83
66
  | "http://cv.iptc.org/newscodes/digitalsourcetype/composite"
84
67
  | "http://cv.iptc.org/newscodes/digitalsourcetype/compositeCapture"
85
68
  | "http://cv.iptc.org/newscodes/digitalsourcetype/compositeSynthetic"
86
- | {
87
- Other: string;
88
- };
69
+ | string;
89
70
 
90
71
  /**
91
72
  * Use a Builder to add a signed manifest to an asset.
92
73
  *
93
74
  * # Example: Building and signing a manifest
94
75
  *
95
- * ```ignore-wasm32 use c2pa::Result; use std::path::PathBuf;
76
+ * ```ignore-wasm32
77
+ * use c2pa::Result;
78
+ * use std::path::PathBuf;
96
79
  *
97
- * use c2pa::{create_signer, Builder, SigningAlg}; use serde::Serialize; use serde_json::json; use tempfile::tempdir;
80
+ * use c2pa::{create_signer, Builder, SigningAlg};
81
+ * use serde::Serialize;
82
+ * use serde_json::json;
83
+ * use tempfile::tempdir;
98
84
  *
99
- * #[derive(Serialize)] struct Test { my_tag: usize, }
85
+ * #[derive(Serialize)]
86
+ * struct Test {
87
+ * my_tag: usize,
88
+ * }
100
89
  *
101
- * # fn main() -> Result<()> { #[cfg(feature = "file_io")] { let manifest_json = json!({ "claim_generator_info": [ { "name": "c2pa_test", "version": "1.0.0" } ], "title": "Test_Manifest" }).to_string();
90
+ * # fn main() -> Result<()> {
91
+ * #[cfg(feature = "file_io")]
92
+ * {
93
+ * let manifest_json = json!({
94
+ * "claim_generator_info": [
95
+ * {
96
+ * "name": "c2pa_test",
97
+ * "version": "1.0.0"
98
+ * }
99
+ * ],
100
+ * "title": "Test_Manifest"
101
+ * }).to_string();
102
102
  *
103
- * let mut builder = Builder::from_json(&manifest_json)?; builder.add_assertion("org.contentauth.test", &Test { my_tag: 42 })?;
103
+ * let mut builder = Builder::from_json(&manifest_json)?;
104
+ * builder.add_assertion("org.contentauth.test", &Test { my_tag: 42 })?;
104
105
  *
105
- * let source = PathBuf::from("tests/fixtures/C.jpg"); let dir = tempdir()?; let dest = dir.path().join("test_file.jpg");
106
+ * let source = PathBuf::from("tests/fixtures/C.jpg");
107
+ * let dir = tempdir()?;
108
+ * let dest = dir.path().join("test_file.jpg");
106
109
  *
107
- * // Create a ps256 signer using certs and key files. TO DO: Update example. let signcert_path = "tests/fixtures/certs/ps256.pub"; let pkey_path = "tests/fixtures/certs/ps256.pem"; let signer = create_signer::from_files(signcert_path, pkey_path, SigningAlg::Ps256, None)?;
110
+ * // Create a ps256 signer using certs and key files. TO DO: Update example.
111
+ * let signcert_path = "tests/fixtures/certs/ps256.pub";
112
+ * let pkey_path = "tests/fixtures/certs/ps256.pem";
113
+ * let signer = create_signer::from_files(signcert_path, pkey_path, SigningAlg::Ps256, None)?;
108
114
  *
109
- * // embed a manifest using the signer builder.sign_file( signer.as_ref(), &source, &dest)?; } # Ok(()) # } ```
115
+ * // embed a manifest using the signer
116
+ * builder.sign_file(
117
+ * signer.as_ref(),
118
+ * &source,
119
+ * &dest)?;
120
+ * }
121
+ * # Ok(())
122
+ * # }
123
+ * ```
110
124
  */
111
125
  export interface Builder {
112
126
  /**
113
- * A list of assertions
127
+ * The version of the claim. Defaults to 2.
114
128
  */
115
- assertions?: AssertionDefinition[];
129
+ claim_version?: number | null;
130
+ /**
131
+ * Optional prefix added to the generated Manifest Label
132
+ * This is typically a reverse domain name.
133
+ */
134
+ vendor?: string | null;
116
135
  /**
117
- * Claim Generator Info is always required with at least one entry
136
+ * Claim Generator Info is always required with an entry
118
137
  */
119
138
  claim_generator_info?: ClaimGeneratorInfo[];
120
139
  /**
121
- * The version of the claim. Defaults to 2.
140
+ * Optional manifest metadata. This will be deprecated in the future; not recommended to use.
122
141
  */
123
- claim_version?: number | null;
142
+ metadata?: AssertionMetadata[] | null;
124
143
  /**
125
- * The format of the source file as a MIME type.
144
+ * A human-readable title, generally source filename.
126
145
  */
127
- format?: string;
146
+ title?: string | null;
128
147
  /**
129
- * A List of ingredients
148
+ * The format of the source file as a MIME type.
130
149
  */
131
- ingredients?: Ingredient[];
150
+ format?: string;
132
151
  /**
133
152
  * Instance ID from `xmpMM:InstanceID` in XMP metadata.
134
153
  */
135
154
  instance_id?: string;
136
155
  /**
137
- * A builder should construct a created, opened or updated manifest.
138
- */
139
- intent?: BuilderIntent | null;
140
- /**
141
- * Allows you to pre-define the manifest label, which must be unique. Not intended for general use. If not set, it will be assigned automatically.
156
+ * An optional ResourceRef to a thumbnail image that represents the asset that was signed.
157
+ * Must be available when the manifest is signed.
142
158
  */
143
- label?: string | null;
159
+ thumbnail?: ResourceRef | null;
144
160
  /**
145
- * Optional manifest metadata. This will be deprecated in the future; not recommended to use.
161
+ * A List of ingredients
146
162
  */
147
- metadata?: AssertionMetadata[] | null;
163
+ ingredients?: Ingredient[];
148
164
  /**
149
- * If true, the manifest store will not be embedded in the asset on sign
165
+ * A list of assertions
150
166
  */
151
- no_embed: boolean;
167
+ assertions?: AssertionDefinition[];
152
168
  /**
153
169
  * A list of redactions - URIs to redacted assertions.
154
170
  */
155
171
  redactions?: string[] | null;
156
172
  /**
157
- * Optional remote URL for the manifest
173
+ * Allows you to pre-define the manifest label, which must be unique.
174
+ * Not intended for general use. If not set, it will be assigned automatically.
158
175
  */
159
- remote_url?: string | null;
176
+ label?: string | null;
160
177
  /**
161
- * An optional ResourceRef to a thumbnail image that represents the asset that was signed. Must be available when the manifest is signed.
178
+ * Optional remote URL for the manifest
162
179
  */
163
- thumbnail?: ResourceRef | null;
180
+ remote_url?: string | null;
164
181
  /**
165
- * A human-readable title, generally source filename.
182
+ * If true, the manifest store will not be embedded in the asset on sign
166
183
  */
167
- title?: string | null;
184
+ no_embed: boolean;
168
185
  /**
169
- * Optional prefix added to the generated Manifest Label This is typically a reverse domain name.
186
+ * A builder should construct a created, opened or updated manifest.
170
187
  */
171
- vendor?: string | null;
172
- [k: string]: unknown;
173
- }
174
- /**
175
- * Defines an assertion that consists of a label that can be either a C2PA-defined assertion label or a custom label in reverse domain format.
176
- */
177
- export interface AssertionDefinition {
178
- data: unknown;
179
- kind?: ManifestAssertionKind | null;
180
- label: string;
188
+ intent?: BuilderIntent | null;
181
189
  [k: string]: unknown;
182
190
  }
183
191
  /**
@@ -186,22 +194,22 @@ export interface AssertionDefinition {
186
194
  * This structure is also used for actions softwareAgent
187
195
  */
188
196
  export interface ClaimGeneratorInfo {
189
- /**
190
- * hashed URI to the icon (either embedded or remote)
191
- */
192
- icon?: UriOrResource | null;
193
197
  /**
194
198
  * A human readable string naming the claim_generator
195
199
  */
196
200
  name: string;
197
- /**
198
- * A human readable string of the OS the claim generator is running on
199
- */
200
- operating_system?: string | null;
201
201
  /**
202
202
  * A human readable string of the product's version
203
203
  */
204
204
  version?: string | null;
205
+ /**
206
+ * hashed URI to the icon (either embedded or remote)
207
+ */
208
+ icon?: UriOrResource | null;
209
+ /**
210
+ * A human readable string of the OS the claim generator is running on
211
+ */
212
+ operating_system?: string | null;
205
213
  [k: string]: unknown;
206
214
  }
207
215
  /**
@@ -211,27 +219,29 @@ export interface ClaimGeneratorInfo {
211
219
  */
212
220
  export interface ResourceRef {
213
221
  /**
214
- * The algorithm used to hash the resource (if applicable).
222
+ * The mime type of the referenced resource.
215
223
  */
216
- alg?: string | null;
224
+ format: string;
225
+ /**
226
+ * A URI that identifies the resource as referenced from the manifest.
227
+ *
228
+ * This may be a JUMBF URI, a file path, a URL or any other string.
229
+ * Relative JUMBF URIs will be resolved with the manifest label.
230
+ * Relative file paths will be resolved with the base path if provided.
231
+ */
232
+ identifier: string;
217
233
  /**
218
234
  * More detailed data types as defined in the C2PA spec.
219
235
  */
220
236
  data_types?: AssetType[] | null;
221
237
  /**
222
- * The mime type of the referenced resource.
238
+ * The algorithm used to hash the resource (if applicable).
223
239
  */
224
- format: string;
240
+ alg?: string | null;
225
241
  /**
226
242
  * The hash of the resource (if applicable).
227
243
  */
228
244
  hash?: string | null;
229
- /**
230
- * A URI that identifies the resource as referenced from the manifest.
231
- *
232
- * This may be a JUMBF URI, a file path, a URL or any other string. Relative JUMBF URIs will be resolved with the manifest label. Relative file paths will be resolved with the base path if provided.
233
- */
234
- identifier: string;
235
245
  [k: string]: unknown;
236
246
  }
237
247
  export interface AssetType {
@@ -240,125 +250,38 @@ export interface AssetType {
240
250
  [k: string]: unknown;
241
251
  }
242
252
  /**
243
- * A `HashedUri` provides a reference to content available within the same manifest store.
253
+ * A `HashedUri` provides a reference to content available within the same
254
+ * manifest store.
244
255
  *
245
- * This is described in [§8.3, URI References], of the C2PA Technical Specification.
256
+ * This is described in [§8.3, URI References], of the C2PA Technical
257
+ * Specification.
246
258
  *
247
259
  * [§8.3, URI References]: https://c2pa.org/specifications/specifications/2.1/specs/C2PA_Specification.html#_uri_references
248
260
  */
249
261
  export interface HashedUri {
250
- /**
251
- * A string identifying the cryptographic hash algorithm used to compute the hash
252
- */
253
- alg?: string | null;
254
- /**
255
- * Byte string containing the hash value
256
- */
257
- hash: number[];
258
262
  /**
259
263
  * JUMBF URI reference
260
264
  */
261
265
  url: string;
262
- [k: string]: unknown;
263
- }
264
- /**
265
- * An `Ingredient` is any external asset that has been used in the creation of an asset.
266
- */
267
- export interface Ingredient {
268
- /**
269
- * The active manifest label (if one exists).
270
- *
271
- * If this ingredient has a [`ManifestStore`], this will hold the label of the active [`Manifest`].
272
- *
273
- * [`Manifest`]: crate::Manifest [`ManifestStore`]: crate::ManifestStore
274
- */
275
- active_manifest?: string | null;
276
- /**
277
- * A reference to the actual data of the ingredient.
278
- */
279
- data?: ResourceRef | null;
280
- /**
281
- * Additional information about the data's type to the ingredient V2 structure.
282
- */
283
- data_types?: AssetType[] | null;
284
- /**
285
- * Additional description of the ingredient.
286
- */
287
- description?: string | null;
288
- /**
289
- * Document ID from `xmpMM:DocumentID` in XMP metadata.
290
- */
291
- document_id?: string | null;
292
- /**
293
- * The format of the source file as a MIME type.
294
- */
295
- format?: string | null;
296
- /**
297
- * An optional hash of the asset to prevent duplicates.
298
- */
299
- hash?: string | null;
300
- /**
301
- * URI to an informational page about the ingredient or its data.
302
- */
303
- informational_URI?: string | null;
304
- /**
305
- * Instance ID from `xmpMM:InstanceID` in XMP metadata.
306
- */
307
- instance_id?: string | null;
308
- /**
309
- * The ingredient's label as assigned in the manifest.
310
- */
311
- label?: string | null;
312
- /**
313
- * A [`ManifestStore`] from the source asset extracted as a binary C2PA blob.
314
- *
315
- * [`ManifestStore`]: crate::ManifestStore
316
- */
317
- manifest_data?: ResourceRef | null;
318
- /**
319
- * Any additional [`Metadata`] as defined in the C2PA spec.
320
- *
321
- * [`Metadata`]: crate::Metadata
322
- */
323
- metadata?: AssertionMetadata | null;
324
- ocsp_responses?: ResourceRef[] | null;
325
- /**
326
- * URI from `dcterms:provenance` in XMP metadata.
327
- */
328
- provenance?: string | null;
329
- /**
330
- * Set to `ParentOf` if this is the parent ingredient.
331
- *
332
- * There can only be one parent ingredient in the ingredients.
333
- */
334
- relationship?: Relationship & string;
335
- resources?: ResourceStore;
336
- /**
337
- * A thumbnail image capturing the visual state at the time of import.
338
- *
339
- * A tuple of thumbnail MIME format (for example `image/jpeg`) and binary bits of the image.
340
- */
341
- thumbnail?: ResourceRef | null;
342
- /**
343
- * A human-readable title, generally source filename.
344
- */
345
- title?: string | null;
346
266
  /**
347
- * Validation results (Ingredient.V3)
267
+ * A string identifying the cryptographic hash algorithm used to compute
268
+ * the hash
348
269
  */
349
- validation_results?: ValidationResults | null;
270
+ alg?: string | null;
350
271
  /**
351
- * Validation status (Ingredient v1 & v2)
272
+ * Byte string containing the hash value
352
273
  */
353
- validation_status?: ValidationStatus[] | null;
274
+ hash: number[];
354
275
  [k: string]: unknown;
355
276
  }
356
277
  /**
357
278
  * The AssertionMetadata structure can be used as part of other assertions or on its own to reference others
358
279
  */
359
280
  export interface AssertionMetadata {
360
- dataSource?: DataSource | null;
281
+ reviewRatings?: ReviewRating[] | null;
361
282
  dateTime?: DateT | null;
283
+ reference?: HashedUri | null;
284
+ dataSource?: DataSource | null;
362
285
  localizations?:
363
286
  | {
364
287
  [k: string]: {
@@ -366,9 +289,18 @@ export interface AssertionMetadata {
366
289
  };
367
290
  }[]
368
291
  | null;
369
- reference?: HashedUri | null;
370
292
  regionOfInterest?: RegionOfInterest | null;
371
- reviewRatings?: ReviewRating[] | null;
293
+ [k: string]: unknown;
294
+ }
295
+ /**
296
+ * A rating on an Assertion.
297
+ *
298
+ * See <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_review_ratings>.
299
+ */
300
+ export interface ReviewRating {
301
+ explanation: string;
302
+ code?: string | null;
303
+ value: number;
372
304
  [k: string]: unknown;
373
305
  }
374
306
  /**
@@ -376,137 +308,124 @@ export interface AssertionMetadata {
376
308
  */
377
309
  export interface DataSource {
378
310
  /**
379
- * A list of [`Actor`]s associated with this source.
311
+ * A value from among the enumerated list indicating the source of the assertion.
380
312
  */
381
- actors?: Actor[] | null;
313
+ type: string;
382
314
  /**
383
315
  * A human-readable string giving details about the source of the assertion data.
384
316
  */
385
317
  details?: string | null;
386
318
  /**
387
- * A value from among the enumerated list indicating the source of the assertion.
319
+ * A list of [`Actor`]s associated with this source.
388
320
  */
389
- type: string;
321
+ actors?: Actor[] | null;
390
322
  [k: string]: unknown;
391
323
  }
392
324
  /**
393
325
  * Identifies a person responsible for an action.
394
326
  */
395
327
  export interface Actor {
396
- /**
397
- * List of references to W3C Verifiable Credentials.
398
- */
399
- credentials?: HashedUri[] | null;
400
328
  /**
401
329
  * An identifier for a human actor, used when the "type" is `humanEntry.identified`.
402
330
  */
403
331
  identifier?: string | null;
332
+ /**
333
+ * List of references to W3C Verifiable Credentials.
334
+ */
335
+ credentials?: HashedUri[] | null;
404
336
  [k: string]: unknown;
405
337
  }
406
338
  /**
407
339
  * A region of interest within an asset describing the change.
408
340
  *
409
- * This struct can be used from [`Action::changes`][crate::assertions::Action::changes], [`AssertionMetadata::region_of_interest`][crate::assertions::AssertionMetadata::region_of_interest], or [`SoftBindingScope::region`][crate::assertions::soft_binding::SoftBindingScope::region].
341
+ * This struct can be used from [`Action::changes`][crate::assertions::Action::changes],
342
+ * [`AssertionMetadata::region_of_interest`][crate::assertions::AssertionMetadata::region_of_interest], or
343
+ * [`SoftBindingScope::region`][crate::assertions::soft_binding::SoftBindingScope::region].
410
344
  */
411
345
  export interface RegionOfInterest {
412
346
  /**
413
- * A free-text string.
414
- */
415
- description?: string | null;
416
- /**
417
- * A free-text string representing a machine-readable, unique to this assertion, identifier for the region.
418
- */
419
- identifier?: string | null;
420
- /**
421
- * Additional information about the asset.
347
+ * A range describing the region of interest for the specific asset.
422
348
  */
423
- metadata?: AssertionMetadata | null;
349
+ region: Range[];
424
350
  /**
425
351
  * A free-text string representing a human-readable name for the region which might be used in a user interface.
426
352
  */
427
353
  name?: string | null;
428
354
  /**
429
- * A range describing the region of interest for the specific asset.
430
- */
431
- region: Range[];
432
- /**
433
- * A value from our controlled vocabulary or an entity-specific value (e.g., com.litware.coolArea) that represents the role of a region among other regions.
355
+ * A free-text string representing a machine-readable, unique to this assertion, identifier for the region.
434
356
  */
435
- role?: Role | null;
357
+ identifier?: string | null;
436
358
  /**
437
- * A value from a controlled vocabulary such as <https://cv.iptc.org/newscodes/imageregiontype/> or an entity-specific value (e.g., com.litware.newType) that represents the type of thing(s) depicted by a region.
359
+ * A value from a controlled vocabulary such as <https://cv.iptc.org/newscodes/imageregiontype/> or an entity-specific
360
+ * value (e.g., com.litware.newType) that represents the type of thing(s) depicted by a region.
438
361
  *
439
362
  * Note this field serializes/deserializes into the name `type`.
440
363
  */
441
364
  type?: string | null;
442
- [k: string]: unknown;
443
- }
444
- /**
445
- * A spatial, temporal, frame, or textual range describing the region of interest.
446
- */
447
- export interface Range {
448
365
  /**
449
- * A frame range.
366
+ * A value from our controlled vocabulary or an entity-specific value (e.g., com.litware.coolArea) that represents
367
+ * the role of a region among other regions.
450
368
  */
451
- frame?: Frame | null;
369
+ role?: Role | null;
452
370
  /**
453
- * A item identifier.
371
+ * A free-text string.
454
372
  */
455
- item?: Item | null;
373
+ description?: string | null;
456
374
  /**
457
- * A spatial range.
375
+ * Additional information about the asset.
458
376
  */
459
- shape?: Shape | null;
377
+ metadata?: AssertionMetadata | null;
378
+ [k: string]: unknown;
379
+ }
380
+ /**
381
+ * A spatial, temporal, frame, or textual range describing the region of interest.
382
+ */
383
+ export interface Range {
460
384
  /**
461
- * A textual range.
385
+ * The type of range of interest.
462
386
  */
463
- text?: Text | null;
387
+ type: "spatial" | "temporal" | "frame" | "textual" | "identified";
388
+ /**
389
+ * A spatial range.
390
+ */
391
+ shape?: Shape | null;
464
392
  /**
465
393
  * A temporal range.
466
394
  */
467
395
  time?: Time | null;
468
396
  /**
469
- * The type of range of interest.
397
+ * A frame range.
470
398
  */
471
- type: RangeType;
472
- [k: string]: unknown;
473
- }
474
- /**
475
- * A frame range representing starting and ending frames or pages.
476
- *
477
- * If both `start` and `end` are missing, the frame will span the entire asset.
478
- */
479
- export interface Frame {
399
+ frame?: Frame | null;
480
400
  /**
481
- * The end of the frame inclusive or the end of the asset if not present.
401
+ * A textual range.
482
402
  */
483
- end?: number | null;
403
+ text?: Text | null;
484
404
  /**
485
- * The start of the frame or the end of the asset if not present.
486
- *
487
- * The first frame/page starts at 0.
405
+ * A item identifier.
488
406
  */
489
- start?: number | null;
407
+ item?: Item | null;
490
408
  [k: string]: unknown;
491
409
  }
492
410
  /**
493
- * Description of the boundaries of an identified range.
411
+ * A spatial range representing rectangle, circle, or a polygon.
494
412
  */
495
- export interface Item {
413
+ export interface Shape {
496
414
  /**
497
- * The container-specific term used to identify items, such as "track_id" for MP4 or "item_ID" for HEIF.
415
+ * The type of shape.
498
416
  */
499
- identifier: string;
417
+ type: "rectangle" | "circle" | "polygon";
500
418
  /**
501
- * The value of the identifier, e.g. a value of "2" for an identifier of "track_id" would imply track 2 of the asset.
419
+ * The type of unit for the shape range.
502
420
  */
503
- value: string;
504
- [k: string]: unknown;
505
- }
506
- /**
507
- * A spatial range representing rectangle, circle, or a polygon.
508
- */
509
- export interface Shape {
421
+ unit: "pixel" | "percent";
422
+ origin: Coordinate;
423
+ /**
424
+ * The width for rectangles or diameter for circles.
425
+ *
426
+ * This field can be ignored for polygons.
427
+ */
428
+ width?: number | null;
510
429
  /**
511
430
  * The height of a rectnagle.
512
431
  *
@@ -519,36 +438,32 @@ export interface Shape {
519
438
  * The default value is true.
520
439
  */
521
440
  inside?: boolean | null;
522
- /**
523
- * THe origin of the coordinate in the shape.
524
- */
525
- origin: Coordinate;
526
- /**
527
- * The type of shape.
528
- */
529
- type: ShapeType;
530
- /**
531
- * The type of unit for the shape range.
532
- */
533
- unit: UnitType;
534
441
  /**
535
442
  * The vertices of the polygon.
536
443
  *
537
444
  * This field can be ignored for rectangles and circles.
538
445
  */
539
- vertices?: Coordinate[] | null;
446
+ vertices?: Coordinate1[] | null;
447
+ [k: string]: unknown;
448
+ }
449
+ /**
450
+ * THe origin of the coordinate in the shape.
451
+ */
452
+ export interface Coordinate {
453
+ /**
454
+ * The coordinate along the x-axis.
455
+ */
456
+ x: number;
540
457
  /**
541
- * The width for rectangles or diameter for circles.
542
- *
543
- * This field can be ignored for polygons.
458
+ * The coordinate along the y-axis.
544
459
  */
545
- width?: number | null;
460
+ y: number;
546
461
  [k: string]: unknown;
547
462
  }
548
463
  /**
549
464
  * An x, y coordinate used for specifying vertices in polygons.
550
465
  */
551
- export interface Coordinate {
466
+ export interface Coordinate1 {
552
467
  /**
553
468
  * The coordinate along the x-axis.
554
469
  */
@@ -559,6 +474,42 @@ export interface Coordinate {
559
474
  y: number;
560
475
  [k: string]: unknown;
561
476
  }
477
+ /**
478
+ * A temporal range representing a starting time to an ending time.
479
+ */
480
+ export interface Time {
481
+ /**
482
+ * The type of time.
483
+ */
484
+ type?: "npt";
485
+ /**
486
+ * The start time or the start of the asset if not present.
487
+ */
488
+ start?: string | null;
489
+ /**
490
+ * The end time or the end of the asset if not present.
491
+ */
492
+ end?: string | null;
493
+ [k: string]: unknown;
494
+ }
495
+ /**
496
+ * A frame range representing starting and ending frames or pages.
497
+ *
498
+ * If both `start` and `end` are missing, the frame will span the entire asset.
499
+ */
500
+ export interface Frame {
501
+ /**
502
+ * The start of the frame or the end of the asset if not present.
503
+ *
504
+ * The first frame/page starts at 0.
505
+ */
506
+ start?: number | null;
507
+ /**
508
+ * The end of the frame inclusive or the end of the asset if not present.
509
+ */
510
+ end?: number | null;
511
+ [k: string]: unknown;
512
+ }
562
513
  /**
563
514
  * A textual range representing multiple (possibly discontinuous) ranges of text.
564
515
  */
@@ -573,26 +524,37 @@ export interface Text {
573
524
  * One or two [`TextSelector`][TextSelector] identifiying the range to select.
574
525
  */
575
526
  export interface TextSelectorRange {
527
+ selector: TextSelector;
576
528
  /**
577
529
  * The end of the text range.
578
530
  */
579
- end?: TextSelector | null;
580
- /**
581
- * The start (or entire) text range.
582
- */
583
- selector: TextSelector;
531
+ end?: TextSelector1 | null;
584
532
  [k: string]: unknown;
585
533
  }
586
534
  /**
587
- * Selects a range of text via a fragment identifier.
588
- *
589
- * This is modeled after the W3C Web Annotation selector model.
535
+ * The start (or entire) text range.
590
536
  */
591
537
  export interface TextSelector {
538
+ /**
539
+ * Fragment identifier as per RFC3023 (XML) or ISO 32000-2 (PDF), Annex O.
540
+ */
541
+ fragment: string;
542
+ /**
543
+ * The start character offset or the start of the fragment if not present.
544
+ */
545
+ start?: number | null;
592
546
  /**
593
547
  * The end character offset or the end of the fragment if not present.
594
548
  */
595
549
  end?: number | null;
550
+ [k: string]: unknown;
551
+ }
552
+ /**
553
+ * Selects a range of text via a fragment identifier.
554
+ *
555
+ * This is modeled after the W3C Web Annotation selector model.
556
+ */
557
+ export interface TextSelector1 {
596
558
  /**
597
559
  * Fragment identifier as per RFC3023 (XML) or ISO 32000-2 (PDF), Annex O.
598
560
  */
@@ -601,54 +563,148 @@ export interface TextSelector {
601
563
  * The start character offset or the start of the fragment if not present.
602
564
  */
603
565
  start?: number | null;
566
+ /**
567
+ * The end character offset or the end of the fragment if not present.
568
+ */
569
+ end?: number | null;
604
570
  [k: string]: unknown;
605
571
  }
606
572
  /**
607
- * A temporal range representing a starting time to an ending time.
573
+ * Description of the boundaries of an identified range.
608
574
  */
609
- export interface Time {
610
- /**
611
- * The end time or the end of the asset if not present.
612
- */
613
- end?: string | null;
575
+ export interface Item {
614
576
  /**
615
- * The start time or the start of the asset if not present.
577
+ * The container-specific term used to identify items, such as "track_id" for MP4 or "item_ID" for HEIF.
616
578
  */
617
- start?: string | null;
579
+ identifier: string;
618
580
  /**
619
- * The type of time.
581
+ * The value of the identifier, e.g. a value of "2" for an identifier of "track_id" would imply track 2 of the asset.
620
582
  */
621
- type?: TimeType & string;
583
+ value: string;
622
584
  [k: string]: unknown;
623
585
  }
624
586
  /**
625
- * A rating on an Assertion.
626
- *
627
- * See <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_review_ratings>.
587
+ * An `Ingredient` is any external asset that has been used in the creation of an asset.
628
588
  */
629
- export interface ReviewRating {
630
- code?: string | null;
631
- explanation: string;
632
- value: number;
589
+ export interface Ingredient {
590
+ /**
591
+ * A human-readable title, generally source filename.
592
+ */
593
+ title?: string | null;
594
+ /**
595
+ * The format of the source file as a MIME type.
596
+ */
597
+ format?: string | null;
598
+ /**
599
+ * Document ID from `xmpMM:DocumentID` in XMP metadata.
600
+ */
601
+ document_id?: string | null;
602
+ /**
603
+ * Instance ID from `xmpMM:InstanceID` in XMP metadata.
604
+ */
605
+ instance_id?: string | null;
606
+ /**
607
+ * URI from `dcterms:provenance` in XMP metadata.
608
+ */
609
+ provenance?: string | null;
610
+ /**
611
+ * A thumbnail image capturing the visual state at the time of import.
612
+ *
613
+ * A tuple of thumbnail MIME format (for example `image/jpeg`) and binary bits of the image.
614
+ */
615
+ thumbnail?: ResourceRef | null;
616
+ /**
617
+ * An optional hash of the asset to prevent duplicates.
618
+ */
619
+ hash?: string | null;
620
+ /**
621
+ * Set to `ParentOf` if this is the parent ingredient.
622
+ *
623
+ * There can only be one parent ingredient in the ingredients.
624
+ */
625
+ relationship?: "parentOf" | "componentOf" | "inputTo";
626
+ /**
627
+ * The active manifest label (if one exists).
628
+ *
629
+ * If this ingredient has a [`ManifestStore`],
630
+ * this will hold the label of the active [`Manifest`].
631
+ *
632
+ * [`Manifest`]: crate::Manifest
633
+ * [`ManifestStore`]: crate::ManifestStore
634
+ */
635
+ active_manifest?: string | null;
636
+ /**
637
+ * Validation status (Ingredient v1 & v2)
638
+ */
639
+ validation_status?: ValidationStatus[] | null;
640
+ /**
641
+ * Validation results (Ingredient.V3)
642
+ */
643
+ validation_results?: ValidationResults | null;
644
+ /**
645
+ * A reference to the actual data of the ingredient.
646
+ */
647
+ data?: ResourceRef | null;
648
+ /**
649
+ * Additional description of the ingredient.
650
+ */
651
+ description?: string | null;
652
+ /**
653
+ * URI to an informational page about the ingredient or its data.
654
+ */
655
+ informational_URI?: string | null;
656
+ /**
657
+ * Any additional [`Metadata`] as defined in the C2PA spec.
658
+ *
659
+ * [`Metadata`]: crate::Metadata
660
+ */
661
+ metadata?: AssertionMetadata | null;
662
+ /**
663
+ * Additional information about the data's type to the ingredient V2 structure.
664
+ */
665
+ data_types?: AssetType[] | null;
666
+ /**
667
+ * A [`ManifestStore`] from the source asset extracted as a binary C2PA blob.
668
+ *
669
+ * [`ManifestStore`]: crate::ManifestStore
670
+ */
671
+ manifest_data?: ResourceRef | null;
672
+ /**
673
+ * The ingredient's label as assigned in the manifest.
674
+ */
675
+ label?: string | null;
676
+ ocsp_responses?: ResourceRef[] | null;
633
677
  [k: string]: unknown;
634
678
  }
635
679
  /**
636
- * Resource store to contain binary objects referenced from JSON serializable structures
680
+ * A `ValidationStatus` struct describes the validation status of a
681
+ * specific part of a manifest.
682
+ *
683
+ * See <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_existing_manifests>.
637
684
  */
638
- export interface ResourceStore {
639
- label?: string | null;
640
- resources: {
641
- [k: string]: number[];
642
- };
685
+ export interface ValidationStatus {
686
+ code: string;
687
+ url?: string | null;
688
+ explanation?: string | null;
689
+ success?: boolean | null;
643
690
  [k: string]: unknown;
644
691
  }
645
692
  /**
646
693
  * A map of validation results for a manifest store.
647
694
  *
648
- * The map contains the validation results for the active manifest and any ingredient deltas. It is normal for there to be many
695
+ * The map contains the validation results for the active manifest and any ingredient deltas.
696
+ * It is normal for there to be many
649
697
  */
650
698
  export interface ValidationResults {
699
+ /**
700
+ * Validation status codes for the ingredient's active manifest. Present if ingredient is a C2PA
701
+ * asset. Not present if the ingredient is not a C2PA asset.
702
+ */
651
703
  activeManifest?: StatusCodes | null;
704
+ /**
705
+ * List of any changes/deltas between the current and previous validation results for each ingredient's
706
+ * manifest. Present if the the ingredient is a C2PA asset.
707
+ */
652
708
  ingredientDeltas?: IngredientDeltaValidationResult[] | null;
653
709
  [k: string]: unknown;
654
710
  }
@@ -656,21 +712,15 @@ export interface ValidationResults {
656
712
  * Contains a set of success, informational, and failure validation status codes.
657
713
  */
658
714
  export interface StatusCodes {
659
- failure: ValidationStatus[];
660
- informational: ValidationStatus[];
715
+ /**
716
+ * An array of validation success codes. May be empty.
717
+ */
661
718
  success: ValidationStatus[];
662
- [k: string]: unknown;
663
- }
664
- /**
665
- * A `ValidationStatus` struct describes the validation status of a specific part of a manifest.
666
- *
667
- * See <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_existing_manifests>.
668
- */
669
- export interface ValidationStatus {
670
- code: string;
671
- explanation?: string | null;
672
- success?: boolean | null;
673
- url?: string | null;
719
+ /**
720
+ * An array of validation informational codes. May be empty.
721
+ */
722
+ informational: ValidationStatus[];
723
+ failure: ValidationStatus[];
674
724
  [k: string]: unknown;
675
725
  }
676
726
  /**
@@ -681,9 +731,41 @@ export interface IngredientDeltaValidationResult {
681
731
  * JUMBF URI reference to the ingredient assertion
682
732
  */
683
733
  ingredientAssertionURI: string;
734
+ validationDeltas: StatusCodes1;
735
+ [k: string]: unknown;
736
+ }
737
+ /**
738
+ * Contains a set of success, informational, and failure validation status codes.
739
+ */
740
+ export interface StatusCodes1 {
741
+ /**
742
+ * An array of validation success codes. May be empty.
743
+ */
744
+ success: ValidationStatus[];
745
+ /**
746
+ * An array of validation informational codes. May be empty.
747
+ */
748
+ informational: ValidationStatus[];
749
+ failure: ValidationStatus[];
750
+ [k: string]: unknown;
751
+ }
752
+ /**
753
+ * Defines an assertion that consists of a label that can be either
754
+ * a C2PA-defined assertion label or a custom label in reverse domain format.
755
+ */
756
+ export interface AssertionDefinition {
757
+ /**
758
+ * An assertion label in reverse domain format
759
+ */
760
+ label: string;
761
+ data: unknown;
762
+ /**
763
+ * The kind of assertion data, either Cbor or Json (defaults to Cbor)
764
+ */
765
+ kind?: ManifestAssertionKind | null;
684
766
  /**
685
- * Validation results for the ingredient's active manifest
767
+ * True if this assertion is attributed to the signer (defaults to false)
686
768
  */
687
- validationDeltas: StatusCodes;
769
+ created?: boolean;
688
770
  [k: string]: unknown;
689
771
  }