Skip to content

Commit

Permalink
feat: Associate ingredients with actions using parameters.org.cai.ing…
Browse files Browse the repository at this point in the history
…redientsIds array (#627)

* feat: action.ingredient_ids replaces action.instanceId.
fix: InstanceId field no longer written to CBOR.
actions.instanceId should be deprecated.
actions.ingredient_ids now allows assigning multiple ingredients to an action.
Added an error if no matching ingredient is found for an action.
ingredient_with_stream no longer replaces an already assigned instance_id.
Fixed several test cases, some of which were wrong before.

* fix: Actions, support ingredient_ids parameter.
This allows associating multiple ingredients with an action. It replaces the now deprecated use of instanceId.

* chore: Deprecates action.instanceId.
Update known good Json for make_test_images.

* feat: Change ingredient_ids to org.cai.ingredientIds.
Add an array with tag :"org.cai.ingredientIds" to action parameters to associate one or more ingredients with an action.
  • Loading branch information
gpeacock authored Oct 27, 2024
1 parent e5175d7 commit e529273
Show file tree
Hide file tree
Showing 30 changed files with 1,886 additions and 1,088 deletions.
24 changes: 12 additions & 12 deletions make_test_images/json_manifests/C.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"active_manifest": "contentauth:urn:uuid:12a34759-5309-45b6-b4c8-068d341adf2b",
"active_manifest": "contentauth:urn:uuid:e46d3d9f-deaf-46b1-8cff-9dc9cd637f90",
"manifests": {
"contentauth:urn:uuid:12a34759-5309-45b6-b4c8-068d341adf2b": {
"claim_generator": "make_test_images/0.31.3 c2pa-rs/0.31.3",
"contentauth:urn:uuid:e46d3d9f-deaf-46b1-8cff-9dc9cd637f90": {
"claim_generator": "make_test_images/0.36.1 c2pa-rs/0.36.1",
"claim_generator_info": [
{
"name": "make_test_images",
"version": "0.31.3"
"version": "0.36.1"
},
{
"name": "c2pa-rs",
"version": "0.31.3"
"version": "0.36.1"
}
],
"title": "C.jpg",
"format": "image/jpeg",
"instance_id": "xmp:iid:8280ad85-e3d5-4954-b2f2-3f62de10072f",
"instance_id": "xmp:iid:6aef2adf-688f-4045-a7e1-56b087eed896",
"thumbnail": {
"format": "image/jpeg",
"identifier": "self#jumbf=c2pa.assertions/c2pa.thumbnail.claim.jpeg"
"identifier": "self#jumbf=/c2pa/contentauth:urn:uuid:e46d3d9f-deaf-46b1-8cff-9dc9cd637f90/c2pa.assertions/c2pa.thumbnail.claim.jpeg"
},
"ingredients": [],
"assertions": [
Expand All @@ -29,8 +29,8 @@
"@type": "CreativeWork",
"author": [
{
"@type": "Person",
"name": "John Doe"
"name": "John Doe",
"@type": "Person"
}
]
},
Expand All @@ -42,7 +42,7 @@
"actions": [
{
"action": "c2pa.created",
"softwareAgent": "Make Test Images 0.31.3",
"softwareAgent": "Make Test Images 0.36.1",
"parameters": {
"name": "gradient"
},
Expand All @@ -56,9 +56,9 @@
"alg": "Ps256",
"issuer": "C2PA Test Signing Cert",
"cert_serial_number": "720724073027128164015125666832722375746636448153",
"time": "2024-04-10T16:33:38+00:00"
"time": "2024-10-10T22:42:36+00:00"
},
"label": "contentauth:urn:uuid:12a34759-5309-45b6-b4c8-068d341adf2b"
"label": "contentauth:urn:uuid:e46d3d9f-deaf-46b1-8cff-9dc9cd637f90"
}
}
}
36 changes: 20 additions & 16 deletions make_test_images/json_manifests/CA.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"active_manifest": "contentauth:urn:uuid:55ec3f39-910a-4f5c-b6c0-2ecc5487c1d7",
"active_manifest": "contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2",
"manifests": {
"contentauth:urn:uuid:55ec3f39-910a-4f5c-b6c0-2ecc5487c1d7": {
"claim_generator": "make_test_images/0.31.3 c2pa-rs/0.31.3",
"contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2": {
"claim_generator": "make_test_images/0.36.1 c2pa-rs/0.36.1",
"claim_generator_info": [
{
"name": "make_test_images",
"version": "0.31.3"
"version": "0.36.1"
},
{
"name": "c2pa-rs",
"version": "0.31.3"
"version": "0.36.1"
}
],
"title": "CA.jpg",
"format": "image/jpeg",
"instance_id": "xmp:iid:548e96a5-1674-4bd7-9331-d5ea3d4367ee",
"instance_id": "xmp:iid:6a6b5d47-5799-47dc-b164-b9960d212de5",
"thumbnail": {
"format": "image/jpeg",
"identifier": "self#jumbf=c2pa.assertions/c2pa.thumbnail.claim.jpeg"
"identifier": "self#jumbf=/c2pa/contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2/c2pa.assertions/c2pa.thumbnail.claim.jpeg"
},
"ingredients": [
{
Expand All @@ -41,8 +41,8 @@
"@type": "CreativeWork",
"author": [
{
"@type": "Person",
"name": "John Doe"
"name": "John Doe",
"@type": "Person"
}
]
},
Expand All @@ -54,12 +54,16 @@
"actions": [
{
"action": "c2pa.opened",
"instanceId": "xmp.iid:813ee422-9736-4cdc-9be6-4e35ed8e41cb",
"parameters": {
"ingredient": {
"url": "self#jumbf=c2pa.assertions/c2pa.ingredient",
"hash": "tTBD4/E0R0AjLUdJFpsVz3lE/KJUq22Vz0UGqzhEpVs="
}
"ingredient": [
{
"url": "self#jumbf=c2pa.assertions/c2pa.ingredient",
"hash": "5dNlxTKe4afGAicpJa1hF1R3mBZKE+Bl0xmh0McXuO4="
}
],
"org.cai.ingredientIds": [
"xmp.iid:813ee422-9736-4cdc-9be6-4e35ed8e41cb"
]
}
},
{
Expand All @@ -76,9 +80,9 @@
"alg": "Ps256",
"issuer": "C2PA Test Signing Cert",
"cert_serial_number": "720724073027128164015125666832722375746636448153",
"time": "2024-04-10T16:33:39+00:00"
"time": "2024-10-10T22:42:36+00:00"
},
"label": "contentauth:urn:uuid:55ec3f39-910a-4f5c-b6c0-2ecc5487c1d7"
"label": "contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2"
}
}
}
76 changes: 42 additions & 34 deletions make_test_images/json_manifests/CACA.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"active_manifest": "contentauth:urn:uuid:64bf5b80-9b85-4143-a6df-95247e04ed1f",
"active_manifest": "contentauth:urn:uuid:a5dc9189-1dbd-41d7-842d-b935de331547",
"manifests": {
"contentauth:urn:uuid:64bf5b80-9b85-4143-a6df-95247e04ed1f": {
"claim_generator": "make_test_images/0.31.3 c2pa-rs/0.31.3",
"contentauth:urn:uuid:a5dc9189-1dbd-41d7-842d-b935de331547": {
"claim_generator": "make_test_images/0.36.1 c2pa-rs/0.36.1",
"claim_generator_info": [
{
"name": "make_test_images",
"version": "0.31.3"
"version": "0.36.1"
},
{
"name": "c2pa-rs",
"version": "0.31.3"
"version": "0.36.1"
}
],
"title": "CACA.jpg",
"format": "image/jpeg",
"instance_id": "xmp:iid:af80d89c-6cf5-4294-87a3-ecb920e40e28",
"instance_id": "xmp:iid:0492a949-e4e3-4d13-a893-e9a6462ba161",
"thumbnail": {
"format": "image/jpeg",
"identifier": "self#jumbf=c2pa.assertions/c2pa.thumbnail.claim.jpeg"
"identifier": "self#jumbf=/c2pa/contentauth:urn:uuid:a5dc9189-1dbd-41d7-842d-b935de331547/c2pa.assertions/c2pa.thumbnail.claim.jpeg"
},
"ingredients": [
{
"title": "CA.jpg",
"format": "image/jpeg",
"instance_id": "xmp:iid:6dfba703-cbd9-4ed9-aa58-4a45e2969888",
"instance_id": "xmp:iid:f5528711-b891-44f9-80e7-38410fa3961f",
"thumbnail": {
"format": "image/jpeg",
"identifier": "self#jumbf=/c2pa/contentauth:urn:uuid:55ec3f39-910a-4f5c-b6c0-2ecc5487c1d7/c2pa.assertions/c2pa.thumbnail.claim.jpeg"
"identifier": "self#jumbf=/c2pa/contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2/c2pa.assertions/c2pa.thumbnail.claim.jpeg"
},
"relationship": "parentOf",
"active_manifest": "contentauth:urn:uuid:55ec3f39-910a-4f5c-b6c0-2ecc5487c1d7"
"active_manifest": "contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2"
}
],
"assertions": [
Expand All @@ -41,8 +41,8 @@
"@type": "CreativeWork",
"author": [
{
"@type": "Person",
"name": "John Doe"
"name": "John Doe",
"@type": "Person"
}
]
},
Expand All @@ -54,12 +54,16 @@
"actions": [
{
"action": "c2pa.opened",
"instanceId": "xmp:iid:6dfba703-cbd9-4ed9-aa58-4a45e2969888",
"parameters": {
"ingredient": {
"url": "self#jumbf=c2pa.assertions/c2pa.ingredient",
"hash": "XA79Bd5PN1RbcVRajJpOirW/8l9YqK0WectohsIzUYk="
}
"ingredient": [
{
"url": "self#jumbf=c2pa.assertions/c2pa.ingredient",
"hash": "G0zapTTWE/Yl2k5m6rCHSeVDVwnRu0DUNPM9Xi4uEqg="
}
],
"org.cai.ingredientIds": [
"xmp:iid:f5528711-b891-44f9-80e7-38410fa3961f"
]
}
},
{
Expand All @@ -76,28 +80,28 @@
"alg": "Ps256",
"issuer": "C2PA Test Signing Cert",
"cert_serial_number": "720724073027128164015125666832722375746636448153",
"time": "2024-04-10T16:33:39+00:00"
"time": "2024-10-10T22:42:37+00:00"
},
"label": "contentauth:urn:uuid:64bf5b80-9b85-4143-a6df-95247e04ed1f"
"label": "contentauth:urn:uuid:a5dc9189-1dbd-41d7-842d-b935de331547"
},
"contentauth:urn:uuid:55ec3f39-910a-4f5c-b6c0-2ecc5487c1d7": {
"claim_generator": "make_test_images/0.31.3 c2pa-rs/0.31.3",
"contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2": {
"claim_generator": "make_test_images/0.36.1 c2pa-rs/0.36.1",
"claim_generator_info": [
{
"name": "make_test_images",
"version": "0.31.3"
"version": "0.36.1"
},
{
"name": "c2pa-rs",
"version": "0.31.3"
"version": "0.36.1"
}
],
"title": "CA.jpg",
"format": "image/jpeg",
"instance_id": "xmp:iid:548e96a5-1674-4bd7-9331-d5ea3d4367ee",
"instance_id": "xmp:iid:6a6b5d47-5799-47dc-b164-b9960d212de5",
"thumbnail": {
"format": "image/jpeg",
"identifier": "self#jumbf=c2pa.assertions/c2pa.thumbnail.claim.jpeg"
"identifier": "self#jumbf=/c2pa/contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2/c2pa.assertions/c2pa.thumbnail.claim.jpeg"
},
"ingredients": [
{
Expand All @@ -120,8 +124,8 @@
"@type": "CreativeWork",
"author": [
{
"@type": "Person",
"name": "John Doe"
"name": "John Doe",
"@type": "Person"
}
]
},
Expand All @@ -133,12 +137,16 @@
"actions": [
{
"action": "c2pa.opened",
"instanceId": "xmp.iid:813ee422-9736-4cdc-9be6-4e35ed8e41cb",
"parameters": {
"ingredient": {
"url": "self#jumbf=c2pa.assertions/c2pa.ingredient",
"hash": "tTBD4/E0R0AjLUdJFpsVz3lE/KJUq22Vz0UGqzhEpVs="
}
"org.cai.ingredientIds": [
"xmp.iid:813ee422-9736-4cdc-9be6-4e35ed8e41cb"
],
"ingredient": [
{
"url": "self#jumbf=c2pa.assertions/c2pa.ingredient",
"hash": "5dNlxTKe4afGAicpJa1hF1R3mBZKE+Bl0xmh0McXuO4="
}
]
}
},
{
Expand All @@ -155,9 +163,9 @@
"alg": "Ps256",
"issuer": "C2PA Test Signing Cert",
"cert_serial_number": "720724073027128164015125666832722375746636448153",
"time": "2024-04-10T16:33:39+00:00"
"time": "2024-10-10T22:42:36+00:00"
},
"label": "contentauth:urn:uuid:55ec3f39-910a-4f5c-b6c0-2ecc5487c1d7"
"label": "contentauth:urn:uuid:89ba3c19-2ad4-445a-bb7d-bda815bad4c2"
}
}
}
Loading

0 comments on commit e529273

Please sign in to comment.