@contentauth/c2pa-wasm 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,7 +33,7 @@ rustup target add wasm32-unknown-unknown
33
33
  [Documentation](https://wasm-bindgen.github.io/wasm-bindgen/reference/cli)
34
34
 
35
35
  ```sh
36
- cargo install wasm-bindgen-cli@0.2.105
36
+ cargo install wasm-bindgen-cli@0.2.106
37
37
  ```
38
38
 
39
39
  #### wasm-pack
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentauth/c2pa-wasm",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./pkg/c2pa.js",
package/pkg/c2pa.d.ts CHANGED
@@ -1,13 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Called when the WASM binary is initialized.
5
- */
6
- export function run(): void;
7
- /**
8
- * Accepts a JSON-serialized string to be loaded as c2pa-rs settings.
9
- */
10
- export function loadSettings(settings: string): void;
11
3
 
12
4
  interface SignerDefinition {
13
5
  sign: (bytes: Uint8Array<ArrayBuffer>) => Promise<Uint8Array<ArrayBuffer>>;
@@ -16,9 +8,7 @@ interface SignerDefinition {
16
8
  }
17
9
 
18
10
 
19
- /**
20
- * Wraps a `c2pa::Builder`.
21
- */
11
+
22
12
  export class WasmBuilder {
23
13
  private constructor();
24
14
  free(): void;
@@ -37,12 +27,20 @@ export class WasmBuilder {
37
27
  toArchive(): Uint8Array;
38
28
  /**
39
29
  * Attempts to create a new `WasmBuilder` from a builder archive.
30
+ * Optionally accepts a context JSON string to configure the builder.
40
31
  */
41
- static fromArchive(archive: Blob): WasmBuilder;
32
+ static fromArchive(archive: Blob, _context_json?: string | null): WasmBuilder;
42
33
  /**
43
34
  * Sets the state of the no_embed flag.
44
35
  */
45
36
  setNoEmbed(no_embed: boolean): void;
37
+ /**
38
+ * Add an ingredient to the manifest from a JSON ingredient definition without a blob
39
+ *
40
+ * # Arguments
41
+ * * `ingredient_json` - A JSON string representing the ingredient.
42
+ */
43
+ addIngredient(json: string): void;
46
44
  /**
47
45
  * Get the current manifest definition.
48
46
  */
@@ -78,20 +76,20 @@ export class WasmBuilder {
78
76
  signAndGetManifestBytes(signer_definition: SignerDefinition, format: string, source: Blob): Promise<any>;
79
77
  /**
80
78
  * Creates a new `WasmBuilder` with a minimal manifest definition.
79
+ * Optionally accepts a context JSON string to configure the builder.
81
80
  */
82
- static new(): WasmBuilder;
81
+ static new(context_json?: string | null): WasmBuilder;
83
82
  /**
84
83
  * Sign an asset using the provided SignerDefinition, format, and source Blob.
85
84
  */
86
85
  sign(signer_definition: SignerDefinition, format: string, source: Blob): Promise<Uint8Array>;
87
86
  /**
88
87
  * Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
88
+ * Optionally accepts a context JSON string to configure the builder.
89
89
  */
90
- static fromJson(json: string): WasmBuilder;
90
+ static fromJson(json: string, context_json?: string | null): WasmBuilder;
91
91
  }
92
- /**
93
- * Wraps a `c2pa::Reader`.
94
- */
92
+
95
93
  export class WasmReader {
96
94
  private constructor();
97
95
  free(): void;
@@ -114,17 +112,20 @@ export class WasmReader {
114
112
  resourceToBytes(uri: string): Uint8Array;
115
113
  /**
116
114
  * Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
115
+ * Optionally accepts a context JSON string to configure the reader.
117
116
  */
118
- static fromBlobFragment(format: string, init: Blob, fragment: Blob): Promise<WasmReader>;
117
+ static fromBlobFragment(format: string, init: Blob, fragment: Blob, context_json?: string | null): Promise<WasmReader>;
119
118
  /**
120
119
  * Returns a JSON representation of the asset's manifest store.
121
120
  */
122
121
  json(): string;
123
122
  /**
124
123
  * Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
124
+ * Optionally accepts a context JSON string to configure the reader.
125
125
  */
126
- static fromBlob(format: string, blob: Blob): Promise<WasmReader>;
126
+ static fromBlob(format: string, blob: Blob, context_json?: string | null): Promise<WasmReader>;
127
127
  }
128
+
128
129
  export class WasmSigner {
129
130
  private constructor();
130
131
  free(): void;
@@ -135,18 +136,32 @@ export class WasmSigner {
135
136
  static fromDefinition(def: SignerDefinition): WasmSigner;
136
137
  }
137
138
 
139
+ /**
140
+ * Accepts a JSON-serialized string to be loaded as c2pa-rs settings.
141
+ */
142
+ export function loadSettings(settings: string): void;
143
+
144
+ /**
145
+ * Called when the WASM binary is initialized.
146
+ */
147
+ export function run(): void;
148
+
138
149
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
139
150
 
140
151
  export interface InitOutput {
141
152
  readonly memory: WebAssembly.Memory;
153
+ readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
154
+ readonly wasmsigner_fromDefinition: (a: any) => [number, number, number];
142
155
  readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
156
+ readonly loadSettings: (a: number, b: number) => [number, number];
143
157
  readonly wasmbuilder_addAction: (a: number, b: any) => [number, number];
158
+ readonly wasmbuilder_addIngredient: (a: number, b: number, c: number) => [number, number];
144
159
  readonly wasmbuilder_addIngredientFromBlob: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number];
145
160
  readonly wasmbuilder_addResourceFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
146
- readonly wasmbuilder_fromArchive: (a: any) => [number, number, number];
147
- readonly wasmbuilder_fromJson: (a: number, b: number) => [number, number, number];
161
+ readonly wasmbuilder_fromArchive: (a: any, b: number, c: number) => [number, number, number];
162
+ readonly wasmbuilder_fromJson: (a: number, b: number, c: number, d: number) => [number, number, number];
148
163
  readonly wasmbuilder_getDefinition: (a: number) => [number, number, number];
149
- readonly wasmbuilder_new: () => [number, number, number];
164
+ readonly wasmbuilder_new: (a: number, b: number) => [number, number, number];
150
165
  readonly wasmbuilder_setIntent: (a: number, b: any) => [number, number];
151
166
  readonly wasmbuilder_setNoEmbed: (a: number, b: number) => void;
152
167
  readonly wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
@@ -154,24 +169,20 @@ export interface InitOutput {
154
169
  readonly wasmbuilder_sign: (a: number, b: any, c: number, d: number, e: any) => any;
155
170
  readonly wasmbuilder_signAndGetManifestBytes: (a: number, b: any, c: number, d: number, e: any) => any;
156
171
  readonly wasmbuilder_toArchive: (a: number) => [number, number, number];
157
- readonly loadSettings: (a: number, b: number) => [number, number];
158
- readonly run: () => void;
159
- readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
160
- readonly wasmsigner_fromDefinition: (a: any) => [number, number, number];
161
172
  readonly __wbg_wasmreader_free: (a: number, b: number) => void;
173
+ readonly run: () => void;
162
174
  readonly wasmreader_activeLabel: (a: number) => [number, number];
163
175
  readonly wasmreader_activeManifest: (a: number) => [number, number, number];
164
- readonly wasmreader_fromBlob: (a: number, b: number, c: any) => any;
165
- readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any) => any;
176
+ readonly wasmreader_fromBlob: (a: number, b: number, c: any, d: number, e: number) => any;
177
+ readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any, e: number, f: number) => any;
166
178
  readonly wasmreader_json: (a: number) => [number, number];
167
179
  readonly wasmreader_manifestStore: (a: number) => [number, number, number];
168
180
  readonly wasmreader_resourceToBytes: (a: number, b: number, c: number) => [number, number, number];
169
- readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
170
- readonly wasm_bindgen__convert__closures_____invoke__hbb73f02d9cb5eeb0: (a: number, b: number) => void;
171
- readonly wasm_bindgen__closure__destroy__h3685db4568587cc8: (a: number, b: number) => void;
172
- readonly wasm_bindgen__convert__closures_____invoke__hedbe22ff1e6181ec: (a: number, b: number, c: any) => void;
173
- readonly wasm_bindgen__closure__destroy__h4e2af4dd32e0f9a7: (a: number, b: number) => void;
174
- readonly wasm_bindgen__convert__closures_____invoke__h1fd2c9ff95892b8d: (a: number, b: number, c: any, d: any) => void;
181
+ readonly wasm_bindgen__convert__closures_____invoke__hbb62da5b17229099: (a: number, b: number) => void;
182
+ readonly wasm_bindgen__closure__destroy__h4cef5599c1857d46: (a: number, b: number) => void;
183
+ readonly wasm_bindgen__convert__closures_____invoke__h6e57fd9fec4e535c: (a: number, b: number, c: any) => void;
184
+ readonly wasm_bindgen__closure__destroy__h1529e0ff12464e8c: (a: number, b: number) => void;
185
+ readonly wasm_bindgen__convert__closures_____invoke__ha15b80997070ee79: (a: number, b: number, c: any, d: any) => void;
175
186
  readonly __wbindgen_malloc: (a: number, b: number) => number;
176
187
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
177
188
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -183,6 +194,7 @@ export interface InitOutput {
183
194
  }
184
195
 
185
196
  export type SyncInitInput = BufferSource | WebAssembly.Module;
197
+
186
198
  /**
187
199
  * Instantiates the given `module`, which can either be bytes or
188
200
  * a precompiled `WebAssembly.Module`.