contentauth/c2pa-python

Parents (ingredients) intake to sign from pre-existing Manifests

Opened this issue · 4 comments

Can we add functionality to the sign_file sdk to extend a pre-existing Manifest incorporating it as a parent.

Original

result = c2pa.sign_file("path/to/source.jpg", "path/to/dest.jpg", manifest_json, sign_info, data_dir)

Proposed

result = c2pa.sign_file("path/to/source.jpg", "path/to/dest.jpg", manifest_json, sign_info, data_dir, ingredients=[Manifests])

This way we can include the parents that formed the child asset

The CLI aligns with this feature partially allowing one parent https://github.com/contentauth/c2patool?tab=readme-ov-file#usage

The new Builder API allows adding as many ingredients as you like:

builder = Builder(manifest_json)
builder.add_ingredient_file({ "title": "A.jpg", "relationship": "parentOf"}, "tests/fixtures/A.jpg")
result = builder.sign_file(signer, testFile, testOutputFile)

I'll be working on more convenience features, such as a simpler.

There can only be one parent ingredient, so there must be some way to indicate that.