···11{
22 "$schema": "http://json-schema.org/draft-07/schema#",
33- "title": "Reader",
44- "description": "Use a Reader to read and validate a manifest store.",
33+ "title": "Everything",
54 "type": "object",
66- "required": [
77- "manifests"
88- ],
55+ "required": ["builder", "manifest_definition", "reader"],
96 "properties": {
1010- "active_manifest": {
1111- "description": "A label for the active (most recent) manifest in the store",
1212- "type": [
1313- "string",
1414- "null"
1515- ]
77+ "builder": {
88+ "$ref": "#/definitions/Builder"
169 },
1717- "manifests": {
1818- "description": "A HashMap of Manifests",
1919- "type": "object",
2020- "additionalProperties": {
2121- "$ref": "#/definitions/Manifest"
2222- }
1010+ "manifest_definition": {
1111+ "$ref": "#/definitions/ManifestDefinition"
2312 },
2424- "validation_results": {
2525- "description": "ValidationStatus generated when loading the ManifestStore from an asset",
2626- "anyOf": [
2727- {
2828- "$ref": "#/definitions/ValidationResults"
2929- },
3030- {
3131- "type": "null"
3232- }
3333- ]
3434- },
3535- "validation_state": {
3636- "description": "The validation state of the manifest store",
3737- "anyOf": [
3838- {
3939- "$ref": "#/definitions/ValidationState"
4040- },
4141- {
4242- "type": "null"
4343- }
4444- ]
4545- },
4646- "validation_status": {
4747- "description": "ValidationStatus generated when loading the ManifestStore from an asset",
4848- "type": [
4949- "array",
5050- "null"
5151- ],
5252- "items": {
5353- "$ref": "#/definitions/ValidationStatus"
5454- }
1313+ "reader": {
1414+ "$ref": "#/definitions/Reader"
5515 }
5616 },
5717 "definitions": {
···6121 "properties": {
6222 "credentials": {
6323 "description": "List of references to W3C Verifiable Credentials.",
6464- "type": [
6565- "array",
6666- "null"
6767- ],
2424+ "type": ["array", "null"],
6825 "items": {
6926 "$ref": "#/definitions/HashedUri"
7027 }
7128 },
7229 "identifier": {
7330 "description": "An identifier for a human actor, used when the \"type\" is `humanEntry.identified`.",
7474- "type": [
7575- "string",
7676- "null"
7777- ]
3131+ "type": ["string", "null"]
3232+ }
3333+ }
3434+ },
3535+ "AssertionData": {
3636+ "description": "This allows the assertion to be expressed as CBOR or JSON. The default is CBOR unless you specify that an assertion should be JSON.",
3737+ "anyOf": [true]
3838+ },
3939+ "AssertionDefinition": {
4040+ "description": "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.",
4141+ "type": "object",
4242+ "required": ["data", "label"],
4343+ "properties": {
4444+ "data": {
4545+ "$ref": "#/definitions/AssertionData"
4646+ },
4747+ "label": {
4848+ "type": "string"
7849 }
7950 }
8051 },
···12394 ]
12495 },
12596 "reviewRatings": {
126126- "type": [
127127- "array",
128128- "null"
129129- ],
9797+ "type": ["array", "null"],
13098 "items": {
13199 "$ref": "#/definitions/ReviewRating"
132100 }
···135103 },
136104 "AssetType": {
137105 "type": "object",
138138- "required": [
139139- "type"
140140- ],
106106+ "required": ["type"],
141107 "properties": {
142108 "type": {
143109 "type": "string"
144110 },
145111 "version": {
146146- "type": [
147147- "string",
148148- "null"
112112+ "type": ["string", "null"]
113113+ }
114114+ }
115115+ },
116116+ "Builder": {
117117+ "description": "Use a Builder to add a signed manifest to an asset.\n\n# Example: Building and signing a manifest\n\n``` use c2pa::Result; use std::path::PathBuf;\n\nuse c2pa::{create_signer, Builder, SigningAlg}; use serde::Serialize; use serde_json::json; use tempfile::tempdir;\n\n#[derive(Serialize)] struct Test { my_tag: usize, }\n\n# 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();\n\nlet mut builder = Builder::from_json(&manifest_json)?; builder.add_assertion(\"org.contentauth.test\", &Test { my_tag: 42 })?;\n\nlet source = PathBuf::from(\"tests/fixtures/C.jpg\"); let dir = tempdir()?; let dest = dir.path().join(\"test_file.jpg\");\n\n// 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)?;\n\n// embed a manifest using the signer builder.sign_file( signer.as_ref(), &source, &dest)?; } # Ok(()) # } ```",
118118+ "type": "object",
119119+ "required": ["no_embed"],
120120+ "properties": {
121121+ "assertions": {
122122+ "description": "A list of assertions",
123123+ "default": [],
124124+ "type": "array",
125125+ "items": {
126126+ "$ref": "#/definitions/AssertionDefinition"
127127+ }
128128+ },
129129+ "base_path": {
130130+ "description": "Base path to search for resources.",
131131+ "type": ["string", "null"]
132132+ },
133133+ "builder_flow": {
134134+ "description": "The type of builder being used.",
135135+ "anyOf": [
136136+ {
137137+ "$ref": "#/definitions/BuilderFlow"
138138+ },
139139+ {
140140+ "type": "null"
141141+ }
149142 ]
143143+ },
144144+ "claim_generator_info": {
145145+ "description": "Claim Generator Info is always required with at least one entry",
146146+ "default": [
147147+ {
148148+ "name": "c2pa-rs",
149149+ "version": "0.58.0"
150150+ }
151151+ ],
152152+ "type": "array",
153153+ "items": {
154154+ "$ref": "#/definitions/ClaimGeneratorInfo"
155155+ }
156156+ },
157157+ "claim_version": {
158158+ "description": "The version of the claim. Defaults to 1.",
159159+ "type": ["integer", "null"],
160160+ "format": "uint8",
161161+ "minimum": 0.0
162162+ },
163163+ "format": {
164164+ "description": "The format of the source file as a MIME type.",
165165+ "default": "application/octet-stream",
166166+ "type": "string"
167167+ },
168168+ "ingredients": {
169169+ "description": "A List of ingredients",
170170+ "default": [],
171171+ "type": "array",
172172+ "items": {
173173+ "$ref": "#/definitions/Ingredient"
174174+ }
175175+ },
176176+ "instance_id": {
177177+ "description": "Instance ID from `xmpMM:InstanceID` in XMP metadata.",
178178+ "default": "xmp:iid:ad854dd7-b8f6-46cf-93d5-9e0607131a38",
179179+ "type": "string"
180180+ },
181181+ "label": {
182182+ "description": "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.",
183183+ "type": ["string", "null"]
184184+ },
185185+ "metadata": {
186186+ "description": "Optional manifest metadata. This will be deprecated in the future; not recommended to use.",
187187+ "type": ["array", "null"],
188188+ "items": {
189189+ "$ref": "#/definitions/AssertionMetadata"
190190+ }
191191+ },
192192+ "no_embed": {
193193+ "description": "If true, the manifest store will not be embedded in the asset on sign",
194194+ "type": "boolean"
195195+ },
196196+ "redactions": {
197197+ "description": "A list of redactions - URIs to redacted assertions.",
198198+ "type": ["array", "null"],
199199+ "items": {
200200+ "type": "string"
201201+ }
202202+ },
203203+ "remote_url": {
204204+ "description": "Optional remote URL for the manifest",
205205+ "type": ["string", "null"]
206206+ },
207207+ "thumbnail": {
208208+ "description": "An optional ResourceRef to a thumbnail image that represents the asset that was signed. Must be available when the manifest is signed.",
209209+ "anyOf": [
210210+ {
211211+ "$ref": "#/definitions/ResourceRef"
212212+ },
213213+ {
214214+ "type": "null"
215215+ }
216216+ ]
217217+ },
218218+ "title": {
219219+ "description": "A human-readable title, generally source filename.",
220220+ "type": ["string", "null"]
221221+ },
222222+ "vendor": {
223223+ "description": "Optional prefix added to the generated Manifest Label This is typically a reverse domain name.",
224224+ "type": ["string", "null"]
150225 }
151226 }
152227 },
228228+ "BuilderFlow": {
229229+ "description": "Represents the type of builder flow being used.\n\nThis determines how the builder will be used, such as creating a new asset, opening an existing asset, or updating an existing asset.",
230230+ "oneOf": [
231231+ {
232232+ "type": "string",
233233+ "enum": ["Open", "Update"]
234234+ },
235235+ {
236236+ "type": "object",
237237+ "required": ["Create"],
238238+ "properties": {
239239+ "Create": {
240240+ "$ref": "#/definitions/DigitalSourceType"
241241+ }
242242+ },
243243+ "additionalProperties": false
244244+ }
245245+ ]
246246+ },
153247 "ClaimGeneratorInfo": {
154248 "description": "Description of the claim generator, or the software used in generating the claim.\n\nThis structure is also used for actions softwareAgent",
155249 "type": "object",
156156- "required": [
157157- "name"
158158- ],
250250+ "required": ["name"],
159251 "properties": {
160252 "icon": {
161253 "description": "hashed URI to the icon (either embedded or remote)",
···174266 },
175267 "operating_system": {
176268 "description": "A human readable string of the OS the claim generator is running on",
177177- "type": [
178178- "string",
179179- "null"
180180- ]
269269+ "type": ["string", "null"]
181270 },
182271 "version": {
183272 "description": "A human readable string of the product's version",
184184- "type": [
185185- "string",
186186- "null"
187187- ]
273273+ "type": ["string", "null"]
188274 }
189275 },
190276 "additionalProperties": true
···192278 "Coordinate": {
193279 "description": "An x, y coordinate used for specifying vertices in polygons.",
194280 "type": "object",
195195- "required": [
196196- "x",
197197- "y"
198198- ],
281281+ "required": ["x", "y"],
199282 "properties": {
200283 "x": {
201284 "description": "The coordinate along the x-axis.",
···212295 "DataSource": {
213296 "description": "A description of the source for assertion data",
214297 "type": "object",
215215- "required": [
216216- "type"
217217- ],
298298+ "required": ["type"],
218299 "properties": {
219300 "actors": {
220301 "description": "A list of [`Actor`]s associated with this source.",
221221- "type": [
222222- "array",
223223- "null"
224224- ],
302302+ "type": ["array", "null"],
225303 "items": {
226304 "$ref": "#/definitions/Actor"
227305 }
228306 },
229307 "details": {
230308 "description": "A human-readable string giving details about the source of the assertion data.",
231231- "type": [
232232- "string",
233233- "null"
234234- ]
309309+ "type": ["string", "null"]
235310 },
236311 "type": {
237312 "description": "A value from among the enumerated list indicating the source of the assertion.",
···242317 "DateT": {
243318 "type": "string"
244319 },
320320+ "DigitalSourceType": {
321321+ "oneOf": [
322322+ {
323323+ "description": "Media whose digital content is effectively empty, such as a blank canvas or zero-length video.",
324324+ "type": "string",
325325+ "enum": ["Empty"]
326326+ },
327327+ {
328328+ "description": "Data that is the result of algorithmically using a model derived from sampled content and data. Differs from <http://cv.iptc.org/newscodes/digitalsourcetype/>trainedAlgorithmicMedia in that the result isn’t a media type (e.g., image or video) but is a data format (e.g., CSV, pickle).",
329329+ "type": "string",
330330+ "enum": ["TrainedAlgorithmicData"]
331331+ }
332332+ ]
333333+ },
245334 "Frame": {
246335 "description": "A frame range representing starting and ending frames or pages.\n\nIf both `start` and `end` are missing, the frame will span the entire asset.",
247336 "type": "object",
248337 "properties": {
249338 "end": {
250339 "description": "The end of the frame inclusive or the end of the asset if not present.",
251251- "type": [
252252- "integer",
253253- "null"
254254- ],
340340+ "type": ["integer", "null"],
255341 "format": "int32"
256342 },
257343 "start": {
258344 "description": "The start of the frame or the end of the asset if not present.\n\nThe first frame/page starts at 0.",
259259- "type": [
260260- "integer",
261261- "null"
262262- ],
345345+ "type": ["integer", "null"],
263346 "format": "int32"
264347 }
265348 }
···267350 "HashedUri": {
268351 "description": "A `HashedUri` provides a reference to content available within the same manifest store.\n\nThis is described in [§8.3, URI References], of the C2PA Technical Specification.\n\n[§8.3, URI References]: https://c2pa.org/specifications/specifications/2.1/specs/C2PA_Specification.html#_uri_references",
269352 "type": "object",
270270- "required": [
271271- "hash",
272272- "url"
273273- ],
353353+ "required": ["hash", "url"],
274354 "properties": {
275355 "alg": {
276356 "description": "A string identifying the cryptographic hash algorithm used to compute the hash",
277277- "type": [
278278- "string",
279279- "null"
280280- ]
357357+ "type": ["string", "null"]
281358 },
282359 "hash": {
283360 "description": "Byte string containing the hash value",
···300377 "properties": {
301378 "active_manifest": {
302379 "description": "The active manifest label (if one exists).\n\nIf this ingredient has a [`ManifestStore`], this will hold the label of the active [`Manifest`].\n\n[`Manifest`]: crate::Manifest [`ManifestStore`]: crate::ManifestStore",
303303- "type": [
304304- "string",
305305- "null"
306306- ]
380380+ "type": ["string", "null"]
307381 },
308382 "data": {
309383 "description": "A reference to the actual data of the ingredient.",
···318392 },
319393 "data_types": {
320394 "description": "Additional information about the data's type to the ingredient V2 structure.",
321321- "type": [
322322- "array",
323323- "null"
324324- ],
395395+ "type": ["array", "null"],
325396 "items": {
326397 "$ref": "#/definitions/AssetType"
327398 }
328399 },
329400 "description": {
330401 "description": "Additional description of the ingredient.",
331331- "type": [
332332- "string",
333333- "null"
334334- ]
402402+ "type": ["string", "null"]
335403 },
336404 "document_id": {
337405 "description": "Document ID from `xmpMM:DocumentID` in XMP metadata.",
338338- "type": [
339339- "string",
340340- "null"
341341- ]
406406+ "type": ["string", "null"]
342407 },
343408 "format": {
344409 "description": "The format of the source file as a MIME type.",
345345- "type": [
346346- "string",
347347- "null"
348348- ]
410410+ "type": ["string", "null"]
349411 },
350412 "hash": {
351413 "description": "An optional hash of the asset to prevent duplicates.",
352352- "type": [
353353- "string",
354354- "null"
355355- ]
414414+ "type": ["string", "null"]
356415 },
357416 "informational_URI": {
358417 "description": "URI to an informational page about the ingredient or its data.",
359359- "type": [
360360- "string",
361361- "null"
362362- ]
418418+ "type": ["string", "null"]
363419 },
364420 "instance_id": {
365421 "description": "Instance ID from `xmpMM:InstanceID` in XMP metadata.",
366366- "type": [
367367- "string",
368368- "null"
369369- ]
422422+ "type": ["string", "null"]
370423 },
371424 "label": {
372425 "description": "The ingredient's label as assigned in the manifest.",
373373- "type": [
374374- "string",
375375- "null"
376376- ]
426426+ "type": ["string", "null"]
377427 },
378428 "manifest_data": {
379429 "description": "A [`ManifestStore`] from the source asset extracted as a binary C2PA blob.\n\n[`ManifestStore`]: crate::ManifestStore",
···399449 },
400450 "provenance": {
401451 "description": "URI from `dcterms:provenance` in XMP metadata.",
402402- "type": [
403403- "string",
404404- "null"
405405- ]
452452+ "type": ["string", "null"]
406453 },
407454 "relationship": {
408455 "description": "Set to `ParentOf` if this is the parent ingredient.\n\nThere can only be one parent ingredient in the ingredients.",
···434481 },
435482 "title": {
436483 "description": "A human-readable title, generally source filename.",
437437- "type": [
438438- "string",
439439- "null"
440440- ]
484484+ "type": ["string", "null"]
441485 },
442486 "validation_results": {
443487 "description": "Validation results (Ingredient.V3)",
···452496 },
453497 "validation_status": {
454498 "description": "Validation status (Ingredient v1 & v2)",
455455- "type": [
456456- "array",
457457- "null"
458458- ],
499499+ "type": ["array", "null"],
459500 "items": {
460501 "$ref": "#/definitions/ValidationStatus"
461502 }
···465506 "IngredientDeltaValidationResult": {
466507 "description": "Represents any changes or deltas between the current and previous validation results for an ingredient's manifest.",
467508 "type": "object",
468468- "required": [
469469- "ingredientAssertionURI",
470470- "validationDeltas"
471471- ],
509509+ "required": ["ingredientAssertionURI", "validationDeltas"],
472510 "properties": {
473511 "ingredientAssertionURI": {
474512 "description": "JUMBF URI reference to the ingredient assertion",
···487525 "Item": {
488526 "description": "Description of the boundaries of an identified range.",
489527 "type": "object",
490490- "required": [
491491- "identifier",
492492- "value"
493493- ],
528528+ "required": ["identifier", "value"],
494529 "properties": {
495530 "identifier": {
496531 "description": "The container-specific term used to identify items, such as \"track_id\" for MP4 or \"item_ID\" for HEIF.",
···516551 },
517552 "claim_generator": {
518553 "description": "A User Agent formatted string identifying the software/hardware/system produced this claim Spaces are not allowed in names, versions can be specified with product/1.0 syntax.",
519519- "type": [
520520- "string",
521521- "null"
522522- ]
554554+ "type": ["string", "null"]
523555 },
524556 "claim_generator_info": {
525557 "description": "A list of claim generator info data identifying the software/hardware/system produced this claim.",
526526- "type": [
527527- "array",
528528- "null"
529529- ],
558558+ "type": ["array", "null"],
530559 "items": {
531560 "$ref": "#/definitions/ClaimGeneratorInfo"
532561 }
533562 },
534563 "credentials": {
535564 "description": "A List of verified credentials",
536536- "type": [
537537- "array",
538538- "null"
539539- ],
565565+ "type": ["array", "null"],
540566 "items": true
541567 },
542568 "format": {
543569 "description": "The format of the source file as a MIME type.",
544544- "type": [
545545- "string",
546546- "null"
547547- ]
570570+ "type": ["string", "null"]
548571 },
549572 "ingredients": {
550573 "description": "A List of ingredients",
···556579 },
557580 "instance_id": {
558581 "description": "Instance ID from `xmpMM:InstanceID` in XMP metadata.",
559559- "default": "xmp:iid:855e296c-2f54-4a0a-ae5a-0659b3bca8b8",
582582+ "default": "xmp:iid:162c4576-2f5c-4852-93ad-e15b784e19e8",
560583 "type": "string"
561584 },
562585 "label": {
563563- "type": [
564564- "string",
565565- "null"
566566- ]
586586+ "type": ["string", "null"]
567587 },
568588 "metadata": {
569589 "description": "A list of user metadata for this claim.",
570570- "type": [
571571- "array",
572572- "null"
573573- ],
590590+ "type": ["array", "null"],
574591 "items": {
575592 "$ref": "#/definitions/AssertionMetadata"
576593 }
577594 },
578595 "redactions": {
579596 "description": "A list of redactions - URIs to a redacted assertions",
580580- "type": [
581581- "array",
582582- "null"
583583- ],
597597+ "type": ["array", "null"],
584598 "items": {
585599 "type": "string"
586600 }
···617631 },
618632 "title": {
619633 "description": "A human-readable title, generally source filename.",
620620- "type": [
621621- "string",
622622- "null"
623623- ]
634634+ "type": ["string", "null"]
624635 },
625636 "vendor": {
626637 "description": "Optional prefix added to the generated Manifest label. This is typically an internet domain name for the vendor (i.e. `adobe`).",
627627- "type": [
628628- "string",
629629- "null"
630630- ]
638638+ "type": ["string", "null"]
631639 }
632640 }
633641 },
634642 "ManifestAssertion": {
635643 "description": "A labeled container for an Assertion value in a Manifest",
636644 "type": "object",
637637- "required": [
638638- "data",
639639- "label"
640640- ],
645645+ "required": ["data", "label"],
641646 "properties": {
642647 "data": {
643648 "description": "The data of the assertion as Value",
···649654 },
650655 "instance": {
651656 "description": "There can be more than one assertion for any label",
652652- "type": [
653653- "integer",
654654- "null"
655655- ],
657657+ "type": ["integer", "null"],
656658 "format": "uint",
657659 "minimum": 0.0
658660 },
···676678 "ManifestAssertionKind": {
677679 "description": "Assertions in C2PA can be stored in several formats",
678680 "type": "string",
679679- "enum": [
680680- "Cbor",
681681- "Json",
682682- "Binary",
683683- "Uri"
684684- ]
681681+ "enum": ["Cbor", "Json", "Binary", "Uri"]
685682 },
686683 "ManifestData": {
687684 "anyOf": [
···696693 }
697694 ]
698695 },
696696+ "ManifestDefinition": {
697697+ "description": "Use a ManifestDefinition to define a manifest and to build a `ManifestStore`. A manifest is a collection of ingredients and assertions used to define a claim that can be signed and embedded into a file.",
698698+ "type": "object",
699699+ "properties": {
700700+ "assertions": {
701701+ "description": "A list of assertions",
702702+ "default": [],
703703+ "type": "array",
704704+ "items": {
705705+ "$ref": "#/definitions/AssertionDefinition"
706706+ }
707707+ },
708708+ "claim_generator_info": {
709709+ "description": "Claim Generator Info is always required with at least one entry",
710710+ "default": [
711711+ {
712712+ "name": "c2pa-rs",
713713+ "version": "0.58.0"
714714+ }
715715+ ],
716716+ "type": "array",
717717+ "items": {
718718+ "$ref": "#/definitions/ClaimGeneratorInfo"
719719+ }
720720+ },
721721+ "claim_version": {
722722+ "description": "The version of the claim. Defaults to 1.",
723723+ "type": ["integer", "null"],
724724+ "format": "uint8",
725725+ "minimum": 0.0
726726+ },
727727+ "format": {
728728+ "description": "The format of the source file as a MIME type.",
729729+ "default": "application/octet-stream",
730730+ "type": "string"
731731+ },
732732+ "ingredients": {
733733+ "description": "A List of ingredients",
734734+ "default": [],
735735+ "type": "array",
736736+ "items": {
737737+ "$ref": "#/definitions/Ingredient"
738738+ }
739739+ },
740740+ "instance_id": {
741741+ "description": "Instance ID from `xmpMM:InstanceID` in XMP metadata.",
742742+ "default": "xmp:iid:39745b0f-82b0-4848-b2ac-695b1acd4893",
743743+ "type": "string"
744744+ },
745745+ "label": {
746746+ "description": "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.",
747747+ "type": ["string", "null"]
748748+ },
749749+ "metadata": {
750750+ "description": "Optional manifest metadata. This will be deprecated in the future; not recommended to use.",
751751+ "type": ["array", "null"],
752752+ "items": {
753753+ "$ref": "#/definitions/AssertionMetadata"
754754+ }
755755+ },
756756+ "redactions": {
757757+ "description": "A list of redactions - URIs to redacted assertions.",
758758+ "type": ["array", "null"],
759759+ "items": {
760760+ "type": "string"
761761+ }
762762+ },
763763+ "thumbnail": {
764764+ "description": "An optional ResourceRef to a thumbnail image that represents the asset that was signed. Must be available when the manifest is signed.",
765765+ "anyOf": [
766766+ {
767767+ "$ref": "#/definitions/ResourceRef"
768768+ },
769769+ {
770770+ "type": "null"
771771+ }
772772+ ]
773773+ },
774774+ "title": {
775775+ "description": "A human-readable title, generally source filename.",
776776+ "type": ["string", "null"]
777777+ },
778778+ "vendor": {
779779+ "description": "Optional prefix added to the generated Manifest Label This is typically a reverse domain name.",
780780+ "type": ["string", "null"]
781781+ }
782782+ }
783783+ },
699784 "Range": {
700785 "description": "A spatial, temporal, frame, or textual range describing the region of interest.",
701786 "type": "object",
702702- "required": [
703703- "type"
704704- ],
787787+ "required": ["type"],
705788 "properties": {
706789 "frame": {
707790 "description": "A frame range.",
···774857 {
775858 "description": "A spatial range, see [`Shape`] for more details.",
776859 "type": "string",
777777- "enum": [
778778- "spatial"
779779- ]
860860+ "enum": ["spatial"]
780861 },
781862 {
782863 "description": "A temporal range, see [`Time`] for more details.",
783864 "type": "string",
784784- "enum": [
785785- "temporal"
786786- ]
865865+ "enum": ["temporal"]
787866 },
788867 {
789868 "description": "A spatial range, see [`Frame`] for more details.",
790869 "type": "string",
791791- "enum": [
792792- "frame"
793793- ]
870870+ "enum": ["frame"]
794871 },
795872 {
796873 "description": "A textual range, see [`Text`] for more details.",
797874 "type": "string",
798798- "enum": [
799799- "textual"
800800- ]
875875+ "enum": ["textual"]
801876 },
802877 {
803878 "description": "A range identified by a specific identifier and value, see [`Item`] for more details.",
804879 "type": "string",
805805- "enum": [
806806- "identified"
807807- ]
880880+ "enum": ["identified"]
808881 }
809882 ]
810883 },
884884+ "Reader": {
885885+ "description": "Use a Reader to read and validate a manifest store.",
886886+ "type": "object",
887887+ "required": ["manifests"],
888888+ "properties": {
889889+ "active_manifest": {
890890+ "description": "A label for the active (most recent) manifest in the store",
891891+ "type": ["string", "null"]
892892+ },
893893+ "manifests": {
894894+ "description": "A HashMap of Manifests",
895895+ "type": "object",
896896+ "additionalProperties": {
897897+ "$ref": "#/definitions/Manifest"
898898+ }
899899+ },
900900+ "validation_results": {
901901+ "description": "ValidationStatus generated when loading the ManifestStore from an asset",
902902+ "anyOf": [
903903+ {
904904+ "$ref": "#/definitions/ValidationResults"
905905+ },
906906+ {
907907+ "type": "null"
908908+ }
909909+ ]
910910+ },
911911+ "validation_state": {
912912+ "description": "The validation state of the manifest store",
913913+ "anyOf": [
914914+ {
915915+ "$ref": "#/definitions/ValidationState"
916916+ },
917917+ {
918918+ "type": "null"
919919+ }
920920+ ]
921921+ },
922922+ "validation_status": {
923923+ "description": "ValidationStatus generated when loading the ManifestStore from an asset",
924924+ "type": ["array", "null"],
925925+ "items": {
926926+ "$ref": "#/definitions/ValidationStatus"
927927+ }
928928+ }
929929+ }
930930+ },
811931 "RegionOfInterest": {
812932 "description": "A region of interest within an asset describing the change.\n\nThis struct can be used from [`Action::changes`][crate::assertions::Action::changes] or [`AssertionMetadata::region_of_interest`][crate::assertions::AssertionMetadata::region_of_interest].",
813933 "type": "object",
814814- "required": [
815815- "region"
816816- ],
934934+ "required": ["region"],
817935 "properties": {
818936 "description": {
819937 "description": "A free-text string.",
820820- "type": [
821821- "string",
822822- "null"
823823- ]
938938+ "type": ["string", "null"]
824939 },
825940 "identifier": {
826941 "description": "A free-text string representing a machine-readable, unique to this assertion, identifier for the region.",
827827- "type": [
828828- "string",
829829- "null"
830830- ]
942942+ "type": ["string", "null"]
831943 },
832944 "metadata": {
833945 "description": "Additional information about the asset.",
···842954 },
843955 "name": {
844956 "description": "A free-text string representing a human-readable name for the region which might be used in a user interface.",
845845- "type": [
846846- "string",
847847- "null"
848848- ]
957957+ "type": ["string", "null"]
849958 },
850959 "region": {
851960 "description": "A range describing the region of interest for the specific asset.",
···867976 },
868977 "type": {
869978 "description": "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.\n\nNote this field serializes/deserializes into the name `type`.",
870870- "type": [
871871- "string",
872872- "null"
873873- ]
979979+ "type": ["string", "null"]
874980 }
875981 }
876982 },
···880986 {
881987 "description": "The current asset is derived from this ingredient.",
882988 "type": "string",
883883- "enum": [
884884- "parentOf"
885885- ]
989989+ "enum": ["parentOf"]
886990 },
887991 {
888992 "description": "The current asset is a part of this ingredient.",
889993 "type": "string",
890890- "enum": [
891891- "componentOf"
892892- ]
994994+ "enum": ["componentOf"]
893995 },
894996 {
895997 "description": "The ingredient was used as an input to a computational process to create or modify the asset.",
896998 "type": "string",
897897- "enum": [
898898- "inputTo"
899899- ]
999999+ "enum": ["inputTo"]
9001000 }
9011001 ]
9021002 },
9031003 "ResourceRef": {
9041004 "description": "A reference to a resource to be used in JSON serialization.\n\nThe underlying data can be read as a stream via [`Reader::resource_to_stream`][crate::Reader::resource_to_stream].",
9051005 "type": "object",
906906- "required": [
907907- "format",
908908- "identifier"
909909- ],
10061006+ "required": ["format", "identifier"],
9101007 "properties": {
9111008 "alg": {
9121009 "description": "The algorithm used to hash the resource (if applicable).",
913913- "type": [
914914- "string",
915915- "null"
916916- ]
10101010+ "type": ["string", "null"]
9171011 },
9181012 "data_types": {
9191013 "description": "More detailed data types as defined in the C2PA spec.",
920920- "type": [
921921- "array",
922922- "null"
923923- ],
10141014+ "type": ["array", "null"],
9241015 "items": {
9251016 "$ref": "#/definitions/AssetType"
9261017 }
···9311022 },
9321023 "hash": {
9331024 "description": "The hash of the resource (if applicable).",
934934- "type": [
935935- "string",
936936- "null"
937937- ]
10251025+ "type": ["string", "null"]
9381026 },
9391027 "identifier": {
9401028 "description": "A URI that identifies the resource as referenced from the manifest.\n\nThis 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.",
···9451033 "ResourceStore": {
9461034 "description": "Resource store to contain binary objects referenced from JSON serializable structures",
9471035 "type": "object",
948948- "required": [
949949- "resources"
950950- ],
10361036+ "required": ["resources"],
9511037 "properties": {
9521038 "base_path": {
953953- "type": [
954954- "string",
955955- "null"
956956- ]
10391039+ "type": ["string", "null"]
9571040 },
9581041 "label": {
959959- "type": [
960960- "string",
961961- "null"
962962- ]
10421042+ "type": ["string", "null"]
9631043 },
9641044 "resources": {
9651045 "type": "object",
···9771057 "ReviewRating": {
9781058 "description": "A rating on an Assertion.\n\nSee <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_review_ratings>.",
9791059 "type": "object",
980980- "required": [
981981- "explanation",
982982- "value"
983983- ],
10601060+ "required": ["explanation", "value"],
9841061 "properties": {
9851062 "code": {
986986- "type": [
987987- "string",
988988- "null"
989989- ]
10631063+ "type": ["string", "null"]
9901064 },
9911065 "explanation": {
9921066 "type": "string"
···10041078 {
10051079 "description": "Arbitrary area worth identifying.",
10061080 "type": "string",
10071007- "enum": [
10081008- "c2pa.areaOfInterest"
10091009- ]
10811081+ "enum": ["c2pa.areaOfInterest"]
10101082 },
10111083 {
10121084 "description": "This area is all that is left after a crop action.",
10131085 "type": "string",
10141014- "enum": [
10151015- "c2pa.cropped"
10161016- ]
10861086+ "enum": ["c2pa.cropped"]
10171087 },
10181088 {
10191089 "description": "This area has had edits applied to it.",
10201090 "type": "string",
10211021- "enum": [
10221022- "c2pa.edited"
10231023- ]
10911091+ "enum": ["c2pa.edited"]
10241092 },
10251093 {
10261094 "description": "The area where an ingredient was placed/added.",
10271095 "type": "string",
10281028- "enum": [
10291029- "c2pa.placed"
10301030- ]
10961096+ "enum": ["c2pa.placed"]
10311097 },
10321098 {
10331099 "description": "Something in this area was redacted.",
10341100 "type": "string",
10351035- "enum": [
10361036- "c2pa.redacted"
10371037- ]
11011101+ "enum": ["c2pa.redacted"]
10381102 },
10391103 {
10401104 "description": "Area specific to a subject (human or not).",
10411105 "type": "string",
10421042- "enum": [
10431043- "c2pa.subjectArea"
10441044- ]
11061106+ "enum": ["c2pa.subjectArea"]
10451107 },
10461108 {
10471109 "description": "A range of information was removed/deleted.",
10481110 "type": "string",
10491049- "enum": [
10501050- "c2pa.deleted"
10511051- ]
11111111+ "enum": ["c2pa.deleted"]
10521112 },
10531113 {
10541114 "description": "Styling was applied to this area.",
10551115 "type": "string",
10561056- "enum": [
10571057- "c2pa.styled"
10581058- ]
11161116+ "enum": ["c2pa.styled"]
10591117 },
10601118 {
10611119 "description": "Invisible watermarking was applied to this area for the purpose of soft binding.",
10621120 "type": "string",
10631063- "enum": [
10641064- "c2pa.watermarked"
10651065- ]
11211121+ "enum": ["c2pa.watermarked"]
10661122 }
10671123 ]
10681124 },
10691125 "Shape": {
10701126 "description": "A spatial range representing rectangle, circle, or a polygon.",
10711127 "type": "object",
10721072- "required": [
10731073- "origin",
10741074- "type",
10751075- "unit"
10761076- ],
11281128+ "required": ["origin", "type", "unit"],
10771129 "properties": {
10781130 "height": {
10791131 "description": "The height of a rectnagle.\n\nThis field can be ignored for circles and polygons.",
10801080- "type": [
10811081- "number",
10821082- "null"
10831083- ],
11321132+ "type": ["number", "null"],
10841133 "format": "double"
10851134 },
10861135 "inside": {
10871136 "description": "If the range is inside the shape.\n\nThe default value is true.",
10881088- "type": [
10891089- "boolean",
10901090- "null"
10911091- ]
11371137+ "type": ["boolean", "null"]
10921138 },
10931139 "origin": {
10941140 "description": "THe origin of the coordinate in the shape.",
···11161162 },
11171163 "vertices": {
11181164 "description": "The vertices of the polygon.\n\nThis field can be ignored for rectangles and circles.",
11191119- "type": [
11201120- "array",
11211121- "null"
11221122- ],
11651165+ "type": ["array", "null"],
11231166 "items": {
11241167 "$ref": "#/definitions/Coordinate"
11251168 }
11261169 },
11271170 "width": {
11281171 "description": "The width for rectangles or diameter for circles.\n\nThis field can be ignored for polygons.",
11291129- "type": [
11301130- "number",
11311131- "null"
11321132- ],
11721172+ "type": ["number", "null"],
11331173 "format": "double"
11341174 }
11351175 }
···11401180 {
11411181 "description": "A rectangle.",
11421182 "type": "string",
11431143- "enum": [
11441144- "rectangle"
11451145- ]
11831183+ "enum": ["rectangle"]
11461184 },
11471185 {
11481186 "description": "A circle.",
11491187 "type": "string",
11501150- "enum": [
11511151- "circle"
11521152- ]
11881188+ "enum": ["circle"]
11531189 },
11541190 {
11551191 "description": "A polygon.",
11561192 "type": "string",
11571157- "enum": [
11581158- "polygon"
11591159- ]
11931193+ "enum": ["polygon"]
11601194 }
11611195 ]
11621196 },
···11771211 },
11781212 "cert_serial_number": {
11791213 "description": "The serial number of the certificate.",
11801180- "type": [
11811181- "string",
11821182- "null"
11831183- ]
12141214+ "type": ["string", "null"]
11841215 },
11851216 "issuer": {
11861217 "description": "Human-readable issuing authority for this signature.",
11871187- "type": [
11881188- "string",
11891189- "null"
11901190- ]
12181218+ "type": ["string", "null"]
11911219 },
11921220 "revocation_status": {
11931221 "description": "Revocation status of the certificate.",
11941194- "type": [
11951195- "boolean",
11961196- "null"
11971197- ]
12221222+ "type": ["boolean", "null"]
11981223 },
11991224 "time": {
12001225 "description": "The time the signature was created.",
12011201- "type": [
12021202- "string",
12031203- "null"
12041204- ]
12261226+ "type": ["string", "null"]
12051227 }
12061228 }
12071229 },
···12111233 {
12121234 "description": "ECDSA with SHA-256",
12131235 "type": "string",
12141214- "enum": [
12151215- "Es256"
12161216- ]
12361236+ "enum": ["Es256"]
12171237 },
12181238 {
12191239 "description": "ECDSA with SHA-256 on secp256k1 curve",
12201240 "type": "string",
12211221- "enum": [
12221222- "Es256K"
12231223- ]
12411241+ "enum": ["Es256K"]
12241242 },
12251243 {
12261244 "description": "ECDSA with SHA-384",
12271245 "type": "string",
12281228- "enum": [
12291229- "Es384"
12301230- ]
12461246+ "enum": ["Es384"]
12311247 },
12321248 {
12331249 "description": "ECDSA with SHA-512",
12341250 "type": "string",
12351235- "enum": [
12361236- "Es512"
12371237- ]
12511251+ "enum": ["Es512"]
12381252 },
12391253 {
12401254 "description": "RSASSA-PSS using SHA-256 and MGF1 with SHA-256",
12411255 "type": "string",
12421242- "enum": [
12431243- "Ps256"
12441244- ]
12561256+ "enum": ["Ps256"]
12451257 },
12461258 {
12471259 "description": "RSASSA-PSS using SHA-384 and MGF1 with SHA-384",
12481260 "type": "string",
12491249- "enum": [
12501250- "Ps384"
12511251- ]
12611261+ "enum": ["Ps384"]
12521262 },
12531263 {
12541264 "description": "RSASSA-PSS using SHA-512 and MGF1 with SHA-512",
12551265 "type": "string",
12561256- "enum": [
12571257- "Ps512"
12581258- ]
12661266+ "enum": ["Ps512"]
12591267 },
12601268 {
12611269 "description": "Edwards-Curve DSA (Ed25519 instance only)",
12621270 "type": "string",
12631263- "enum": [
12641264- "Ed25519"
12651265- ]
12711271+ "enum": ["Ed25519"]
12661272 }
12671273 ]
12681274 },
12691275 "StatusCodes": {
12701276 "description": "Contains a set of success, informational, and failure validation status codes.",
12711277 "type": "object",
12721272- "required": [
12731273- "failure",
12741274- "informational",
12751275- "success"
12761276- ],
12781278+ "required": ["failure", "informational", "success"],
12771279 "properties": {
12781280 "failure": {
12791281 "type": "array",
···12981300 "Text": {
12991301 "description": "A textual range representing multiple (possibly discontinuous) ranges of text.",
13001302 "type": "object",
13011301- "required": [
13021302- "selectors"
13031303- ],
13031303+ "required": ["selectors"],
13041304 "properties": {
13051305 "selectors": {
13061306 "description": "The ranges of text to select.",
···13141314 "TextSelector": {
13151315 "description": "Selects a range of text via a fragment identifier.\n\nThis is modeled after the W3C Web Annotation selector model.",
13161316 "type": "object",
13171317- "required": [
13181318- "fragment"
13191319- ],
13171317+ "required": ["fragment"],
13201318 "properties": {
13211319 "end": {
13221320 "description": "The end character offset or the end of the fragment if not present.",
13231323- "type": [
13241324- "integer",
13251325- "null"
13261326- ],
13211321+ "type": ["integer", "null"],
13271322 "format": "int32"
13281323 },
13291324 "fragment": {
···13321327 },
13331328 "start": {
13341329 "description": "The start character offset or the start of the fragment if not present.",
13351335- "type": [
13361336- "integer",
13371337- "null"
13381338- ],
13301330+ "type": ["integer", "null"],
13391331 "format": "int32"
13401332 }
13411333 }
···13431335 "TextSelectorRange": {
13441336 "description": "One or two [`TextSelector`][TextSelector] identifiying the range to select.",
13451337 "type": "object",
13461346- "required": [
13471347- "selector"
13481348- ],
13381338+ "required": ["selector"],
13491339 "properties": {
13501340 "end": {
13511341 "description": "The end of the text range.",
···13741364 "properties": {
13751365 "end": {
13761366 "description": "The end time or the end of the asset if not present.",
13771377- "type": [
13781378- "string",
13791379- "null"
13801380- ]
13671367+ "type": ["string", "null"]
13811368 },
13821369 "start": {
13831370 "description": "The start time or the start of the asset if not present.",
13841384- "type": [
13851385- "string",
13861386- "null"
13871387- ]
13711371+ "type": ["string", "null"]
13881372 },
13891373 "type": {
13901374 "description": "The type of time.",
···14031387 {
14041388 "description": "Times are described using Normal Play Time (npt) as described in RFC 2326.",
14051389 "type": "string",
14061406- "enum": [
14071407- "npt"
14081408- ]
13901390+ "enum": ["npt"]
14091391 }
14101392 ]
14111393 },
···14151397 {
14161398 "description": "Use pixels.",
14171399 "type": "string",
14181418- "enum": [
14191419- "pixel"
14201420- ]
14001400+ "enum": ["pixel"]
14211401 },
14221402 {
14231403 "description": "Use percentage.",
14241404 "type": "string",
14251425- "enum": [
14261426- "percent"
14271427- ]
14051405+ "enum": ["percent"]
14281406 }
14291407 ]
14301408 },
···14531431 ]
14541432 },
14551433 "ingredientDeltas": {
14561456- "type": [
14571457- "array",
14581458- "null"
14591459- ],
14341434+ "type": ["array", "null"],
14601435 "items": {
14611436 "$ref": "#/definitions/IngredientDeltaValidationResult"
14621437 }
···14691444 {
14701445 "description": "Errors were found in the manifest store.",
14711446 "type": "string",
14721472- "enum": [
14731473- "Invalid"
14741474- ]
14471447+ "enum": ["Invalid"]
14751448 },
14761449 {
14771450 "description": "No errors were found in validation, but the active signature is not trusted.",
14781451 "type": "string",
14791479- "enum": [
14801480- "Valid"
14811481- ]
14521452+ "enum": ["Valid"]
14821453 },
14831454 {
14841455 "description": "The manifest store is valid and the active signature is trusted.",
14851456 "type": "string",
14861486- "enum": [
14871487- "Trusted"
14881488- ]
14571457+ "enum": ["Trusted"]
14891458 }
14901459 ]
14911460 },
14921461 "ValidationStatus": {
14931462 "description": "A `ValidationStatus` struct describes the validation status of a specific part of a manifest.\n\nSee <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_existing_manifests>.",
14941463 "type": "object",
14951495- "required": [
14961496- "code"
14971497- ],
14641464+ "required": ["code"],
14981465 "properties": {
14991466 "code": {
15001467 "type": "string"
15011468 },
15021469 "explanation": {
15031503- "type": [
15041504- "string",
15051505- "null"
15061506- ]
14701470+ "type": ["string", "null"]
15071471 },
15081472 "success": {
15091473 "writeOnly": true,
15101510- "type": [
15111511- "boolean",
15121512- "null"
15131513- ]
14741474+ "type": ["boolean", "null"]
15141475 },
15151476 "url": {
15161516- "type": [
15171517- "string",
15181518- "null"
15191519- ]
14771477+ "type": ["string", "null"]
15201478 }
15211479 }
15221480 }
15231481 }
15241524-}14821482+}
+925
pkg/c2patypes/c2patypes.go
···11+// Code generated from JSON Schema using quicktype. DO NOT EDIT.
22+// To parse and unparse this JSON data, add this code to your project and do:
33+//
44+// c2Patypes, err := UnmarshalC2Patypes(bytes)
55+// bytes, err = c2Patypes.Marshal()
66+77+package c2patypes
88+99+import "bytes"
1010+import "errors"
1111+1212+import "encoding/json"
1313+1414+func UnmarshalC2Patypes(data []byte) (C2Patypes, error) {
1515+ var r C2Patypes
1616+ err := json.Unmarshal(data, &r)
1717+ return r, err
1818+}
1919+2020+func (r *C2Patypes) Marshal() ([]byte, error) {
2121+ return json.Marshal(r)
2222+}
2323+2424+type C2Patypes struct {
2525+ Builder Builder `json:"builder"`
2626+ ManifestDefinition ManifestDefinition `json:"manifest_definition"`
2727+ Reader Reader `json:"reader"`
2828+}
2929+3030+// Use a Builder to add a signed manifest to an asset.
3131+//
3232+// # Example: Building and signing a manifest
3333+//
3434+// ``` use c2pa::Result; use std::path::PathBuf;
3535+//
3636+// use c2pa::{create_signer, Builder, SigningAlg}; use serde::Serialize; use
3737+// serde_json::json; use tempfile::tempdir;
3838+//
3939+// #[derive(Serialize)] struct Test { my_tag: usize, }
4040+//
4141+// # fn main() -> Result<()> { #[cfg(feature = "file_io")] { let manifest_json = json!({
4242+// "claim_generator_info": [ { "name": "c2pa_test", "version": "1.0.0" } ], "title":
4343+// "Test_Manifest" }).to_string();
4444+//
4545+// let mut builder = Builder::from_json(&manifest_json)?;
4646+// builder.add_assertion("org.contentauth.test", &Test { my_tag: 42 })?;
4747+//
4848+// let source = PathBuf::from("tests/fixtures/C.jpg"); let dir = tempdir()?; let dest =
4949+// dir.path().join("test_file.jpg");
5050+//
5151+// // Create a ps256 signer using certs and key files. TO DO: Update example. let
5252+// signcert_path = "tests/fixtures/certs/ps256.pub"; let pkey_path =
5353+// "tests/fixtures/certs/ps256.pem"; let signer = create_signer::from_files(signcert_path,
5454+// pkey_path, SigningAlg::Ps256, None)?;
5555+//
5656+// // embed a manifest using the signer builder.sign_file( signer.as_ref(), &source,
5757+// &dest)?; } # Ok(()) # } ```
5858+type Builder struct {
5959+ // A list of assertions
6060+ Assertions []AssertionDefinition `json:"assertions,omitempty"`
6161+ // Base path to search for resources.
6262+ BasePath *string `json:"base_path"`
6363+ // The type of builder being used.
6464+ BuilderFlow *BuilderFlowUnion `json:"builder_flow"`
6565+ // Claim Generator Info is always required with at least one entry
6666+ ClaimGeneratorInfo []ClaimGeneratorInfo `json:"claim_generator_info,omitempty"`
6767+ // The version of the claim. Defaults to 1.
6868+ ClaimVersion *int64 `json:"claim_version"`
6969+ // The format of the source file as a MIME type.
7070+ Format *string `json:"format,omitempty"`
7171+ // A List of ingredients
7272+ Ingredients []Ingredient `json:"ingredients,omitempty"`
7373+ // Instance ID from `xmpMM:InstanceID` in XMP metadata.
7474+ InstanceID *string `json:"instance_id,omitempty"`
7575+ // Allows you to pre-define the manifest label, which must be unique. Not intended for
7676+ // general use. If not set, it will be assigned automatically.
7777+ Label *string `json:"label"`
7878+ // Optional manifest metadata. This will be deprecated in the future; not recommended to use.
7979+ Metadata []AssertionMetadata `json:"metadata"`
8080+ // If true, the manifest store will not be embedded in the asset on sign
8181+ NoEmbed bool `json:"no_embed"`
8282+ // A list of redactions - URIs to redacted assertions.
8383+ Redactions []string `json:"redactions"`
8484+ // Optional remote URL for the manifest
8585+ RemoteURL *string `json:"remote_url"`
8686+ // An optional ResourceRef to a thumbnail image that represents the asset that was signed.
8787+ // Must be available when the manifest is signed.
8888+ Thumbnail *IngredientResourceRef `json:"thumbnail"`
8989+ // A human-readable title, generally source filename.
9090+ Title *string `json:"title"`
9191+ // Optional prefix added to the generated Manifest Label This is typically a reverse domain
9292+ // name.
9393+ Vendor *string `json:"vendor"`
9494+}
9595+9696+// Defines an assertion that consists of a label that can be either a C2PA-defined assertion
9797+// label or a custom label in reverse domain format.
9898+type AssertionDefinition struct {
9999+ Data interface{} `json:"data"`
100100+ Label string `json:"label"`
101101+}
102102+103103+type BuilderFlowClass struct {
104104+ Create DigitalSourceType `json:"Create"`
105105+}
106106+107107+// Description of the claim generator, or the software used in generating the claim.
108108+//
109109+// This structure is also used for actions softwareAgent
110110+type ClaimGeneratorInfo struct {
111111+ // hashed URI to the icon (either embedded or remote)
112112+ Icon *ResourceRef `json:"icon"`
113113+ // A human readable string naming the claim_generator
114114+ Name string `json:"name"`
115115+ // A human readable string of the OS the claim generator is running on
116116+ OperatingSystem *string `json:"operating_system"`
117117+ // A human readable string of the product's version
118118+ Version *string `json:"version"`
119119+}
120120+121121+// A reference to a resource to be used in JSON serialization.
122122+//
123123+// The underlying data can be read as a stream via
124124+// [`Reader::resource_to_stream`][crate::Reader::resource_to_stream].
125125+//
126126+// A `HashedUri` provides a reference to content available within the same manifest store.
127127+//
128128+// This is described in [§8.3, URI References], of the C2PA Technical Specification.
129129+//
130130+// [§8.3, URI References]:
131131+// https://c2pa.org/specifications/specifications/2.1/specs/C2PA_Specification.html#_uri_references
132132+type ResourceRef struct {
133133+ // The algorithm used to hash the resource (if applicable).
134134+ //
135135+ // A string identifying the cryptographic hash algorithm used to compute the hash
136136+ Alg *string `json:"alg"`
137137+ // More detailed data types as defined in the C2PA spec.
138138+ DataTypes []AssetType `json:"data_types"`
139139+ // The mime type of the referenced resource.
140140+ Format *string `json:"format,omitempty"`
141141+ // The hash of the resource (if applicable).
142142+ //
143143+ // Byte string containing the hash value
144144+ Hash *BasePath `json:"hash"`
145145+ // A URI that identifies the resource as referenced from the manifest.
146146+ //
147147+ // This may be a JUMBF URI, a file path, a URL or any other string. Relative JUMBF URIs will
148148+ // be resolved with the manifest label. Relative file paths will be resolved with the base
149149+ // path if provided.
150150+ Identifier *string `json:"identifier,omitempty"`
151151+ // JUMBF URI reference
152152+ URL *string `json:"url,omitempty"`
153153+}
154154+155155+type AssetType struct {
156156+ Type string `json:"type"`
157157+ Version *string `json:"version"`
158158+}
159159+160160+// An `Ingredient` is any external asset that has been used in the creation of an asset.
161161+type Ingredient struct {
162162+ // The active manifest label (if one exists).
163163+ //
164164+ // If this ingredient has a [`ManifestStore`], this will hold the label of the active
165165+ // [`Manifest`].
166166+ //
167167+ // [`Manifest`]: crate::Manifest [`ManifestStore`]: crate::ManifestStore
168168+ ActiveManifest *string `json:"active_manifest"`
169169+ // A reference to the actual data of the ingredient.
170170+ Data *IngredientResourceRef `json:"data"`
171171+ // Additional information about the data's type to the ingredient V2 structure.
172172+ DataTypes []AssetType `json:"data_types"`
173173+ // Additional description of the ingredient.
174174+ Description *string `json:"description"`
175175+ // Document ID from `xmpMM:DocumentID` in XMP metadata.
176176+ DocumentID *string `json:"document_id"`
177177+ // The format of the source file as a MIME type.
178178+ Format *string `json:"format"`
179179+ // An optional hash of the asset to prevent duplicates.
180180+ Hash *string `json:"hash"`
181181+ // URI to an informational page about the ingredient or its data.
182182+ InformationalURI *string `json:"informational_URI"`
183183+ // Instance ID from `xmpMM:InstanceID` in XMP metadata.
184184+ InstanceID *string `json:"instance_id"`
185185+ // The ingredient's label as assigned in the manifest.
186186+ Label *string `json:"label"`
187187+ // A [`ManifestStore`] from the source asset extracted as a binary C2PA blob.
188188+ //
189189+ // [`ManifestStore`]: crate::ManifestStore
190190+ ManifestData *IngredientResourceRef `json:"manifest_data"`
191191+ // Any additional [`Metadata`] as defined in the C2PA spec.
192192+ //
193193+ // [`Metadata`]: crate::Metadata
194194+ Metadata *AssertionMetadata `json:"metadata"`
195195+ // URI from `dcterms:provenance` in XMP metadata.
196196+ Provenance *string `json:"provenance"`
197197+ // Set to `ParentOf` if this is the parent ingredient.
198198+ //
199199+ // There can only be one parent ingredient in the ingredients.
200200+ Relationship *Relationship `json:"relationship,omitempty"`
201201+ Resources *ResourceStore `json:"resources,omitempty"`
202202+ // A thumbnail image capturing the visual state at the time of import.
203203+ //
204204+ // A tuple of thumbnail MIME format (for example `image/jpeg`) and binary bits of the image.
205205+ Thumbnail *IngredientResourceRef `json:"thumbnail"`
206206+ // A human-readable title, generally source filename.
207207+ Title *string `json:"title"`
208208+ // Validation results (Ingredient.V3)
209209+ ValidationResults *ValidationResults `json:"validation_results"`
210210+ // Validation status (Ingredient v1 & v2)
211211+ ValidationStatus []ValidationStatus `json:"validation_status"`
212212+}
213213+214214+// A reference to a resource to be used in JSON serialization.
215215+//
216216+// The underlying data can be read as a stream via
217217+// [`Reader::resource_to_stream`][crate::Reader::resource_to_stream].
218218+type IngredientResourceRef struct {
219219+ // The algorithm used to hash the resource (if applicable).
220220+ Alg *string `json:"alg"`
221221+ // More detailed data types as defined in the C2PA spec.
222222+ DataTypes []AssetType `json:"data_types"`
223223+ // The mime type of the referenced resource.
224224+ Format string `json:"format"`
225225+ // The hash of the resource (if applicable).
226226+ Hash *string `json:"hash"`
227227+ // A URI that identifies the resource as referenced from the manifest.
228228+ //
229229+ // This may be a JUMBF URI, a file path, a URL or any other string. Relative JUMBF URIs will
230230+ // be resolved with the manifest label. Relative file paths will be resolved with the base
231231+ // path if provided.
232232+ Identifier string `json:"identifier"`
233233+}
234234+235235+// A region of interest within an asset describing the change.
236236+//
237237+// This struct can be used from [`Action::changes`][crate::assertions::Action::changes] or
238238+// [`AssertionMetadata::region_of_interest`][crate::assertions::AssertionMetadata::region_of_interest].
239239+type RegionOfInterest struct {
240240+ // A free-text string.
241241+ Description *string `json:"description"`
242242+ // A free-text string representing a machine-readable, unique to this assertion, identifier
243243+ // for the region.
244244+ Identifier *string `json:"identifier"`
245245+ // Additional information about the asset.
246246+ Metadata *AssertionMetadata `json:"metadata"`
247247+ // A free-text string representing a human-readable name for the region which might be used
248248+ // in a user interface.
249249+ Name *string `json:"name"`
250250+ // A range describing the region of interest for the specific asset.
251251+ Region []Range `json:"region"`
252252+ // A value from our controlled vocabulary or an entity-specific value (e.g.,
253253+ // com.litware.coolArea) that represents the role of a region among other regions.
254254+ Role *Role `json:"role"`
255255+ // A value from a controlled vocabulary such as
256256+ // <https://cv.iptc.org/newscodes/imageregiontype/> or an entity-specific value (e.g.,
257257+ // com.litware.newType) that represents the type of thing(s) depicted by a region.
258258+ //
259259+ // Note this field serializes/deserializes into the name `type`.
260260+ Type *string `json:"type"`
261261+}
262262+263263+// The AssertionMetadata structure can be used as part of other assertions or on its own to
264264+// reference others
265265+type AssertionMetadata struct {
266266+ DataSource *DataSource `json:"dataSource"`
267267+ DateTime *string `json:"dateTime"`
268268+ Reference *HashedURI `json:"reference"`
269269+ RegionOfInterest *RegionOfInterest `json:"regionOfInterest"`
270270+ ReviewRatings []ReviewRating `json:"reviewRatings"`
271271+}
272272+273273+// A spatial, temporal, frame, or textual range describing the region of interest.
274274+type Range struct {
275275+ // A frame range.
276276+ Frame *Frame `json:"frame"`
277277+ // A item identifier.
278278+ Item *Item `json:"item"`
279279+ // A spatial range.
280280+ Shape *Shape `json:"shape"`
281281+ // A textual range.
282282+ Text *Text `json:"text"`
283283+ // A temporal range.
284284+ Time *Time `json:"time"`
285285+ // The type of range of interest.
286286+ Type RangeType `json:"type"`
287287+}
288288+289289+// A frame range representing starting and ending frames or pages.
290290+//
291291+// If both `start` and `end` are missing, the frame will span the entire asset.
292292+type Frame struct {
293293+ // The end of the frame inclusive or the end of the asset if not present.
294294+ End *int64 `json:"end"`
295295+ // The start of the frame or the end of the asset if not present.
296296+ //
297297+ // The first frame/page starts at 0.
298298+ Start *int64 `json:"start"`
299299+}
300300+301301+// Description of the boundaries of an identified range.
302302+type Item struct {
303303+ // The container-specific term used to identify items, such as "track_id" for MP4 or
304304+ // "item_ID" for HEIF.
305305+ Identifier string `json:"identifier"`
306306+ // The value of the identifier, e.g. a value of "2" for an identifier of "track_id" would
307307+ // imply track 2 of the asset.
308308+ Value string `json:"value"`
309309+}
310310+311311+// A spatial range representing rectangle, circle, or a polygon.
312312+type Shape struct {
313313+ // The height of a rectnagle.
314314+ //
315315+ // This field can be ignored for circles and polygons.
316316+ Height *float64 `json:"height"`
317317+ // If the range is inside the shape.
318318+ //
319319+ // The default value is true.
320320+ Inside *bool `json:"inside"`
321321+ // THe origin of the coordinate in the shape.
322322+ Origin Coordinate `json:"origin"`
323323+ // The type of shape.
324324+ Type ShapeType `json:"type"`
325325+ // The type of unit for the shape range.
326326+ Unit UnitType `json:"unit"`
327327+ // The vertices of the polygon.
328328+ //
329329+ // This field can be ignored for rectangles and circles.
330330+ Vertices []Coordinate `json:"vertices"`
331331+ // The width for rectangles or diameter for circles.
332332+ //
333333+ // This field can be ignored for polygons.
334334+ Width *float64 `json:"width"`
335335+}
336336+337337+// THe origin of the coordinate in the shape.
338338+//
339339+// An x, y coordinate used for specifying vertices in polygons.
340340+type Coordinate struct {
341341+ // The coordinate along the x-axis.
342342+ X float64 `json:"x"`
343343+ // The coordinate along the y-axis.
344344+ Y float64 `json:"y"`
345345+}
346346+347347+// A textual range representing multiple (possibly discontinuous) ranges of text.
348348+type Text struct {
349349+ // The ranges of text to select.
350350+ Selectors []TextSelectorRange `json:"selectors"`
351351+}
352352+353353+// One or two [`TextSelector`][TextSelector] identifiying the range to select.
354354+type TextSelectorRange struct {
355355+ // The end of the text range.
356356+ End *TextSelector `json:"end"`
357357+ // The start (or entire) text range.
358358+ Selector TextSelector `json:"selector"`
359359+}
360360+361361+// Selects a range of text via a fragment identifier.
362362+//
363363+// This is modeled after the W3C Web Annotation selector model.
364364+//
365365+// The start (or entire) text range.
366366+type TextSelector struct {
367367+ // The end character offset or the end of the fragment if not present.
368368+ End *int64 `json:"end"`
369369+ // Fragment identifier as per RFC3023 (XML) or ISO 32000-2 (PDF), Annex O.
370370+ Fragment string `json:"fragment"`
371371+ // The start character offset or the start of the fragment if not present.
372372+ Start *int64 `json:"start"`
373373+}
374374+375375+// A temporal range representing a starting time to an ending time.
376376+type Time struct {
377377+ // The end time or the end of the asset if not present.
378378+ End *string `json:"end"`
379379+ // The start time or the start of the asset if not present.
380380+ Start *string `json:"start"`
381381+ // The type of time.
382382+ Type *TimeType `json:"type,omitempty"`
383383+}
384384+385385+// A description of the source for assertion data
386386+type DataSource struct {
387387+ // A list of [`Actor`]s associated with this source.
388388+ Actors []Actor `json:"actors"`
389389+ // A human-readable string giving details about the source of the assertion data.
390390+ Details *string `json:"details"`
391391+ // A value from among the enumerated list indicating the source of the assertion.
392392+ Type string `json:"type"`
393393+}
394394+395395+// Identifies a person responsible for an action.
396396+type Actor struct {
397397+ // List of references to W3C Verifiable Credentials.
398398+ Credentials []HashedURI `json:"credentials"`
399399+ // An identifier for a human actor, used when the "type" is `humanEntry.identified`.
400400+ Identifier *string `json:"identifier"`
401401+}
402402+403403+// A `HashedUri` provides a reference to content available within the same manifest store.
404404+//
405405+// This is described in [§8.3, URI References], of the C2PA Technical Specification.
406406+//
407407+// [§8.3, URI References]:
408408+// https://c2pa.org/specifications/specifications/2.1/specs/C2PA_Specification.html#_uri_references
409409+type HashedURI struct {
410410+ // A string identifying the cryptographic hash algorithm used to compute the hash
411411+ Alg *string `json:"alg"`
412412+ // Byte string containing the hash value
413413+ Hash []int64 `json:"hash"`
414414+ // JUMBF URI reference
415415+ URL string `json:"url"`
416416+}
417417+418418+// A rating on an Assertion.
419419+//
420420+// See
421421+// <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_review_ratings>.
422422+type ReviewRating struct {
423423+ Code *string `json:"code"`
424424+ Explanation string `json:"explanation"`
425425+ Value int64 `json:"value"`
426426+}
427427+428428+// Resource store to contain binary objects referenced from JSON serializable structures
429429+//
430430+// container for binary assets (like thumbnails)
431431+type ResourceStore struct {
432432+ BasePath *string `json:"base_path"`
433433+ Label *string `json:"label"`
434434+ Resources map[string][]int64 `json:"resources"`
435435+}
436436+437437+// A map of validation results for a manifest store.
438438+//
439439+// The map contains the validation results for the active manifest and any ingredient
440440+// deltas. It is normal for there to be many
441441+type ValidationResults struct {
442442+ ActiveManifest *StatusCodes `json:"activeManifest"`
443443+ IngredientDeltas []IngredientDeltaValidationResult `json:"ingredientDeltas"`
444444+}
445445+446446+// Contains a set of success, informational, and failure validation status codes.
447447+//
448448+// Validation results for the ingredient's active manifest
449449+type StatusCodes struct {
450450+ Failure []ValidationStatus `json:"failure"`
451451+ Informational []ValidationStatus `json:"informational"`
452452+ Success []ValidationStatus `json:"success"`
453453+}
454454+455455+// A `ValidationStatus` struct describes the validation status of a specific part of a
456456+// manifest.
457457+//
458458+// See
459459+// <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_existing_manifests>.
460460+type ValidationStatus struct {
461461+ Code string `json:"code"`
462462+ Explanation *string `json:"explanation"`
463463+ Success *bool `json:"success"`
464464+ URL *string `json:"url"`
465465+}
466466+467467+// Represents any changes or deltas between the current and previous validation results for
468468+// an ingredient's manifest.
469469+type IngredientDeltaValidationResult struct {
470470+ // JUMBF URI reference to the ingredient assertion
471471+ IngredientAssertionURI string `json:"ingredientAssertionURI"`
472472+ // Validation results for the ingredient's active manifest
473473+ ValidationDeltas StatusCodes `json:"validationDeltas"`
474474+}
475475+476476+// Use a ManifestDefinition to define a manifest and to build a `ManifestStore`. A manifest
477477+// is a collection of ingredients and assertions used to define a claim that can be signed
478478+// and embedded into a file.
479479+type ManifestDefinition struct {
480480+ // A list of assertions
481481+ Assertions []AssertionDefinition `json:"assertions,omitempty"`
482482+ // Claim Generator Info is always required with at least one entry
483483+ ClaimGeneratorInfo []ClaimGeneratorInfo `json:"claim_generator_info,omitempty"`
484484+ // The version of the claim. Defaults to 1.
485485+ ClaimVersion *int64 `json:"claim_version"`
486486+ // The format of the source file as a MIME type.
487487+ Format *string `json:"format,omitempty"`
488488+ // A List of ingredients
489489+ Ingredients []Ingredient `json:"ingredients,omitempty"`
490490+ // Instance ID from `xmpMM:InstanceID` in XMP metadata.
491491+ InstanceID *string `json:"instance_id,omitempty"`
492492+ // Allows you to pre-define the manifest label, which must be unique. Not intended for
493493+ // general use. If not set, it will be assigned automatically.
494494+ Label *string `json:"label"`
495495+ // Optional manifest metadata. This will be deprecated in the future; not recommended to use.
496496+ Metadata []AssertionMetadata `json:"metadata"`
497497+ // A list of redactions - URIs to redacted assertions.
498498+ Redactions []string `json:"redactions"`
499499+ // An optional ResourceRef to a thumbnail image that represents the asset that was signed.
500500+ // Must be available when the manifest is signed.
501501+ Thumbnail *IngredientResourceRef `json:"thumbnail"`
502502+ // A human-readable title, generally source filename.
503503+ Title *string `json:"title"`
504504+ // Optional prefix added to the generated Manifest Label This is typically a reverse domain
505505+ // name.
506506+ Vendor *string `json:"vendor"`
507507+}
508508+509509+// Use a Reader to read and validate a manifest store.
510510+type Reader struct {
511511+ // A label for the active (most recent) manifest in the store
512512+ ActiveManifest *string `json:"active_manifest"`
513513+ // A HashMap of Manifests
514514+ Manifests map[string]Manifest `json:"manifests"`
515515+ // ValidationStatus generated when loading the ManifestStore from an asset
516516+ ValidationResults *ValidationResults `json:"validation_results"`
517517+ // The validation state of the manifest store
518518+ ValidationState *ValidationState `json:"validation_state"`
519519+ // ValidationStatus generated when loading the ManifestStore from an asset
520520+ ValidationStatus []ValidationStatus `json:"validation_status"`
521521+}
522522+523523+// A Manifest represents all the information in a c2pa manifest
524524+type Manifest struct {
525525+ // A list of assertions
526526+ Assertions []ManifestAssertion `json:"assertions,omitempty"`
527527+ // A User Agent formatted string identifying the software/hardware/system produced this
528528+ // claim Spaces are not allowed in names, versions can be specified with product/1.0 syntax.
529529+ ClaimGenerator *string `json:"claim_generator"`
530530+ // A list of claim generator info data identifying the software/hardware/system produced
531531+ // this claim.
532532+ ClaimGeneratorInfo []ClaimGeneratorInfo `json:"claim_generator_info"`
533533+ // A List of verified credentials
534534+ Credentials []interface{} `json:"credentials"`
535535+ // The format of the source file as a MIME type.
536536+ Format *string `json:"format"`
537537+ // A List of ingredients
538538+ Ingredients []Ingredient `json:"ingredients,omitempty"`
539539+ // Instance ID from `xmpMM:InstanceID` in XMP metadata.
540540+ InstanceID *string `json:"instance_id,omitempty"`
541541+ Label *string `json:"label"`
542542+ // A list of user metadata for this claim.
543543+ Metadata []AssertionMetadata `json:"metadata"`
544544+ // A list of redactions - URIs to a redacted assertions
545545+ Redactions []string `json:"redactions"`
546546+ // container for binary assets (like thumbnails)
547547+ Resources *ResourceStore `json:"resources,omitempty"`
548548+ // Signature data (only used for reporting)
549549+ SignatureInfo *SignatureInfo `json:"signature_info"`
550550+ Thumbnail *IngredientResourceRef `json:"thumbnail"`
551551+ // A human-readable title, generally source filename.
552552+ Title *string `json:"title"`
553553+ // Optional prefix added to the generated Manifest label. This is typically an internet
554554+ // domain name for the vendor (i.e. `adobe`).
555555+ Vendor *string `json:"vendor"`
556556+}
557557+558558+// A labeled container for an Assertion value in a Manifest
559559+type ManifestAssertion struct {
560560+ // The data of the assertion as Value
561561+ Data interface{} `json:"data"`
562562+ // There can be more than one assertion for any label
563563+ Instance *int64 `json:"instance"`
564564+ // The [ManifestAssertionKind] for this assertion (as stored in c2pa content)
565565+ Kind *ManifestAssertionKind `json:"kind"`
566566+ // An assertion label in reverse domain format
567567+ Label string `json:"label"`
568568+}
569569+570570+// Holds information about a signature
571571+type SignatureInfo struct {
572572+ // Human-readable issuing authority for this signature.
573573+ Alg *SigningAlg `json:"alg"`
574574+ // The serial number of the certificate.
575575+ CERTSerialNumber *string `json:"cert_serial_number"`
576576+ // Human-readable issuing authority for this signature.
577577+ Issuer *string `json:"issuer"`
578578+ // Revocation status of the certificate.
579579+ RevocationStatus *bool `json:"revocation_status"`
580580+ // The time the signature was created.
581581+ Time *string `json:"time"`
582582+}
583583+584584+// Media whose digital content is effectively empty, such as a blank canvas or zero-length
585585+// video.
586586+//
587587+// Data that is the result of algorithmically using a model derived from sampled content and
588588+// data. Differs from
589589+// <http://cv.iptc.org/newscodes/digitalsourcetype/>trainedAlgorithmicMedia in that the
590590+// result isn’t a media type (e.g., image or video) but is a data format (e.g., CSV, pickle).
591591+type DigitalSourceType string
592592+593593+const (
594594+ Empty DigitalSourceType = "Empty"
595595+ TrainedAlgorithmicData DigitalSourceType = "TrainedAlgorithmicData"
596596+)
597597+598598+type BuilderFlowEnum string
599599+600600+const (
601601+ Open BuilderFlowEnum = "Open"
602602+ Update BuilderFlowEnum = "Update"
603603+)
604604+605605+// The type of shape.
606606+//
607607+// The type of shape for the range.
608608+//
609609+// A rectangle.
610610+//
611611+// A circle.
612612+//
613613+// A polygon.
614614+type ShapeType string
615615+616616+const (
617617+ Circle ShapeType = "circle"
618618+ Polygon ShapeType = "polygon"
619619+ Rectangle ShapeType = "rectangle"
620620+)
621621+622622+// The type of unit for the shape range.
623623+//
624624+// The type of unit for the range.
625625+//
626626+// Use pixels.
627627+//
628628+// Use percentage.
629629+type UnitType string
630630+631631+const (
632632+ Percent UnitType = "percent"
633633+ Pixel UnitType = "pixel"
634634+)
635635+636636+// The type of time.
637637+//
638638+// Times are described using Normal Play Time (npt) as described in RFC 2326.
639639+type TimeType string
640640+641641+const (
642642+ Npt TimeType = "npt"
643643+)
644644+645645+// The type of range of interest.
646646+//
647647+// The type of range for the region of interest.
648648+//
649649+// A spatial range, see [`Shape`] for more details.
650650+//
651651+// A temporal range, see [`Time`] for more details.
652652+//
653653+// A spatial range, see [`Frame`] for more details.
654654+//
655655+// A textual range, see [`Text`] for more details.
656656+//
657657+// A range identified by a specific identifier and value, see [`Item`] for more details.
658658+type RangeType string
659659+660660+const (
661661+ Identified RangeType = "identified"
662662+ RangeTypeFrame RangeType = "frame"
663663+ Spatial RangeType = "spatial"
664664+ Temporal RangeType = "temporal"
665665+ Textual RangeType = "textual"
666666+)
667667+668668+// Arbitrary area worth identifying.
669669+//
670670+// This area is all that is left after a crop action.
671671+//
672672+// This area has had edits applied to it.
673673+//
674674+// The area where an ingredient was placed/added.
675675+//
676676+// Something in this area was redacted.
677677+//
678678+// Area specific to a subject (human or not).
679679+//
680680+// A range of information was removed/deleted.
681681+//
682682+// Styling was applied to this area.
683683+//
684684+// Invisible watermarking was applied to this area for the purpose of soft binding.
685685+type Role string
686686+687687+const (
688688+ C2PaAreaOfInterest Role = "c2pa.areaOfInterest"
689689+ C2PaCropped Role = "c2pa.cropped"
690690+ C2PaDeleted Role = "c2pa.deleted"
691691+ C2PaEdited Role = "c2pa.edited"
692692+ C2PaPlaced Role = "c2pa.placed"
693693+ C2PaRedacted Role = "c2pa.redacted"
694694+ C2PaStyled Role = "c2pa.styled"
695695+ C2PaSubjectArea Role = "c2pa.subjectArea"
696696+ C2PaWatermarked Role = "c2pa.watermarked"
697697+)
698698+699699+// Set to `ParentOf` if this is the parent ingredient.
700700+//
701701+// There can only be one parent ingredient in the ingredients.
702702+//
703703+// The relationship of the ingredient to the current asset.
704704+//
705705+// The current asset is derived from this ingredient.
706706+//
707707+// The current asset is a part of this ingredient.
708708+//
709709+// The ingredient was used as an input to a computational process to create or modify the
710710+// asset.
711711+type Relationship string
712712+713713+const (
714714+ ComponentOf Relationship = "componentOf"
715715+ InputTo Relationship = "inputTo"
716716+ ParentOf Relationship = "parentOf"
717717+)
718718+719719+// Assertions in C2PA can be stored in several formats
720720+type ManifestAssertionKind string
721721+722722+const (
723723+ Binary ManifestAssertionKind = "Binary"
724724+ Cbor ManifestAssertionKind = "Cbor"
725725+ JSON ManifestAssertionKind = "Json"
726726+ URI ManifestAssertionKind = "Uri"
727727+)
728728+729729+// ECDSA with SHA-256
730730+//
731731+// ECDSA with SHA-256 on secp256k1 curve
732732+//
733733+// ECDSA with SHA-384
734734+//
735735+// ECDSA with SHA-512
736736+//
737737+// RSASSA-PSS using SHA-256 and MGF1 with SHA-256
738738+//
739739+// RSASSA-PSS using SHA-384 and MGF1 with SHA-384
740740+//
741741+// RSASSA-PSS using SHA-512 and MGF1 with SHA-512
742742+//
743743+// Edwards-Curve DSA (Ed25519 instance only)
744744+type SigningAlg string
745745+746746+const (
747747+ Ed25519 SigningAlg = "Ed25519"
748748+ Es256 SigningAlg = "Es256"
749749+ Es256K SigningAlg = "Es256K"
750750+ Es384 SigningAlg = "Es384"
751751+ Es512 SigningAlg = "Es512"
752752+ Ps256 SigningAlg = "Ps256"
753753+ Ps384 SigningAlg = "Ps384"
754754+ Ps512 SigningAlg = "Ps512"
755755+)
756756+757757+// Errors were found in the manifest store.
758758+//
759759+// No errors were found in validation, but the active signature is not trusted.
760760+//
761761+// The manifest store is valid and the active signature is trusted.
762762+type ValidationState string
763763+764764+const (
765765+ Invalid ValidationState = "Invalid"
766766+ Trusted ValidationState = "Trusted"
767767+ Valid ValidationState = "Valid"
768768+)
769769+770770+// The type of builder being used.
771771+type BuilderFlowUnion struct {
772772+ BuilderFlowClass *BuilderFlowClass
773773+ Enum *BuilderFlowEnum
774774+}
775775+776776+func (x *BuilderFlowUnion) UnmarshalJSON(data []byte) error {
777777+ x.BuilderFlowClass = nil
778778+ x.Enum = nil
779779+ var c BuilderFlowClass
780780+ object, err := unmarshalUnion(data, nil, nil, nil, nil, false, nil, true, &c, false, nil, true, &x.Enum, true)
781781+ if err != nil {
782782+ return err
783783+ }
784784+ if object {
785785+ x.BuilderFlowClass = &c
786786+ }
787787+ return nil
788788+}
789789+790790+func (x *BuilderFlowUnion) MarshalJSON() ([]byte, error) {
791791+ return marshalUnion(nil, nil, nil, nil, false, nil, x.BuilderFlowClass != nil, x.BuilderFlowClass, false, nil, x.Enum != nil, x.Enum, true)
792792+}
793793+794794+type BasePath struct {
795795+ IntegerArray []int64
796796+ String *string
797797+}
798798+799799+func (x *BasePath) UnmarshalJSON(data []byte) error {
800800+ x.IntegerArray = nil
801801+ object, err := unmarshalUnion(data, nil, nil, nil, &x.String, true, &x.IntegerArray, false, nil, false, nil, false, nil, true)
802802+ if err != nil {
803803+ return err
804804+ }
805805+ if object {
806806+ }
807807+ return nil
808808+}
809809+810810+func (x *BasePath) MarshalJSON() ([]byte, error) {
811811+ return marshalUnion(nil, nil, nil, x.String, x.IntegerArray != nil, x.IntegerArray, false, nil, false, nil, false, nil, true)
812812+}
813813+814814+func unmarshalUnion(data []byte, pi **int64, pf **float64, pb **bool, ps **string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) (bool, error) {
815815+ if pi != nil {
816816+ *pi = nil
817817+ }
818818+ if pf != nil {
819819+ *pf = nil
820820+ }
821821+ if pb != nil {
822822+ *pb = nil
823823+ }
824824+ if ps != nil {
825825+ *ps = nil
826826+ }
827827+828828+ dec := json.NewDecoder(bytes.NewReader(data))
829829+ dec.UseNumber()
830830+ tok, err := dec.Token()
831831+ if err != nil {
832832+ return false, err
833833+ }
834834+835835+ switch v := tok.(type) {
836836+ case json.Number:
837837+ if pi != nil {
838838+ i, err := v.Int64()
839839+ if err == nil {
840840+ *pi = &i
841841+ return false, nil
842842+ }
843843+ }
844844+ if pf != nil {
845845+ f, err := v.Float64()
846846+ if err == nil {
847847+ *pf = &f
848848+ return false, nil
849849+ }
850850+ return false, errors.New("Unparsable number")
851851+ }
852852+ return false, errors.New("Union does not contain number")
853853+ case float64:
854854+ return false, errors.New("Decoder should not return float64")
855855+ case bool:
856856+ if pb != nil {
857857+ *pb = &v
858858+ return false, nil
859859+ }
860860+ return false, errors.New("Union does not contain bool")
861861+ case string:
862862+ if haveEnum {
863863+ return false, json.Unmarshal(data, pe)
864864+ }
865865+ if ps != nil {
866866+ *ps = &v
867867+ return false, nil
868868+ }
869869+ return false, errors.New("Union does not contain string")
870870+ case nil:
871871+ if nullable {
872872+ return false, nil
873873+ }
874874+ return false, errors.New("Union does not contain null")
875875+ case json.Delim:
876876+ if v == '{' {
877877+ if haveObject {
878878+ return true, json.Unmarshal(data, pc)
879879+ }
880880+ if haveMap {
881881+ return false, json.Unmarshal(data, pm)
882882+ }
883883+ return false, errors.New("Union does not contain object")
884884+ }
885885+ if v == '[' {
886886+ if haveArray {
887887+ return false, json.Unmarshal(data, pa)
888888+ }
889889+ return false, errors.New("Union does not contain array")
890890+ }
891891+ return false, errors.New("Cannot handle delimiter")
892892+ }
893893+ return false, errors.New("Cannot unmarshal union")
894894+}
895895+896896+func marshalUnion(pi *int64, pf *float64, pb *bool, ps *string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) ([]byte, error) {
897897+ if pi != nil {
898898+ return json.Marshal(*pi)
899899+ }
900900+ if pf != nil {
901901+ return json.Marshal(*pf)
902902+ }
903903+ if pb != nil {
904904+ return json.Marshal(*pb)
905905+ }
906906+ if ps != nil {
907907+ return json.Marshal(*ps)
908908+ }
909909+ if haveArray {
910910+ return json.Marshal(pa)
911911+ }
912912+ if haveObject {
913913+ return json.Marshal(pc)
914914+ }
915915+ if haveMap {
916916+ return json.Marshal(pm)
917917+ }
918918+ if haveEnum {
919919+ return json.Marshal(pe)
920920+ }
921921+ if nullable {
922922+ return json.Marshal(nil)
923923+ }
924924+ return nil, errors.New("Union must not be null")
925925+}