The current ingredient API requires adding an ingredient using the asset bytes, at the time of building the manifest for signing.
We require a workflow where we can read the ingredient ahead of time and store a snapshot to add to the builder later.
The proposed API is to add a new c2pa.ingredient factory:
// Create & persist ingredient
const ref = await c2pa.ingredient.fromBlob(format, blob);
const snapshot = await ref.toSnapshot();
await save(snapshot); // save the snapshot somewhere
// Restore & use
const snapshot = load(); // load the snapshot from somewhere
const ref = await c2pa.ingredient.fromSnapshot(snapshot);
await builder.addIngredient(ref, 'componentOf');
This is pretty consistent with the rust SDK.
The current ingredient API requires adding an ingredient using the asset bytes, at the time of building the manifest for signing.
We require a workflow where we can read the ingredient ahead of time and store a snapshot to add to the builder later.
The proposed API is to add a new
c2pa.ingredientfactory:This is pretty consistent with the rust SDK.