@contentauth/c2pa-node / BuilderInterface
Interface: BuilderInterface
Defined in: types.d.ts:178
Methods
addAction()
addAction(
actionJson):void
Defined in: types.d.ts:208
Add a single action to the manifest.
This is a convenience method for adding an action to the Actions assertion.
Parameters
actionJson
string
The JSON representation of the action
Returns
void
addAssertion()
addAssertion(
label,assertion,assertionKind?):void
Defined in: types.d.ts:216
Add CBOR assertion to the builder
Parameters
label
string
The label of the assertion
assertion
unknown
The assertion, should be a string if the type is JSON, otherwise a JS Object
assertionKind?
The type of assertion
Returns
void
addIngredient()
addIngredient(
ingredientJson,ingredient?):Promise<void>
Defined in: types.d.ts:233
Add an ingredient to the manifest
Parameters
ingredientJson
string
The JSON representation of the ingredient
ingredient?
Optional source asset (buffer or file) for the ingredient
Returns
Promise<void>
addResource()
addResource(
uri,resource):Promise<void>
Defined in: types.d.ts:226
Add a resource from a buffer or file
Parameters
uri
string
The URI of the resource
resource
The source and format of the resource
Returns
Promise<void>
getManifestDefinition()
getManifestDefinition():
Manifest
Defined in: types.d.ts:304
Getter for the builder’s manifest definition
Returns
Manifest
The manifest definition
setIntent()
setIntent(
intent):void
Defined in: types.d.ts:189
An intent lets the API know what kind of manifest to create.
Intents are Create, Edit, or Update.
This allows the API to check that you are doing the right thing.
It can also do things for you, like add parent ingredients from the source asset
and automatically add required c2pa.created or c2pa.opened actions.
Create requires a DigitalSourceType. It is used for assets without a parent ingredient.
Edit requires a parent ingredient and is used for most assets that are being edited.
Update is a special case with many restrictions but is more compact than Edit.
Parameters
intent
BuilderIntent
The intent of the manifest
Returns
void
setNoEmbed()
setNoEmbed(
noEmbed):void
Defined in: types.d.ts:195
Set the no embed flag of the manifest
Parameters
noEmbed
boolean
The no embed flag of the manifest
Returns
void
setRemoteUrl()
setRemoteUrl(
url):void
Defined in: types.d.ts:201
Set the remote URL of the manifest
Parameters
url
string
The remote URL of the manifest
Returns
void
sign()
sign(
signer,input,output):Buffer
Defined in: types.d.ts:251
Sign an asset from a buffer or file
Parameters
signer
The local signer to use
input
output
Returns
Buffer
the bytes of the c2pa_manifest that was embedded
signAsync()
signAsync(
callbackSigner,input,output):Promise<Buffer<ArrayBufferLike>>
Defined in: types.d.ts:281
Sign an asset from a buffer or file asynchronously, using a CallbackSigner
Parameters
callbackSigner
The CallbackSigner
CallbackSignerInterface |
IdentityAssertionSignerInterface |
input
output
Returns
Promise<Buffer<ArrayBufferLike>>
the bytes of the c2pa_manifest that was embedded
signConfigAsync()
signConfigAsync(
callback,signerConfig,input,output):Promise<Buffer<ArrayBufferLike>>
Defined in: types.d.ts:266
Sign an asset from a buffer or file asynchronously, using a callback and not passing a private key
Parameters
callback
(data) => Promise<Buffer<ArrayBufferLike>>
The callback function to sign the asset
signerConfig
The configuration for the signer
input
output
Returns
Promise<Buffer<ArrayBufferLike>>
the bytes of the c2pa_manifest that was embedded
signFile()
signFile(
signer,filePath,output):Buffer
Defined in: types.d.ts:294
Embed a signed manifest into a stream using the LocalSigner
Parameters
signer
The local signer to use
filePath
string
output
Returns
Buffer
the bytes of the c2pa_manifest that was embedded
toArchive()
toArchive(
asset):Promise<void>
Defined in: types.d.ts:242
Convert the Builder into a archive formatted buffer or file
Parameters
asset
The file or buffer for the archive
Returns
Promise<void>
updateManifestProperty()
updateManifestProperty(
property,value):void
Defined in: types.d.ts:310
Update a string property of the manifest
Parameters
property
string
value
string |
ClaimVersion |
Returns
void
The manifest definition