Skip to content

Comments

feat: Ingredient API to save snapshot and rehydrate later#71

Open
sorohan wants to merge 1 commit intocontentauth:mainfrom
sorohan:ingredient-snapshot
Open

feat: Ingredient API to save snapshot and rehydrate later#71
sorohan wants to merge 1 commit intocontentauth:mainfrom
sorohan:ingredient-snapshot

Conversation

@sorohan
Copy link

@sorohan sorohan commented Jan 15, 2026

This exposes functionality from the Rust SDK to create an ingredient from a file, serialize it to a snapshot for persistence, and later restore it without needing the original asset bytes.

This enables workflows where ingredients need to be cached and restored later for signing.

Usage:

// 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.addIngredientFromRef(ref, 'componentOf');

Closes #70

@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: df22751

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@contentauth/c2pa-wasm Minor
@contentauth/c2pa-web Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sorohan sorohan force-pushed the ingredient-snapshot branch from 708b11b to df22751 Compare January 28, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to add ingredients without retaining original asset bytes

1 participant