@contentauth/c2pa-types 0.4.1 → 0.4.3

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