@contentauth/c2pa-types 0.2.1 → 0.3.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.
@@ -0,0 +1,525 @@
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 DateT = string;
9
+ /**
10
+ * The type of shape for the range.
11
+ */
12
+ export type ShapeType = "rectangle" | "circle" | "polygon";
13
+ /**
14
+ * The type of unit for the range.
15
+ */
16
+ export type UnitType = "pixel" | "percent";
17
+ /**
18
+ * The type of time.
19
+ */
20
+ export type TimeType = "npt";
21
+ /**
22
+ * The type of range for the region of interest.
23
+ */
24
+ export type RangeType = "spatial" | "temporal" | "frame" | "textual" | "identified";
25
+ /**
26
+ * A role describing the region.
27
+ */
28
+ export type Role =
29
+ | "c2pa.areaOfInterest"
30
+ | "c2pa.cropped"
31
+ | "c2pa.edited"
32
+ | "c2pa.placed"
33
+ | "c2pa.redacted"
34
+ | "c2pa.subjectArea"
35
+ | "c2pa.deleted"
36
+ | "c2pa.styled"
37
+ | "c2pa.watermarked";
38
+ /**
39
+ * The relationship of the ingredient to the current asset.
40
+ */
41
+ export type Relationship = "parentOf" | "componentOf" | "inputTo";
42
+
43
+ /**
44
+ * An `Ingredient` is any external asset that has been used in the creation of an asset.
45
+ */
46
+ export interface Ingredient {
47
+ /**
48
+ * The active manifest label (if one exists).
49
+ *
50
+ * If this ingredient has a [`ManifestStore`], this will hold the label of the active [`Manifest`].
51
+ *
52
+ * [`Manifest`]: crate::Manifest [`ManifestStore`]: crate::ManifestStore
53
+ */
54
+ active_manifest?: string | null;
55
+ /**
56
+ * A reference to the actual data of the ingredient.
57
+ */
58
+ data?: ResourceRef | null;
59
+ /**
60
+ * Additional information about the data's type to the ingredient V2 structure.
61
+ */
62
+ data_types?: AssetType[] | null;
63
+ /**
64
+ * Additional description of the ingredient.
65
+ */
66
+ description?: string | null;
67
+ /**
68
+ * Document ID from `xmpMM:DocumentID` in XMP metadata.
69
+ */
70
+ document_id?: string | null;
71
+ /**
72
+ * The format of the source file as a MIME type.
73
+ */
74
+ format?: string | null;
75
+ /**
76
+ * An optional hash of the asset to prevent duplicates.
77
+ */
78
+ hash?: string | null;
79
+ /**
80
+ * URI to an informational page about the ingredient or its data.
81
+ */
82
+ informational_URI?: string | null;
83
+ /**
84
+ * Instance ID from `xmpMM:InstanceID` in XMP metadata.
85
+ */
86
+ instance_id?: string | null;
87
+ /**
88
+ * The ingredient's label as assigned in the manifest.
89
+ */
90
+ label?: string | null;
91
+ /**
92
+ * A [`ManifestStore`] from the source asset extracted as a binary C2PA blob.
93
+ *
94
+ * [`ManifestStore`]: crate::ManifestStore
95
+ */
96
+ manifest_data?: ResourceRef | null;
97
+ /**
98
+ * Any additional [`Metadata`] as defined in the C2PA spec.
99
+ *
100
+ * [`Metadata`]: crate::Metadata
101
+ */
102
+ metadata?: AssertionMetadata | null;
103
+ ocsp_responses?: ResourceRef[] | null;
104
+ /**
105
+ * URI from `dcterms:provenance` in XMP metadata.
106
+ */
107
+ provenance?: string | null;
108
+ /**
109
+ * Set to `ParentOf` if this is the parent ingredient.
110
+ *
111
+ * There can only be one parent ingredient in the ingredients.
112
+ */
113
+ relationship?: Relationship & string;
114
+ resources?: ResourceStore;
115
+ /**
116
+ * A thumbnail image capturing the visual state at the time of import.
117
+ *
118
+ * A tuple of thumbnail MIME format (for example `image/jpeg`) and binary bits of the image.
119
+ */
120
+ thumbnail?: ResourceRef | null;
121
+ /**
122
+ * A human-readable title, generally source filename.
123
+ */
124
+ title?: string | null;
125
+ /**
126
+ * Validation results (Ingredient.V3)
127
+ */
128
+ validation_results?: ValidationResults | null;
129
+ /**
130
+ * Validation status (Ingredient v1 & v2)
131
+ */
132
+ validation_status?: ValidationStatus[] | null;
133
+ [k: string]: unknown;
134
+ }
135
+ /**
136
+ * A reference to a resource to be used in JSON serialization.
137
+ *
138
+ * The underlying data can be read as a stream via [`Reader::resource_to_stream`][crate::Reader::resource_to_stream].
139
+ */
140
+ export interface ResourceRef {
141
+ /**
142
+ * The algorithm used to hash the resource (if applicable).
143
+ */
144
+ alg?: string | null;
145
+ /**
146
+ * More detailed data types as defined in the C2PA spec.
147
+ */
148
+ data_types?: AssetType[] | null;
149
+ /**
150
+ * The mime type of the referenced resource.
151
+ */
152
+ format: string;
153
+ /**
154
+ * The hash of the resource (if applicable).
155
+ */
156
+ hash?: string | null;
157
+ /**
158
+ * A URI that identifies the resource as referenced from the manifest.
159
+ *
160
+ * 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.
161
+ */
162
+ identifier: string;
163
+ [k: string]: unknown;
164
+ }
165
+ export interface AssetType {
166
+ type: string;
167
+ version?: string | null;
168
+ [k: string]: unknown;
169
+ }
170
+ /**
171
+ * The AssertionMetadata structure can be used as part of other assertions or on its own to reference others
172
+ */
173
+ export interface AssertionMetadata {
174
+ dataSource?: DataSource | null;
175
+ dateTime?: DateT | null;
176
+ localizations?:
177
+ | {
178
+ [k: string]: {
179
+ [k: string]: string;
180
+ };
181
+ }[]
182
+ | null;
183
+ reference?: HashedUri | null;
184
+ regionOfInterest?: RegionOfInterest | null;
185
+ reviewRatings?: ReviewRating[] | null;
186
+ [k: string]: unknown;
187
+ }
188
+ /**
189
+ * A description of the source for assertion data
190
+ */
191
+ export interface DataSource {
192
+ /**
193
+ * A list of [`Actor`]s associated with this source.
194
+ */
195
+ actors?: Actor[] | null;
196
+ /**
197
+ * A human-readable string giving details about the source of the assertion data.
198
+ */
199
+ details?: string | null;
200
+ /**
201
+ * A value from among the enumerated list indicating the source of the assertion.
202
+ */
203
+ type: string;
204
+ [k: string]: unknown;
205
+ }
206
+ /**
207
+ * Identifies a person responsible for an action.
208
+ */
209
+ export interface Actor {
210
+ /**
211
+ * List of references to W3C Verifiable Credentials.
212
+ */
213
+ credentials?: HashedUri[] | null;
214
+ /**
215
+ * An identifier for a human actor, used when the "type" is `humanEntry.identified`.
216
+ */
217
+ identifier?: string | null;
218
+ [k: string]: unknown;
219
+ }
220
+ /**
221
+ * A `HashedUri` provides a reference to content available within the same manifest store.
222
+ *
223
+ * This is described in [§8.3, URI References], of the C2PA Technical Specification.
224
+ *
225
+ * [§8.3, URI References]: https://c2pa.org/specifications/specifications/2.1/specs/C2PA_Specification.html#_uri_references
226
+ */
227
+ export interface HashedUri {
228
+ /**
229
+ * A string identifying the cryptographic hash algorithm used to compute the hash
230
+ */
231
+ alg?: string | null;
232
+ /**
233
+ * Byte string containing the hash value
234
+ */
235
+ hash: number[];
236
+ /**
237
+ * JUMBF URI reference
238
+ */
239
+ url: string;
240
+ [k: string]: unknown;
241
+ }
242
+ /**
243
+ * A region of interest within an asset describing the change.
244
+ *
245
+ * 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].
246
+ */
247
+ export interface RegionOfInterest {
248
+ /**
249
+ * A free-text string.
250
+ */
251
+ description?: string | null;
252
+ /**
253
+ * A free-text string representing a machine-readable, unique to this assertion, identifier for the region.
254
+ */
255
+ identifier?: string | null;
256
+ /**
257
+ * Additional information about the asset.
258
+ */
259
+ metadata?: AssertionMetadata | null;
260
+ /**
261
+ * A free-text string representing a human-readable name for the region which might be used in a user interface.
262
+ */
263
+ name?: string | null;
264
+ /**
265
+ * A range describing the region of interest for the specific asset.
266
+ */
267
+ region: Range[];
268
+ /**
269
+ * 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.
270
+ */
271
+ role?: Role | null;
272
+ /**
273
+ * 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.
274
+ *
275
+ * Note this field serializes/deserializes into the name `type`.
276
+ */
277
+ type?: string | null;
278
+ [k: string]: unknown;
279
+ }
280
+ /**
281
+ * A spatial, temporal, frame, or textual range describing the region of interest.
282
+ */
283
+ export interface Range {
284
+ /**
285
+ * A frame range.
286
+ */
287
+ frame?: Frame | null;
288
+ /**
289
+ * A item identifier.
290
+ */
291
+ item?: Item | null;
292
+ /**
293
+ * A spatial range.
294
+ */
295
+ shape?: Shape | null;
296
+ /**
297
+ * A textual range.
298
+ */
299
+ text?: Text | null;
300
+ /**
301
+ * A temporal range.
302
+ */
303
+ time?: Time | null;
304
+ /**
305
+ * The type of range of interest.
306
+ */
307
+ type: RangeType;
308
+ [k: string]: unknown;
309
+ }
310
+ /**
311
+ * A frame range representing starting and ending frames or pages.
312
+ *
313
+ * If both `start` and `end` are missing, the frame will span the entire asset.
314
+ */
315
+ export interface Frame {
316
+ /**
317
+ * The end of the frame inclusive or the end of the asset if not present.
318
+ */
319
+ end?: number | null;
320
+ /**
321
+ * The start of the frame or the end of the asset if not present.
322
+ *
323
+ * The first frame/page starts at 0.
324
+ */
325
+ start?: number | null;
326
+ [k: string]: unknown;
327
+ }
328
+ /**
329
+ * Description of the boundaries of an identified range.
330
+ */
331
+ export interface Item {
332
+ /**
333
+ * The container-specific term used to identify items, such as "track_id" for MP4 or "item_ID" for HEIF.
334
+ */
335
+ identifier: string;
336
+ /**
337
+ * The value of the identifier, e.g. a value of "2" for an identifier of "track_id" would imply track 2 of the asset.
338
+ */
339
+ value: string;
340
+ [k: string]: unknown;
341
+ }
342
+ /**
343
+ * A spatial range representing rectangle, circle, or a polygon.
344
+ */
345
+ export interface Shape {
346
+ /**
347
+ * The height of a rectnagle.
348
+ *
349
+ * This field can be ignored for circles and polygons.
350
+ */
351
+ height?: number | null;
352
+ /**
353
+ * If the range is inside the shape.
354
+ *
355
+ * The default value is true.
356
+ */
357
+ inside?: boolean | null;
358
+ /**
359
+ * THe origin of the coordinate in the shape.
360
+ */
361
+ origin: Coordinate;
362
+ /**
363
+ * The type of shape.
364
+ */
365
+ type: ShapeType;
366
+ /**
367
+ * The type of unit for the shape range.
368
+ */
369
+ unit: UnitType;
370
+ /**
371
+ * The vertices of the polygon.
372
+ *
373
+ * This field can be ignored for rectangles and circles.
374
+ */
375
+ vertices?: Coordinate[] | null;
376
+ /**
377
+ * The width for rectangles or diameter for circles.
378
+ *
379
+ * This field can be ignored for polygons.
380
+ */
381
+ width?: number | null;
382
+ [k: string]: unknown;
383
+ }
384
+ /**
385
+ * An x, y coordinate used for specifying vertices in polygons.
386
+ */
387
+ export interface Coordinate {
388
+ /**
389
+ * The coordinate along the x-axis.
390
+ */
391
+ x: number;
392
+ /**
393
+ * The coordinate along the y-axis.
394
+ */
395
+ y: number;
396
+ [k: string]: unknown;
397
+ }
398
+ /**
399
+ * A textual range representing multiple (possibly discontinuous) ranges of text.
400
+ */
401
+ export interface Text {
402
+ /**
403
+ * The ranges of text to select.
404
+ */
405
+ selectors: TextSelectorRange[];
406
+ [k: string]: unknown;
407
+ }
408
+ /**
409
+ * One or two [`TextSelector`][TextSelector] identifiying the range to select.
410
+ */
411
+ export interface TextSelectorRange {
412
+ /**
413
+ * The end of the text range.
414
+ */
415
+ end?: TextSelector | null;
416
+ /**
417
+ * The start (or entire) text range.
418
+ */
419
+ selector: TextSelector;
420
+ [k: string]: unknown;
421
+ }
422
+ /**
423
+ * Selects a range of text via a fragment identifier.
424
+ *
425
+ * This is modeled after the W3C Web Annotation selector model.
426
+ */
427
+ export interface TextSelector {
428
+ /**
429
+ * The end character offset or the end of the fragment if not present.
430
+ */
431
+ end?: number | null;
432
+ /**
433
+ * Fragment identifier as per RFC3023 (XML) or ISO 32000-2 (PDF), Annex O.
434
+ */
435
+ fragment: string;
436
+ /**
437
+ * The start character offset or the start of the fragment if not present.
438
+ */
439
+ start?: number | null;
440
+ [k: string]: unknown;
441
+ }
442
+ /**
443
+ * A temporal range representing a starting time to an ending time.
444
+ */
445
+ export interface Time {
446
+ /**
447
+ * The end time or the end of the asset if not present.
448
+ */
449
+ end?: string | null;
450
+ /**
451
+ * The start time or the start of the asset if not present.
452
+ */
453
+ start?: string | null;
454
+ /**
455
+ * The type of time.
456
+ */
457
+ type?: TimeType & string;
458
+ [k: string]: unknown;
459
+ }
460
+ /**
461
+ * A rating on an Assertion.
462
+ *
463
+ * See <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_review_ratings>.
464
+ */
465
+ export interface ReviewRating {
466
+ code?: string | null;
467
+ explanation: string;
468
+ value: number;
469
+ [k: string]: unknown;
470
+ }
471
+ /**
472
+ * Resource store to contain binary objects referenced from JSON serializable structures
473
+ */
474
+ export interface ResourceStore {
475
+ label?: string | null;
476
+ resources: {
477
+ [k: string]: number[];
478
+ };
479
+ [k: string]: unknown;
480
+ }
481
+ /**
482
+ * A map of validation results for a manifest store.
483
+ *
484
+ * The map contains the validation results for the active manifest and any ingredient deltas. It is normal for there to be many
485
+ */
486
+ export interface ValidationResults {
487
+ activeManifest?: StatusCodes | null;
488
+ ingredientDeltas?: IngredientDeltaValidationResult[] | null;
489
+ [k: string]: unknown;
490
+ }
491
+ /**
492
+ * Contains a set of success, informational, and failure validation status codes.
493
+ */
494
+ export interface StatusCodes {
495
+ failure: ValidationStatus[];
496
+ informational: ValidationStatus[];
497
+ success: ValidationStatus[];
498
+ [k: string]: unknown;
499
+ }
500
+ /**
501
+ * A `ValidationStatus` struct describes the validation status of a specific part of a manifest.
502
+ *
503
+ * See <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_existing_manifests>.
504
+ */
505
+ export interface ValidationStatus {
506
+ code: string;
507
+ explanation?: string | null;
508
+ success?: boolean | null;
509
+ url?: string | null;
510
+ [k: string]: unknown;
511
+ }
512
+ /**
513
+ * Represents any changes or deltas between the current and previous validation results for an ingredient's manifest.
514
+ */
515
+ export interface IngredientDeltaValidationResult {
516
+ /**
517
+ * JUMBF URI reference to the ingredient assertion
518
+ */
519
+ ingredientAssertionURI: string;
520
+ /**
521
+ * Validation results for the ingredient's active manifest
522
+ */
523
+ validationDeltas: StatusCodes;
524
+ [k: string]: unknown;
525
+ }