/* tslint:disable */
/* eslint-disable */

interface SignerDefinition {
    sign: (bytes: Uint8Array<ArrayBuffer>) => Promise<Uint8Array<ArrayBuffer>>;
    reserveSize: number;
    alg: string;
}



/**
 * Wraps a `c2pa::Builder`.
 */
export class WasmBuilder {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    /**
     * Add an action to the manifest's `Actions` assertion.
     */
    addAction(action: any): void;
    /**
     * Add an ingredient to the manifest from a JSON ingredient definition without a blob
     *
     * # Arguments
     * * `ingredient_json` - A JSON string representing the ingredient.
     */
    addIngredient(json: string): void;
    /**
     * Add an ingredient to the manifest from a JSON ingredient definition and a [`Blob`].
     *
     * # Arguments
     * * `ingredient_json` - A JSON string representing the ingredient. This ingredient is merged with the ingredient specified in the `stream` argument, and these values take precedence.
     * * `format` - The format of the ingredient.
     * * `blob` - A [`Blob`] representing an asset which should be included as an ingredient.
     */
    addIngredientFromBlob(json: string, format: string, blob: Blob): Promise<void>;
    /**
     * Add a redaction for a JUMBF URI with the given reason.
     *
     * Adds the URI to the builder's redaction list and appends a `c2pa.redacted` action
     * with the reason and URI parameter, as required by the C2PA spec.
     */
    addRedaction(uri: string, reason: any): void;
    /**
     * Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
     */
    addResourceFromBlob(id: string, blob: Blob): void;
    /**
     * Attempts to create a new `WasmBuilder` from a builder archive.
     * Optionally accepts a context JSON string to configure the builder.
     */
    static fromArchive(archive: Blob, context_json?: string | null): WasmBuilder;
    /**
     * Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
     * Optionally accepts a context JSON string to configure the builder.
     */
    static fromJson(json: string, context_json?: string | null): WasmBuilder;
    /**
     * Get the current manifest definition.
     */
    getDefinition(): string;
    /**
     * Creates a new `WasmBuilder` with a minimal manifest definition.
     * Optionally accepts a context JSON string to configure the builder.
     */
    static new(context_json?: string | null): WasmBuilder;
    /**
     * Sets the builder "intent."
     */
    setIntent(json_intent: any): void;
    /**
     * Sets the state of the no_embed flag.
     */
    setNoEmbed(no_embed: boolean): void;
    /**
     * Sets the remote_url for a remote manifest.
     *
     * The URL must return the manifest data and is injected into the destination asset when signing.
     * For remote-only manifests, set the `no_embed` flag to `true`.
     */
    setRemoteUrl(url: string): void;
    /**
     * Sets a thumbnail from a [`Blob`] to be included in the manifest. The thumbnail should represent the asset being signed.
     */
    setThumbnailFromBlob(format: string, blob: Blob): void;
    /**
     * Sign an asset using the provided SignerDefinition, format, and source Blob.
     */
    sign(signer_definition: SignerDefinition, format: string, source: Blob): Promise<Uint8Array>;
    /**
     * Sign an asset using the provided SignerDefinition, format, and source Blob.
     * Use this method to get both the manifest bytes and the bytes of the signed asset.
     */
    signAndGetManifestBytes(signer_definition: SignerDefinition, format: string, source: Blob): Promise<any>;
    /**
     * "Save" a builder to an archive.
     */
    toArchive(): Uint8Array;
}

/**
 * Wraps a `c2pa::Reader`.
 */
export class WasmReader {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    /**
     * Returns the label of the asset's active manifest.
     */
    activeLabel(): string | undefined;
    /**
     * Returns the asset's active manifest.
     */
    activeManifest(): any;
    /**
     * Returns the asset's manifest store as crJSON.
     */
    crJson(): string;
    /**
     * Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
     * Optionally accepts a context JSON string to configure the reader.
     */
    static fromBlob(format: string, blob: Blob, context_json?: string | null): Promise<WasmReader>;
    /**
     * Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
     * Optionally accepts a context JSON string to configure the reader.
     */
    static fromBlobFragment(format: string, init: Blob, fragment: Blob, context_json?: string | null): Promise<WasmReader>;
    /**
     * Returns a JSON representation of the asset's manifest store.
     */
    json(): string;
    /**
     * Returns the asset's manifest store.
     */
    manifestStore(): any;
    /**
     * Accepts a URI reference to a binary object in the resource store and returns a `js_sys::Uint8Array` containing the resource's bytes.
     */
    resourceToBytes(uri: string): Uint8Array;
}

export class WasmSigner {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    /**
     * Attempt to create a new [`WasmSigner`] from a SignerDefinition.
     */
    static fromDefinition(def: SignerDefinition): WasmSigner;
}

/**
 *
 * * NOTE: we can only return Err(JsString) or Err(JsValue) as error types here, because for some as-of-yet unknown
 * * reason, wasm-bindgen appears to mishandle JsErrors when created in a Firefox web worker.
 * *
 * * See: https://github.com/wasm-bindgen/wasm-bindgen/issues/4961
 *
 * Accepts a JSON-serialized string to be loaded as c2pa-rs settings.
 */
export function loadSettings(settings: string): void;

/**
 * Called when the WASM binary is initialized.
 */
export function run(): void;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
    readonly memory: WebAssembly.Memory;
    readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
    readonly wasmbuilder_addAction: (a: number, b: any) => [number, number];
    readonly wasmbuilder_addIngredient: (a: number, b: number, c: number) => [number, number];
    readonly wasmbuilder_addIngredientFromBlob: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
    readonly wasmbuilder_addRedaction: (a: number, b: number, c: number, d: any) => [number, number];
    readonly wasmbuilder_addResourceFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
    readonly wasmbuilder_fromArchive: (a: any, b: number, c: number) => [number, number, number];
    readonly wasmbuilder_fromJson: (a: number, b: number, c: number, d: number) => [number, number, number];
    readonly wasmbuilder_getDefinition: (a: number) => [number, number, number];
    readonly wasmbuilder_new: (a: number, b: number) => [number, number, number];
    readonly wasmbuilder_setIntent: (a: number, b: any) => [number, number];
    readonly wasmbuilder_setNoEmbed: (a: number, b: number) => void;
    readonly wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
    readonly wasmbuilder_setThumbnailFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
    readonly wasmbuilder_sign: (a: number, b: any, c: number, d: number, e: any) => any;
    readonly wasmbuilder_signAndGetManifestBytes: (a: number, b: any, c: number, d: number, e: any) => any;
    readonly wasmbuilder_toArchive: (a: number) => [number, number, number];
    readonly __wbg_wasmreader_free: (a: number, b: number) => void;
    readonly wasmreader_activeLabel: (a: number) => [number, number];
    readonly wasmreader_activeManifest: (a: number) => [number, number, number];
    readonly wasmreader_crJson: (a: number) => [number, number];
    readonly wasmreader_fromBlob: (a: number, b: number, c: any, d: number, e: number) => any;
    readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any, e: number, f: number) => any;
    readonly wasmreader_json: (a: number) => [number, number];
    readonly wasmreader_manifestStore: (a: number) => [number, number, number];
    readonly wasmreader_resourceToBytes: (a: number, b: number, c: number) => [number, number, number];
    readonly loadSettings: (a: number, b: number) => [number, number];
    readonly run: () => void;
    readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
    readonly wasmsigner_fromDefinition: (a: any) => [number, number, number];
    readonly wasm_bindgen__convert__closures_____invoke__hf2acc361175a8d00: (a: number, b: number, c: any) => [number, number];
    readonly wasm_bindgen__convert__closures_____invoke__h53f6302d12a3bd57: (a: number, b: number, c: any, d: any) => void;
    readonly wasm_bindgen__convert__closures_____invoke__h9ad77c532ffa5b9e: (a: number, b: number) => void;
    readonly __wbindgen_malloc: (a: number, b: number) => number;
    readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
    readonly __wbindgen_exn_store: (a: number) => void;
    readonly __externref_table_alloc: () => number;
    readonly __wbindgen_externrefs: WebAssembly.Table;
    readonly __wbindgen_free: (a: number, b: number, c: number) => void;
    readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
    readonly __externref_table_dealloc: (a: number) => void;
    readonly __wbindgen_start: () => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;

/**
 * Instantiates the given `module`, which can either be bytes or
 * a precompiled `WebAssembly.Module`.
 *
 * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
 *
 * @returns {InitOutput}
 */
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;

/**
 * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
 * for everything else, calls `WebAssembly.instantiate` directly.
 *
 * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
 *
 * @returns {Promise<InitOutput>}
 */
export default function __wbg_init (module_or_path: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
export declare const WASM_SRI: string;