Add an action to the manifest's actions assertion.
Add an assertion to the manifest under the given label.
The assertion label (reverse-domain format).
The assertion data (any JSON-serializable value).
Add an ingredient to the builder from a definition only.
Ingredient definition.
Add an ingredient to the builder from a definition, format, and blob. Values specified in the ingredient definition will be merged with the ingredient, and these values take precendence.
Ingredient definition.
Format of the ingredient.
Blob of the ingredient's bytes.
Redact an assertion from an ingredient manifest.
Adds the URI to the builder's redaction list and appends a c2pa.redacted action
with the given reason, as required by the C2PA spec.
JUMBF URI of the assertion to redact.
The C2paReason for the redaction.
Add a resource to the builder's resource store with an ID and blob of the resource's bytes.
ID associated with the resource being added.
Blob of the resource's bytes.
Experimental.
Retains only the actions for which keep returns true.
The inception action, c2pa.created or c2pa.opened, is always kept regardless of keep,
and is moved to index 0 if needed, so the manifest stays valid per the C2PA spec. Sets
allActionsIncluded = false when anything is removed. This does not touch ingredients.
Call Builder.filterIngredients, using filterIngredients(() => false) to drop all
orphans, afterwards if you also want to drop ingredients now orphaned by the removed
actions.
Experimental. Retains actions and ingredients together in one step.
rescueIngredient is evaluated for every ingredient first; any action referencing an
ingredient it would rescue is force-kept regardless of keepAction.
The action is retained when the predicate returns true.
Can rescue an otherwise-orphaned ingredient (and the action referencing it) by returning true.
Experimental. Retains ingredients, then rewrites positional ingredient references so linked actions stay valid.
An ingredient is kept if it is referenced by a current action, is a parentOf ingredient,
or rescue returns true for it. rescue therefore only ever rescues an otherwise-orphaned
ingredient. It can never drop a referenced or lineage ingredient. Call
Builder.filterActions first if you are also removing actions: the keep-set is
computed from whatever actions currently remain.
Can rescue an otherwise-orphaned ingredient by returning true.
Dispose of this Builder, freeing the memory it occupied and preventing further use. Call this whenever the Builder is no longer needed.
Gets the current manifest definition held by the builder.
The ManifestDefinition held by the builder.
Sets the builder "intent."
Sets the state of the no_embed flag. To skip embedding a manifest (e.g. for the remote-only case) set this to true.
Value to set the no_embed flag.
Sets the remote URL for a remote manifest. The manifest is expected to be available at this location.
URL pointing to the location the remote manifest will be stored.
Set a thumbnail from a blob to be included in the manifest. The blob should represent the asset being signed.
Format of the thumbnail
Blob of the thumbnail bytes
Sign an asset.
Sign an asset and get both the signed asset bytes and the manifest bytes.
Save the builder into .c2pa format. This "archive" can be added to as an ingredient with addIngredientFromBlob
A builder archive in application/c2pa format.
Replaces the actions in the c2pa.actions/c2pa.actions.v2 assertions.
A manifest can carry more than one actions assertion (the created-list and
gathered-list entries are distinct assertions). transform is therefore
invoked once per actions assertion, in positional order, with that
assertion's own actions.
A no-op if there is no actions assertion. Use addAction for those.
The returned list is written back as is.
transform can therefore produce an actions array that fails
validation at signing time, for example by removing the inception action
(c2pa.created/c2pa.opened) or moving it out of first position.
Exposes methods for building C2PA manifests and signing assets.