import { WorkerPoolOptions } from 'workerpool'; import { ImageProvenance } from './ImageProvenance'; import { IDownloadOptions } from './Downloader'; import { Source } from './Source'; /** * Configuration options for the `ContentAuth` constructor */ export interface IConfig { /** * Either the URL of the WebAssembly binary or a compiled WebAssembly module */ wasmSrc: WebAssembly.Module | string | null; /** * The URL of the web worker JavaScript file */ workerSrc: string | null; /** * Options for the web worker pool * @see {@link https://github.com/josdejong/workerpool#pool} */ poolOptions?: Partial; /** * Options for the asset downloader */ downloadOptions?: Partial; } export declare type ImageInput = string | Blob | File | HTMLImageElement; /** * The Content Authenticity Initiative JavaScript SDK * * @packageDocumentation */ /** * The entry class for the SDK * * @remarks * You can create one instance of this class to process multiple images. * At a minimum, you will have to instantiate it with the URLs of the WASM and the worker: * ```ts * const sdk = new ContentAuth({ wasmSrc, workerSrc }); * const provenance = await sdk.processImage(imageUrl); * ``` * * @public */ export declare class ContentAuth { #private; /** * Creates a new ContentAuth instace that can be used to verify and read * metadata from multiple assets. * * @param cfg - Configuration object for overriding the defaults */ constructor(cfg?: Partial); /** * Processes image data from a `Blob` as input * @param data - The binary data of the image */ processImage(data: Blob): Promise; /** * Processes image data from a `File` as input. Useful for file uploads/drag-and-drop. * @param data - The binary data of the image */ processImage(file: File): Promise; /** * Processes image data from a URL * * @remarks * Note: The file referenced by the URL must either be have the same * {@link https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy | origin} * as the site referencing this code, or it needs to have * {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS | CORS} enabled on the resource. * * @param url - The URL of the image to process */ processImage(url: string): Promise; /** * Processes an image from an HTML image element (``). * * @remarks * This is useful if you want to process the image returned by a `document.querySelector` call * * @param element - DOM element of the image to process */ processImage(element: HTMLImageElement): Promise; processImage(input: ImageInput): Promise; /** * Convenience function to process multiple images at once * * @param inputs Array of inputs to pass to `processImage` */ processImages(inputs: ImageInput[]): Promise; /** * Allows you to generate a report from `application/c2pa` manifest data * @param source The source image this manifest data is attributed to * @param c2paData The `application/c2pa` manifest data */ processC2pa(source: Source, c2paData: Blob): Promise; /** * Generates a URL that pre-loads the `assetUrl` into the Content Authenticity Verify site * for deeper inspection by users. * * @param assetUrl The URL of the asset you want to view in Verify */ static generateVerifyUrl(assetUrl: string): string; /** * Waits until all scheduled tasks have completed, then terminates the pool */ destroy(): Promise; } //# sourceMappingURL=ContentAuth.d.ts.map