@contentauth/c2pa-node / Builder
Class: Builder
Defined in: Builder.ts:31
Implements
Methods
addAssertion()
addAssertion(
label,assertion,assertionKind?):void
Defined in: Builder.ts:66
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
Implementation of
addIngredient()
addIngredient(
ingredientJson,ingredient):Promise<void>
Defined in: Builder.ts:83
Add an ingredient from a buffer or file
Parameters
ingredientJson
string
The JSON representation of the ingredient
ingredient
The source and format of the ingredient
Returns
Promise<void>
Implementation of
BuilderInterface.addIngredient
addResource()
addResource(
uri,resource):Promise<void>
Defined in: Builder.ts:79
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>
Implementation of
getManifestDefinition()
getManifestDefinition():
Manifest
Defined in: Builder.ts:177
Getter for the builder’s manifest definition
Returns
Manifest
The manifest definition
Implementation of
BuilderInterface.getManifestDefinition
setNoEmbed()
setNoEmbed(
noEmbed):void
Defined in: Builder.ts:58
Set the no embed flag of the manifest
Parameters
noEmbed
boolean = true
The no embed flag of the manifest
Returns
void
Implementation of
setRemoteUrl()
setRemoteUrl(
remoteUrl):void
Defined in: Builder.ts:62
Set the remote URL of the manifest
Parameters
remoteUrl
string
Returns
void
Implementation of
sign()
sign(
signer,input,output):Buffer
Defined in: Builder.ts:102
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
Implementation of
signAsync()
signAsync(
signer,input,output):Promise<Buffer<ArrayBufferLike>>
Defined in: Builder.ts:146
Sign an asset from a buffer or file asynchronously, using a CallbackSigner
Parameters
signer
CallbackSignerInterface |
IdentityAssertionSignerInterface |
input
output
Returns
Promise<Buffer<ArrayBufferLike>>
the bytes of the c2pa_manifest that was embedded
Implementation of
signConfigAsync()
signConfigAsync(
callback,signerConfig,input,output):Promise<Buffer<ArrayBufferLike>>
Defined in: Builder.ts:119
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
Implementation of
BuilderInterface.signConfigAsync
signFile()
signFile(
signer,filePath,output):Buffer
Defined in: Builder.ts:110
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
Implementation of
toArchive()
toArchive(
asset):Promise<void>
Defined in: Builder.ts:94
Convert the Builder into a archive formatted buffer or file
Parameters
asset
The file or buffer for the archive
Returns
Promise<void>
Implementation of
updateManifestProperty()
updateManifestProperty(
property,value):void
Defined in: Builder.ts:181
Update a string property of the manifest
Parameters
property
string
value
Returns
void
The manifest definition
Implementation of
BuilderInterface.updateManifestProperty
fromArchive()
staticfromArchive(asset):Promise<Builder>
Defined in: Builder.ts:98
Parameters
asset
Returns
Promise<Builder>
new()
staticnew():Builder
Defined in: Builder.ts:34
Returns
Builder
withJson()
staticwithJson(json):Builder
Defined in: Builder.ts:39
Parameters
json
Manifest
Returns
Builder