@contentauth/c2pa-wasm 0.2.0 → 0.3.0

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 ADDED
@@ -0,0 +1,65 @@
1
+ # c2pa-wasm
2
+
3
+ The WebAssembly wrapper for [`c2pa-rs`](https://github.com/contentauth/c2pa-rs) that powers `c2pa-web`, built with [wasm-bindgen](https://github.com/wasm-bindgen/wasm-bindgen). While these bindings can be used directly, most users will prefer the convenience of `c2pa-web`.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install @contentauth/c2pa-wasm
9
+ ```
10
+
11
+ ## Development
12
+
13
+ ### Prerequsities
14
+
15
+ Ensure the repo-wide prerequisites [NX](https://nx.dev/getting-started/intro) and [pnpm](https://pnpm.io/) are installed.
16
+
17
+ Then, all of the following prerequisites must be installed before `c2pa-wasm` can be built:
18
+
19
+ #### Rust
20
+
21
+ [Installation instructions](https://www.rust-lang.org/tools/install)
22
+
23
+ Minimum supported Rust version: **1.86.0**.
24
+
25
+ Additionally, the `wasm32-unknown-unknown` target must be installed:
26
+
27
+ ```sh
28
+ rustup target add wasm32-unknown-unknown
29
+ ```
30
+
31
+ #### wasm-bindgen-cli
32
+
33
+ [Documentation](https://wasm-bindgen.github.io/wasm-bindgen/reference/cli)
34
+
35
+ ```sh
36
+ cargo install wasm-bindgen-cli@0.2.103
37
+ ```
38
+
39
+ #### wasm-pack
40
+
41
+ [Documentation](https://rustwasm.github.io/docs/wasm-pack/)
42
+
43
+ ```sh
44
+ cargo install wasm-pack@0.13.1
45
+ ```
46
+
47
+ ### Building
48
+
49
+ To build the library:
50
+
51
+ ```sh
52
+ nx build c2pa-wasm
53
+ ```
54
+
55
+ This will execute the commands defined in the [nx-wasm-bindgen executor](https://github.com/contentauth/c2pa-js-v2/blob/main/tools/nx-wasm-bindgen/src/executors/build/executor.ts) to produce the final output in the `pkg/` directory.
56
+
57
+ ### Testing
58
+
59
+ The library relies on [`wasm-pack`](https://rustwasm.github.io/docs/wasm-pack/) to run its tests. As a general principle, the majority of test coverage will come from `c2pa-web`'s test suite.
60
+
61
+ To run the tests:
62
+
63
+ ```
64
+ nx test c2pa-wasm
65
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentauth/c2pa-wasm",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./pkg/c2pa.js",
package/pkg/c2pa.d.ts CHANGED
@@ -8,6 +8,60 @@ export function loadSettings(settings: string): void;
8
8
  * Called when the WASM binary is initialized.
9
9
  */
10
10
  export function run(): void;
11
+
12
+ interface SignerDefinition {
13
+ sign: (bytes: Uint8Array) => Promise<Uint8Array>;
14
+ reserveSize: number;
15
+ alg: string;
16
+
17
+
18
+ /**
19
+ * Wraps a `c2pa::Builder`.
20
+ */
21
+ export class WasmBuilder {
22
+ private constructor();
23
+ free(): void;
24
+ /**
25
+ * Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
26
+ */
27
+ static fromJson(json: string): WasmBuilder;
28
+ /**
29
+ * Sets the remote_url for a remote manifest.
30
+ *
31
+ * The URL must return the manifest data and is injected into the destination asset when signing.
32
+ * For remote-only manifests, set the `no_embed` flag to `true`.
33
+ */
34
+ setRemoteUrl(format: string): void;
35
+ /**
36
+ * Sets the state of the no_embed flag.
37
+ */
38
+ setNoEmbed(no_embed: boolean): void;
39
+ /**
40
+ * Sets a thumbnail from a [`Blob`] to be included in the manifest. The thumbnail should represent the asset being signed.
41
+ */
42
+ setThumbnailFromBlob(format: string, blob: Blob): void;
43
+ /**
44
+ * Add an ingredient to the manifest from a JSON ingredient definition and a [`Blob`].
45
+ *
46
+ * # Arguments
47
+ * * `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.
48
+ * * `format` - The format of the ingredient.
49
+ * * `blob` - A [`Blob`] representing an asset which should be included as an ingredient.
50
+ */
51
+ addIngredientFromBlob(json: string, format: string, blob: Blob): void;
52
+ /**
53
+ * Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
54
+ */
55
+ addResourceFromBlob(id: string, blob: Blob): void;
56
+ /**
57
+ * Get the current manifest definition.
58
+ */
59
+ getDefinition(): string;
60
+ /**
61
+ * Sign an asset using the provided SignerDefinition, format, and source Blob.
62
+ */
63
+ sign(signer_definition: SignerDefinition, format: string, source: Blob): Promise<Uint8Array>;
64
+ }
11
65
  /**
12
66
  * Wraps a `c2pa::Reader`.
13
67
  */
@@ -45,11 +99,32 @@ export class WasmReader {
45
99
  */
46
100
  resourceToBuffer(uri: string): ArrayBuffer;
47
101
  }
102
+ export class WasmSigner {
103
+ private constructor();
104
+ free(): void;
105
+ /**
106
+ * Attempt to create a new [`WasmSigner`] from a SignerDefinition.
107
+ */
108
+ static fromDefinition(def: SignerDefinition): WasmSigner;
109
+ }
48
110
 
49
111
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
50
112
 
51
113
  export interface InitOutput {
52
114
  readonly memory: WebAssembly.Memory;
115
+ readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
116
+ readonly wasmbuilder_fromJson: (a: number, b: number) => [number, number, number];
117
+ readonly wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
118
+ readonly wasmbuilder_setNoEmbed: (a: number, b: number) => void;
119
+ readonly wasmbuilder_setThumbnailFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
120
+ readonly wasmbuilder_addIngredientFromBlob: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number];
121
+ readonly wasmbuilder_addResourceFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
122
+ readonly wasmbuilder_getDefinition: (a: number) => [number, number, number];
123
+ readonly wasmbuilder_sign: (a: number, b: any, c: number, d: number, e: any) => any;
124
+ readonly loadSettings: (a: number, b: number) => [number, number];
125
+ readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
126
+ readonly wasmsigner_fromDefinition: (a: any) => [number, number, number];
127
+ readonly run: () => void;
53
128
  readonly __wbg_wasmreader_free: (a: number, b: number) => void;
54
129
  readonly wasmreader_fromBlob: (a: number, b: number, c: any) => any;
55
130
  readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any) => any;
@@ -58,8 +133,6 @@ export interface InitOutput {
58
133
  readonly wasmreader_activeManifest: (a: number) => [number, number, number];
59
134
  readonly wasmreader_json: (a: number) => [number, number];
60
135
  readonly wasmreader_resourceToBuffer: (a: number, b: number, c: number) => [number, number, number];
61
- readonly loadSettings: (a: number, b: number) => [number, number];
62
- readonly run: () => void;
63
136
  readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
64
137
  readonly __wbindgen_exn_store: (a: number) => void;
65
138
  readonly __externref_table_alloc: () => number;
@@ -69,9 +142,9 @@ export interface InitOutput {
69
142
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
70
143
  readonly __wbindgen_export_6: WebAssembly.Table;
71
144
  readonly __externref_table_dealloc: (a: number) => void;
72
- readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf8e9222f46d15a02: (a: number, b: number) => void;
73
- readonly closure1461_externref_shim: (a: number, b: number, c: any) => void;
74
- readonly closure2453_externref_shim: (a: number, b: number, c: any, d: any) => void;
145
+ readonly closure1669_externref_shim: (a: number, b: number, c: any) => void;
146
+ readonly wasm_bindgen__convert__closures_____invoke__h09e04d5375df482d: (a: number, b: number) => void;
147
+ readonly closure2615_externref_shim: (a: number, b: number, c: any, d: any) => void;
75
148
  readonly __wbindgen_start: () => void;
76
149
  }
77
150
 
package/pkg/c2pa.js CHANGED
@@ -1,9 +1,5 @@
1
1
  let wasm;
2
2
 
3
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
-
5
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
6
-
7
3
  let cachedUint8ArrayMemory0 = null;
8
4
 
9
5
  function getUint8ArrayMemory0() {
@@ -13,9 +9,25 @@ function getUint8ArrayMemory0() {
13
9
  return cachedUint8ArrayMemory0;
14
10
  }
15
11
 
12
+ let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
13
+
14
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
15
+
16
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
+ let numBytesDecoded = 0;
18
+ function decodeText(ptr, len) {
19
+ numBytesDecoded += len;
20
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
+ cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
22
+ cachedTextDecoder.decode();
23
+ numBytesDecoded = len;
24
+ }
25
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
+ }
27
+
16
28
  function getStringFromWasm0(ptr, len) {
17
29
  ptr = ptr >>> 0;
18
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
+ return decodeText(ptr, len);
19
31
  }
20
32
 
21
33
  function addToExternrefTable0(obj) {
@@ -33,6 +45,11 @@ function handleError(f, args) {
33
45
  }
34
46
  }
35
47
 
48
+ function getArrayU8FromWasm0(ptr, len) {
49
+ ptr = ptr >>> 0;
50
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
51
+ }
52
+
36
53
  let WASM_VECTOR_LEN = 0;
37
54
 
38
55
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -102,37 +119,6 @@ function isLikeNone(x) {
102
119
  return x === undefined || x === null;
103
120
  }
104
121
 
105
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
106
- ? { register: () => {}, unregister: () => {} }
107
- : new FinalizationRegistry(state => {
108
- wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
109
- });
110
-
111
- function makeMutClosure(arg0, arg1, dtor, f) {
112
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
113
- const real = (...args) => {
114
- // First up with a closure we increment the internal reference
115
- // count. This ensures that the Rust closure environment won't
116
- // be deallocated while we're invoking it.
117
- state.cnt++;
118
- const a = state.a;
119
- state.a = 0;
120
- try {
121
- return f(a, state.b, ...args);
122
- } finally {
123
- if (--state.cnt === 0) {
124
- wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
125
- CLOSURE_DTORS.unregister(state);
126
- } else {
127
- state.a = a;
128
- }
129
- }
130
- };
131
- real.original = state;
132
- CLOSURE_DTORS.register(real, state, state);
133
- return real;
134
- }
135
-
136
122
  function debugString(val) {
137
123
  // primitive types
138
124
  const type = typeof val;
@@ -198,6 +184,40 @@ function debugString(val) {
198
184
  return className;
199
185
  }
200
186
 
187
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
188
+ ? { register: () => {}, unregister: () => {} }
189
+ : new FinalizationRegistry(
190
+ state => {
191
+ wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
192
+ }
193
+ );
194
+
195
+ function makeMutClosure(arg0, arg1, dtor, f) {
196
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
197
+ const real = (...args) => {
198
+
199
+ // First up with a closure we increment the internal reference
200
+ // count. This ensures that the Rust closure environment won't
201
+ // be deallocated while we're invoking it.
202
+ state.cnt++;
203
+ const a = state.a;
204
+ state.a = 0;
205
+ try {
206
+ return f(a, state.b, ...args);
207
+ } finally {
208
+ if (--state.cnt === 0) {
209
+ wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
210
+ CLOSURE_DTORS.unregister(state);
211
+ } else {
212
+ state.a = a;
213
+ }
214
+ }
215
+ };
216
+ real.original = state;
217
+ CLOSURE_DTORS.register(real, state, state);
218
+ return real;
219
+ }
220
+
201
221
  function takeFromExternrefTable0(idx) {
202
222
  const value = wasm.__wbindgen_export_2.get(idx);
203
223
  wasm.__externref_table_dealloc(idx);
@@ -223,22 +243,155 @@ export function run() {
223
243
  wasm.run();
224
244
  }
225
245
 
226
- function __wbg_adapter_38(arg0, arg1) {
227
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf8e9222f46d15a02(arg0, arg1);
246
+ function __wbg_adapter_6(arg0, arg1, arg2) {
247
+ wasm.closure1669_externref_shim(arg0, arg1, arg2);
228
248
  }
229
249
 
230
- function __wbg_adapter_41(arg0, arg1, arg2) {
231
- wasm.closure1461_externref_shim(arg0, arg1, arg2);
250
+ function __wbg_adapter_11(arg0, arg1) {
251
+ wasm.wasm_bindgen__convert__closures_____invoke__h09e04d5375df482d(arg0, arg1);
232
252
  }
233
253
 
234
- function __wbg_adapter_153(arg0, arg1, arg2, arg3) {
235
- wasm.closure2453_externref_shim(arg0, arg1, arg2, arg3);
254
+ function __wbg_adapter_168(arg0, arg1, arg2, arg3) {
255
+ wasm.closure2615_externref_shim(arg0, arg1, arg2, arg3);
236
256
  }
237
257
 
238
258
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
239
259
 
240
260
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
241
261
 
262
+ const WasmBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
263
+ ? { register: () => {}, unregister: () => {} }
264
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbuilder_free(ptr >>> 0, 1));
265
+ /**
266
+ * Wraps a `c2pa::Builder`.
267
+ */
268
+ export class WasmBuilder {
269
+
270
+ static __wrap(ptr) {
271
+ ptr = ptr >>> 0;
272
+ const obj = Object.create(WasmBuilder.prototype);
273
+ obj.__wbg_ptr = ptr;
274
+ WasmBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
275
+ return obj;
276
+ }
277
+
278
+ __destroy_into_raw() {
279
+ const ptr = this.__wbg_ptr;
280
+ this.__wbg_ptr = 0;
281
+ WasmBuilderFinalization.unregister(this);
282
+ return ptr;
283
+ }
284
+
285
+ free() {
286
+ const ptr = this.__destroy_into_raw();
287
+ wasm.__wbg_wasmbuilder_free(ptr, 0);
288
+ }
289
+ /**
290
+ * Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
291
+ * @param {string} json
292
+ * @returns {WasmBuilder}
293
+ */
294
+ static fromJson(json) {
295
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
296
+ const len0 = WASM_VECTOR_LEN;
297
+ const ret = wasm.wasmbuilder_fromJson(ptr0, len0);
298
+ if (ret[2]) {
299
+ throw takeFromExternrefTable0(ret[1]);
300
+ }
301
+ return WasmBuilder.__wrap(ret[0]);
302
+ }
303
+ /**
304
+ * Sets the remote_url for a remote manifest.
305
+ *
306
+ * The URL must return the manifest data and is injected into the destination asset when signing.
307
+ * For remote-only manifests, set the `no_embed` flag to `true`.
308
+ * @param {string} format
309
+ */
310
+ setRemoteUrl(format) {
311
+ const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
312
+ const len0 = WASM_VECTOR_LEN;
313
+ wasm.wasmbuilder_setRemoteUrl(this.__wbg_ptr, ptr0, len0);
314
+ }
315
+ /**
316
+ * Sets the state of the no_embed flag.
317
+ * @param {boolean} no_embed
318
+ */
319
+ setNoEmbed(no_embed) {
320
+ wasm.wasmbuilder_setNoEmbed(this.__wbg_ptr, no_embed);
321
+ }
322
+ /**
323
+ * Sets a thumbnail from a [`Blob`] to be included in the manifest. The thumbnail should represent the asset being signed.
324
+ * @param {string} format
325
+ * @param {Blob} blob
326
+ */
327
+ setThumbnailFromBlob(format, blob) {
328
+ const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
329
+ const len0 = WASM_VECTOR_LEN;
330
+ const ret = wasm.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr, ptr0, len0, blob);
331
+ if (ret[1]) {
332
+ throw takeFromExternrefTable0(ret[0]);
333
+ }
334
+ }
335
+ /**
336
+ * Add an ingredient to the manifest from a JSON ingredient definition and a [`Blob`].
337
+ *
338
+ * # Arguments
339
+ * * `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.
340
+ * * `format` - The format of the ingredient.
341
+ * * `blob` - A [`Blob`] representing an asset which should be included as an ingredient.
342
+ * @param {string} json
343
+ * @param {string} format
344
+ * @param {Blob} blob
345
+ */
346
+ addIngredientFromBlob(json, format, blob) {
347
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
348
+ const len0 = WASM_VECTOR_LEN;
349
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
350
+ const len1 = WASM_VECTOR_LEN;
351
+ const ret = wasm.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr, ptr0, len0, ptr1, len1, blob);
352
+ if (ret[1]) {
353
+ throw takeFromExternrefTable0(ret[0]);
354
+ }
355
+ }
356
+ /**
357
+ * Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
358
+ * @param {string} id
359
+ * @param {Blob} blob
360
+ */
361
+ addResourceFromBlob(id, blob) {
362
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
363
+ const len0 = WASM_VECTOR_LEN;
364
+ const ret = wasm.wasmbuilder_addResourceFromBlob(this.__wbg_ptr, ptr0, len0, blob);
365
+ if (ret[1]) {
366
+ throw takeFromExternrefTable0(ret[0]);
367
+ }
368
+ }
369
+ /**
370
+ * Get the current manifest definition.
371
+ * @returns {string}
372
+ */
373
+ getDefinition() {
374
+ const ret = wasm.wasmbuilder_getDefinition(this.__wbg_ptr);
375
+ if (ret[2]) {
376
+ throw takeFromExternrefTable0(ret[1]);
377
+ }
378
+ return takeFromExternrefTable0(ret[0]);
379
+ }
380
+ /**
381
+ * Sign an asset using the provided SignerDefinition, format, and source Blob.
382
+ * @param {SignerDefinition} signer_definition
383
+ * @param {string} format
384
+ * @param {Blob} source
385
+ * @returns {Promise<Uint8Array>}
386
+ */
387
+ sign(signer_definition, format, source) {
388
+ const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
389
+ const len0 = WASM_VECTOR_LEN;
390
+ const ret = wasm.wasmbuilder_sign(this.__wbg_ptr, signer_definition, ptr0, len0, source);
391
+ return ret;
392
+ }
393
+ }
394
+
242
395
  const WasmReaderFinalization = (typeof FinalizationRegistry === 'undefined')
243
396
  ? { register: () => {}, unregister: () => {} }
244
397
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmreader_free(ptr >>> 0, 1));
@@ -360,6 +513,47 @@ export class WasmReader {
360
513
  }
361
514
  }
362
515
 
516
+ const WasmSignerFinalization = (typeof FinalizationRegistry === 'undefined')
517
+ ? { register: () => {}, unregister: () => {} }
518
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsigner_free(ptr >>> 0, 1));
519
+
520
+ export class WasmSigner {
521
+
522
+ static __wrap(ptr) {
523
+ ptr = ptr >>> 0;
524
+ const obj = Object.create(WasmSigner.prototype);
525
+ obj.__wbg_ptr = ptr;
526
+ WasmSignerFinalization.register(obj, obj.__wbg_ptr, obj);
527
+ return obj;
528
+ }
529
+
530
+ __destroy_into_raw() {
531
+ const ptr = this.__wbg_ptr;
532
+ this.__wbg_ptr = 0;
533
+ WasmSignerFinalization.unregister(this);
534
+ return ptr;
535
+ }
536
+
537
+ free() {
538
+ const ptr = this.__destroy_into_raw();
539
+ wasm.__wbg_wasmsigner_free(ptr, 0);
540
+ }
541
+ /**
542
+ * Attempt to create a new [`WasmSigner`] from a SignerDefinition.
543
+ * @param {SignerDefinition} def
544
+ * @returns {WasmSigner}
545
+ */
546
+ static fromDefinition(def) {
547
+ const ret = wasm.wasmsigner_fromDefinition(def);
548
+ if (ret[2]) {
549
+ throw takeFromExternrefTable0(ret[1]);
550
+ }
551
+ return WasmSigner.__wrap(ret[0]);
552
+ }
553
+ }
554
+
555
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
556
+
363
557
  async function __wbg_load(module, imports) {
364
558
  if (typeof Response === 'function' && module instanceof Response) {
365
559
  if (typeof WebAssembly.instantiateStreaming === 'function') {
@@ -367,7 +561,9 @@ async function __wbg_load(module, imports) {
367
561
  return await WebAssembly.instantiateStreaming(module, imports);
368
562
 
369
563
  } catch (e) {
370
- if (module.headers.get('Content-Type') != 'application/wasm') {
564
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
565
+
566
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
371
567
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
372
568
 
373
569
  } else {
@@ -394,36 +590,40 @@ async function __wbg_load(module, imports) {
394
590
  function __wbg_get_imports() {
395
591
  const imports = {};
396
592
  imports.wbg = {};
397
- imports.wbg.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
398
- arg0.abort(arg1);
593
+ imports.wbg.__wbg_Error_1f3748b298f99708 = function(arg0, arg1) {
594
+ const ret = Error(getStringFromWasm0(arg0, arg1));
595
+ return ret;
596
+ };
597
+ imports.wbg.__wbg_Number_577a493fc95ea223 = function(arg0) {
598
+ const ret = Number(arg0);
599
+ return ret;
399
600
  };
400
- imports.wbg.__wbg_abort_775ef1d17fc65868 = function(arg0) {
601
+ imports.wbg.__wbg_abort_6665281623826052 = function(arg0) {
401
602
  arg0.abort();
402
603
  };
403
- imports.wbg.__wbg_append_8c7dd8d641a5f01b = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
604
+ imports.wbg.__wbg_abort_c11a5d245a242912 = function(arg0, arg1) {
605
+ arg0.abort(arg1);
606
+ };
607
+ imports.wbg.__wbg_append_3e86b0cd6215edd8 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
404
608
  arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
405
609
  }, arguments) };
406
- imports.wbg.__wbg_arrayBuffer_d1b44c4390db422f = function() { return handleError(function (arg0) {
610
+ imports.wbg.__wbg_arrayBuffer_55e4a430671abfd8 = function() { return handleError(function (arg0) {
407
611
  const ret = arg0.arrayBuffer();
408
612
  return ret;
409
613
  }, arguments) };
410
- imports.wbg.__wbg_buffer_09165b52af8c5237 = function(arg0) {
411
- const ret = arg0.buffer;
412
- return ret;
413
- };
414
- imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
614
+ imports.wbg.__wbg_buffer_1f897e9f3ed6b41d = function(arg0) {
415
615
  const ret = arg0.buffer;
416
616
  return ret;
417
617
  };
418
- imports.wbg.__wbg_byteLength_e674b853d9c77e1d = function(arg0) {
618
+ imports.wbg.__wbg_byteLength_7029fecd0c136e6d = function(arg0) {
419
619
  const ret = arg0.byteLength;
420
620
  return ret;
421
621
  };
422
- imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
622
+ imports.wbg.__wbg_call_2f8d426a20a307fe = function() { return handleError(function (arg0, arg1) {
423
623
  const ret = arg0.call(arg1);
424
624
  return ret;
425
625
  }, arguments) };
426
- imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
626
+ imports.wbg.__wbg_call_f53f0647ceb9c567 = function() { return handleError(function (arg0, arg1, arg2) {
427
627
  const ret = arg0.call(arg1, arg2);
428
628
  return ret;
429
629
  }, arguments) };
@@ -431,7 +631,11 @@ function __wbg_get_imports() {
431
631
  const ret = clearTimeout(arg0);
432
632
  return ret;
433
633
  };
434
- imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
634
+ imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
635
+ const ret = arg0.crypto;
636
+ return ret;
637
+ };
638
+ imports.wbg.__wbg_done_4a7743b6f942c9f3 = function(arg0) {
435
639
  const ret = arg0.done;
436
640
  return ret;
437
641
  };
@@ -450,31 +654,47 @@ function __wbg_get_imports() {
450
654
  const ret = fetch(arg0);
451
655
  return ret;
452
656
  };
453
- imports.wbg.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
657
+ imports.wbg.__wbg_fetch_9885d2e26ad251bb = function(arg0, arg1) {
454
658
  const ret = arg0.fetch(arg1);
455
659
  return ret;
456
660
  };
457
- imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
661
+ imports.wbg.__wbg_from_237b1ad767238d8b = function(arg0) {
458
662
  const ret = Array.from(arg0);
459
663
  return ret;
460
664
  };
461
- imports.wbg.__wbg_getTime_46267b1c24877e30 = function(arg0) {
665
+ imports.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7 = function() { return handleError(function (arg0, arg1) {
666
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
667
+ }, arguments) };
668
+ imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
669
+ arg0.getRandomValues(arg1);
670
+ }, arguments) };
671
+ imports.wbg.__wbg_getTime_5b1dd03bb6d4b784 = function(arg0) {
462
672
  const ret = arg0.getTime();
463
673
  return ret;
464
674
  };
465
- imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
675
+ imports.wbg.__wbg_get_27b4bcbec57323ca = function() { return handleError(function (arg0, arg1) {
466
676
  const ret = Reflect.get(arg0, arg1);
467
677
  return ret;
468
678
  }, arguments) };
469
- imports.wbg.__wbg_has_a5ea9117f258a0ec = function() { return handleError(function (arg0, arg1) {
679
+ imports.wbg.__wbg_has_85abdd8aeb8edebf = function() { return handleError(function (arg0, arg1) {
470
680
  const ret = Reflect.has(arg0, arg1);
471
681
  return ret;
472
682
  }, arguments) };
473
- imports.wbg.__wbg_headers_9cb51cfd2ac780a4 = function(arg0) {
683
+ imports.wbg.__wbg_headers_177bc880a5823968 = function(arg0) {
474
684
  const ret = arg0.headers;
475
685
  return ret;
476
686
  };
477
- imports.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function(arg0) {
687
+ imports.wbg.__wbg_instanceof_Promise_1147df2e75727145 = function(arg0) {
688
+ let result;
689
+ try {
690
+ result = arg0 instanceof Promise;
691
+ } catch (_) {
692
+ result = false;
693
+ }
694
+ const ret = result;
695
+ return ret;
696
+ };
697
+ imports.wbg.__wbg_instanceof_Response_0ab386c6818f788a = function(arg0) {
478
698
  let result;
479
699
  try {
480
700
  result = arg0 instanceof Response;
@@ -484,34 +704,62 @@ function __wbg_get_imports() {
484
704
  const ret = result;
485
705
  return ret;
486
706
  };
487
- imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
707
+ imports.wbg.__wbg_iterator_96378c3c9a17347c = function() {
488
708
  const ret = Symbol.iterator;
489
709
  return ret;
490
710
  };
491
- imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
711
+ imports.wbg.__wbg_length_904c0910ed998bf3 = function(arg0) {
492
712
  const ret = arg0.length;
493
713
  return ret;
494
714
  };
495
- imports.wbg.__wbg_new0_f788a2397c7ca929 = function() {
715
+ imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
716
+ const ret = arg0.msCrypto;
717
+ return ret;
718
+ };
719
+ imports.wbg.__wbg_new0_85cc856927102294 = function() {
496
720
  const ret = new Date();
497
721
  return ret;
498
722
  };
499
- imports.wbg.__wbg_new_018dcc2d6c8c2f6a = function() { return handleError(function () {
723
+ imports.wbg.__wbg_new_12588505388d0897 = function() { return handleError(function () {
500
724
  const ret = new Headers();
501
725
  return ret;
502
726
  }, arguments) };
503
- imports.wbg.__wbg_new_16004015965f986e = function() { return handleError(function () {
727
+ imports.wbg.__wbg_new_1930cbb8d9ffc31b = function() {
728
+ const ret = new Object();
729
+ return ret;
730
+ };
731
+ imports.wbg.__wbg_new_56407f99198feff7 = function() {
732
+ const ret = new Map();
733
+ return ret;
734
+ };
735
+ imports.wbg.__wbg_new_6a8b180049d9484e = function() { return handleError(function () {
736
+ const ret = new AbortController();
737
+ return ret;
738
+ }, arguments) };
739
+ imports.wbg.__wbg_new_7e574c906ccc59b1 = function() { return handleError(function () {
504
740
  const ret = new FileReaderSync();
505
741
  return ret;
506
742
  }, arguments) };
507
- imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
743
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
744
+ const ret = new Error();
745
+ return ret;
746
+ };
747
+ imports.wbg.__wbg_new_9190433fb67ed635 = function(arg0) {
748
+ const ret = new Uint8Array(arg0);
749
+ return ret;
750
+ };
751
+ imports.wbg.__wbg_new_97ddeb994a38bb69 = function(arg0, arg1) {
752
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
753
+ return ret;
754
+ };
755
+ imports.wbg.__wbg_new_d5e3800b120e37e1 = function(arg0, arg1) {
508
756
  try {
509
757
  var state0 = {a: arg0, b: arg1};
510
758
  var cb0 = (arg0, arg1) => {
511
759
  const a = state0.a;
512
760
  state0.a = 0;
513
761
  try {
514
- return __wbg_adapter_153(a, state0.b, arg0, arg1);
762
+ return __wbg_adapter_168(a, state0.b, arg0, arg1);
515
763
  } finally {
516
764
  state0.a = a;
517
765
  }
@@ -522,74 +770,68 @@ function __wbg_get_imports() {
522
770
  state0.a = state0.b = 0;
523
771
  }
524
772
  };
525
- imports.wbg.__wbg_new_405e22f390576ce2 = function() {
526
- const ret = new Object();
527
- return ret;
528
- };
529
- imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
530
- const ret = new Map();
531
- return ret;
532
- };
533
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
773
+ imports.wbg.__wbg_new_e969dc3f68d25093 = function() {
534
774
  const ret = new Array();
535
775
  return ret;
536
776
  };
537
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
538
- const ret = new Error();
539
- return ret;
540
- };
541
- imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
542
- const ret = new Uint8Array(arg0);
543
- return ret;
544
- };
545
- imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
546
- const ret = new Error(getStringFromWasm0(arg0, arg1));
777
+ imports.wbg.__wbg_newfromslice_d0d56929c6d9c842 = function(arg0, arg1) {
778
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
547
779
  return ret;
548
780
  };
549
- imports.wbg.__wbg_new_e25e5aab09ff45db = function() { return handleError(function () {
550
- const ret = new AbortController();
551
- return ret;
552
- }, arguments) };
553
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
781
+ imports.wbg.__wbg_newnoargs_a81330f6e05d8aca = function(arg0, arg1) {
554
782
  const ret = new Function(getStringFromWasm0(arg0, arg1));
555
783
  return ret;
556
784
  };
557
- imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
558
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
559
- return ret;
560
- };
561
- imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
785
+ imports.wbg.__wbg_newwithlength_ed0ee6c1edca86fc = function(arg0) {
562
786
  const ret = new Uint8Array(arg0 >>> 0);
563
787
  return ret;
564
788
  };
565
- imports.wbg.__wbg_newwithstrandinit_06c535e0a867c635 = function() { return handleError(function (arg0, arg1, arg2) {
789
+ imports.wbg.__wbg_newwithstrandinit_e8e22e9851f3c2fe = function() { return handleError(function (arg0, arg1, arg2) {
566
790
  const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
567
791
  return ret;
568
792
  }, arguments) };
569
- imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
793
+ imports.wbg.__wbg_next_2e6b37020ac5fe58 = function() { return handleError(function (arg0) {
794
+ const ret = arg0.next();
795
+ return ret;
796
+ }, arguments) };
797
+ imports.wbg.__wbg_next_3de8f2669431a3ff = function(arg0) {
570
798
  const ret = arg0.next;
571
799
  return ret;
572
800
  };
573
- imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
574
- const ret = arg0.next();
801
+ imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
802
+ const ret = arg0.node;
575
803
  return ret;
576
- }, arguments) };
577
- imports.wbg.__wbg_now_807e54c39636c349 = function() {
804
+ };
805
+ imports.wbg.__wbg_now_e3057dd824ca0191 = function() {
578
806
  const ret = Date.now();
579
807
  return ret;
580
808
  };
581
- imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
582
- queueMicrotask(arg0);
809
+ imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
810
+ const ret = arg0.process;
811
+ return ret;
583
812
  };
584
- imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
813
+ imports.wbg.__wbg_prototypesetcall_c5f74efd31aea86b = function(arg0, arg1, arg2) {
814
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
815
+ };
816
+ imports.wbg.__wbg_queueMicrotask_bcc6e26d899696db = function(arg0) {
585
817
  const ret = arg0.queueMicrotask;
586
818
  return ret;
587
819
  };
588
- imports.wbg.__wbg_readAsArrayBuffer_560aeb9fce36c5c8 = function() { return handleError(function (arg0, arg1) {
820
+ imports.wbg.__wbg_queueMicrotask_f24a794d09c42640 = function(arg0) {
821
+ queueMicrotask(arg0);
822
+ };
823
+ imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
824
+ arg0.randomFillSync(arg1);
825
+ }, arguments) };
826
+ imports.wbg.__wbg_readAsArrayBuffer_b45cdda102d3c0b2 = function() { return handleError(function (arg0, arg1) {
589
827
  const ret = arg0.readAsArrayBuffer(arg1);
590
828
  return ret;
591
829
  }, arguments) };
592
- imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
830
+ imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
831
+ const ret = module.require;
832
+ return ret;
833
+ }, arguments) };
834
+ imports.wbg.__wbg_resolve_5775c0ef9222f556 = function(arg0) {
593
835
  const ret = Promise.resolve(arg0);
594
836
  return ret;
595
837
  };
@@ -597,46 +839,46 @@ function __wbg_get_imports() {
597
839
  const ret = setTimeout(arg0, arg1);
598
840
  return ret;
599
841
  };
600
- imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
601
- arg0[arg1 >>> 0] = arg2;
842
+ imports.wbg.__wbg_set_1d5fe1e3f51a48d8 = function(arg0, arg1, arg2) {
843
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
844
+ };
845
+ imports.wbg.__wbg_set_31197016f65a6a19 = function(arg0, arg1, arg2) {
846
+ const ret = arg0.set(arg1, arg2);
847
+ return ret;
602
848
  };
603
849
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
604
850
  arg0[arg1] = arg2;
605
851
  };
606
- imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
607
- arg0.set(arg1, arg2 >>> 0);
608
- };
609
- imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
610
- const ret = arg0.set(arg1, arg2);
611
- return ret;
852
+ imports.wbg.__wbg_set_d636a0463acf1dbc = function(arg0, arg1, arg2) {
853
+ arg0[arg1 >>> 0] = arg2;
612
854
  };
613
- imports.wbg.__wbg_setbody_5923b78a95eedf29 = function(arg0, arg1) {
855
+ imports.wbg.__wbg_setbody_e324371c31597f2a = function(arg0, arg1) {
614
856
  arg0.body = arg1;
615
857
  };
616
- imports.wbg.__wbg_setcredentials_c3a22f1cd105a2c6 = function(arg0, arg1) {
858
+ imports.wbg.__wbg_setcredentials_55a9317ed2777533 = function(arg0, arg1) {
617
859
  arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
618
860
  };
619
- imports.wbg.__wbg_setheaders_834c0bdb6a8949ad = function(arg0, arg1) {
861
+ imports.wbg.__wbg_setheaders_ac0b1e4890a949cd = function(arg0, arg1) {
620
862
  arg0.headers = arg1;
621
863
  };
622
- imports.wbg.__wbg_setmethod_3c5280fe5d890842 = function(arg0, arg1, arg2) {
864
+ imports.wbg.__wbg_setmethod_9ce6e95af1ae0eaf = function(arg0, arg1, arg2) {
623
865
  arg0.method = getStringFromWasm0(arg1, arg2);
624
866
  };
625
- imports.wbg.__wbg_setmode_5dc300b865044b65 = function(arg0, arg1) {
867
+ imports.wbg.__wbg_setmode_b89d1784e7e7f118 = function(arg0, arg1) {
626
868
  arg0.mode = __wbindgen_enum_RequestMode[arg1];
627
869
  };
628
- imports.wbg.__wbg_setsignal_75b21ef3a81de905 = function(arg0, arg1) {
870
+ imports.wbg.__wbg_setsignal_e663c6d962763cd5 = function(arg0, arg1) {
629
871
  arg0.signal = arg1;
630
872
  };
631
- imports.wbg.__wbg_signal_aaf9ad74119f20a4 = function(arg0) {
873
+ imports.wbg.__wbg_signal_bdb003fe19e53a13 = function(arg0) {
632
874
  const ret = arg0.signal;
633
875
  return ret;
634
876
  };
635
- imports.wbg.__wbg_size_3808d41635a9c259 = function(arg0) {
877
+ imports.wbg.__wbg_size_4181b899cbfa6483 = function(arg0) {
636
878
  const ret = arg0.size;
637
879
  return ret;
638
880
  };
639
- imports.wbg.__wbg_slice_bd4c84b64bdfe01f = function() { return handleError(function (arg0, arg1, arg2) {
881
+ imports.wbg.__wbg_slice_dc41c7f2c4886814 = function() { return handleError(function (arg0, arg1, arg2) {
640
882
  const ret = arg0.slice(arg1, arg2);
641
883
  return ret;
642
884
  }, arguments) };
@@ -647,66 +889,66 @@ function __wbg_get_imports() {
647
889
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
648
890
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
649
891
  };
650
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
892
+ imports.wbg.__wbg_static_accessor_GLOBAL_1f13249cc3acc96d = function() {
651
893
  const ret = typeof global === 'undefined' ? null : global;
652
894
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
653
895
  };
654
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
896
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_df7ae94b1e0ed6a3 = function() {
655
897
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
656
898
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
657
899
  };
658
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
900
+ imports.wbg.__wbg_static_accessor_SELF_6265471db3b3c228 = function() {
659
901
  const ret = typeof self === 'undefined' ? null : self;
660
902
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
661
903
  };
662
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
904
+ imports.wbg.__wbg_static_accessor_WINDOW_16fb482f8ec52863 = function() {
663
905
  const ret = typeof window === 'undefined' ? null : window;
664
906
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
665
907
  };
666
- imports.wbg.__wbg_status_f6360336ca686bf0 = function(arg0) {
908
+ imports.wbg.__wbg_status_31874648c8651949 = function(arg0) {
667
909
  const ret = arg0.status;
668
910
  return ret;
669
911
  };
670
- imports.wbg.__wbg_stringify_f7ed6987935b4a24 = function() { return handleError(function (arg0) {
912
+ imports.wbg.__wbg_stringify_1f41b6198e0932e0 = function() { return handleError(function (arg0) {
671
913
  const ret = JSON.stringify(arg0);
672
914
  return ret;
673
915
  }, arguments) };
674
- imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
675
- const ret = arg0.then(arg1);
916
+ imports.wbg.__wbg_subarray_a219824899e59712 = function(arg0, arg1, arg2) {
917
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
676
918
  return ret;
677
919
  };
678
- imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
920
+ imports.wbg.__wbg_then_8d2fcccde5380a03 = function(arg0, arg1, arg2) {
679
921
  const ret = arg0.then(arg1, arg2);
680
922
  return ret;
681
923
  };
682
- imports.wbg.__wbg_url_ae10c34ca209681d = function(arg0, arg1) {
924
+ imports.wbg.__wbg_then_9cc266be2bf537b6 = function(arg0, arg1) {
925
+ const ret = arg0.then(arg1);
926
+ return ret;
927
+ };
928
+ imports.wbg.__wbg_url_d5273b9e10503471 = function(arg0, arg1) {
683
929
  const ret = arg1.url;
684
930
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
685
931
  const len1 = WASM_VECTOR_LEN;
686
932
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
687
933
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
688
934
  };
689
- imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
690
- const ret = arg0.value;
935
+ imports.wbg.__wbg_valueOf_94f1c9efbe2ba399 = function(arg0) {
936
+ const ret = arg0.valueOf();
691
937
  return ret;
692
938
  };
693
- imports.wbg.__wbg_wasmreader_new = function(arg0) {
694
- const ret = WasmReader.__wrap(arg0);
939
+ imports.wbg.__wbg_value_09d0b4eaab48b91d = function(arg0) {
940
+ const ret = arg0.value;
695
941
  return ret;
696
942
  };
697
- imports.wbg.__wbindgen_as_number = function(arg0) {
698
- const ret = +arg0;
943
+ imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
944
+ const ret = arg0.versions;
699
945
  return ret;
700
946
  };
701
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
702
- const ret = arg0;
703
- return ret;
704
- };
705
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
706
- const ret = BigInt.asUintN(64, arg0);
947
+ imports.wbg.__wbg_wasmreader_new = function(arg0) {
948
+ const ret = WasmReader.__wrap(arg0);
707
949
  return ret;
708
950
  };
709
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
951
+ imports.wbg.__wbg_wbindgencbdrop_a85ed476c6a370b9 = function(arg0) {
710
952
  const obj = arg0.original;
711
953
  if (obj.cnt-- == 1) {
712
954
  obj.a = 0;
@@ -715,61 +957,31 @@ function __wbg_get_imports() {
715
957
  const ret = false;
716
958
  return ret;
717
959
  };
718
- imports.wbg.__wbindgen_closure_wrapper10863 = function(arg0, arg1, arg2) {
719
- const ret = makeMutClosure(arg0, arg1, 1444, __wbg_adapter_38);
720
- return ret;
721
- };
722
- imports.wbg.__wbindgen_closure_wrapper10914 = function(arg0, arg1, arg2) {
723
- const ret = makeMutClosure(arg0, arg1, 1462, __wbg_adapter_41);
724
- return ret;
725
- };
726
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
960
+ imports.wbg.__wbg_wbindgendebugstring_bb652b1bc2061b6d = function(arg0, arg1) {
727
961
  const ret = debugString(arg1);
728
962
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
729
963
  const len1 = WASM_VECTOR_LEN;
730
964
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
731
965
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
732
966
  };
733
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
734
- const ret = new Error(getStringFromWasm0(arg0, arg1));
735
- return ret;
736
- };
737
- imports.wbg.__wbindgen_init_externref_table = function() {
738
- const table = wasm.__wbindgen_export_2;
739
- const offset = table.grow(4);
740
- table.set(0, undefined);
741
- table.set(offset + 0, undefined);
742
- table.set(offset + 1, null);
743
- table.set(offset + 2, true);
744
- table.set(offset + 3, false);
745
- ;
746
- };
747
- imports.wbg.__wbindgen_is_function = function(arg0) {
967
+ imports.wbg.__wbg_wbindgenisfunction_ea72b9d66a0e1705 = function(arg0) {
748
968
  const ret = typeof(arg0) === 'function';
749
969
  return ret;
750
970
  };
751
- imports.wbg.__wbindgen_is_object = function(arg0) {
971
+ imports.wbg.__wbg_wbindgenisobject_dfe064a121d87553 = function(arg0) {
752
972
  const val = arg0;
753
973
  const ret = typeof(val) === 'object' && val !== null;
754
974
  return ret;
755
975
  };
756
- imports.wbg.__wbindgen_is_string = function(arg0) {
976
+ imports.wbg.__wbg_wbindgenisstring_4b74e4111ba029e6 = function(arg0) {
757
977
  const ret = typeof(arg0) === 'string';
758
978
  return ret;
759
979
  };
760
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
980
+ imports.wbg.__wbg_wbindgenisundefined_71f08a6ade4354e7 = function(arg0) {
761
981
  const ret = arg0 === undefined;
762
982
  return ret;
763
983
  };
764
- imports.wbg.__wbindgen_memory = function() {
765
- const ret = wasm.memory;
766
- return ret;
767
- };
768
- imports.wbg.__wbindgen_number_new = function(arg0) {
769
- const ret = arg0;
770
- return ret;
771
- };
772
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
984
+ imports.wbg.__wbg_wbindgenstringget_43fe05afe34b0cb1 = function(arg0, arg1) {
773
985
  const obj = arg1;
774
986
  const ret = typeof(obj) === 'string' ? obj : undefined;
775
987
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -777,12 +989,65 @@ function __wbg_get_imports() {
777
989
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
778
990
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
779
991
  };
780
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
992
+ imports.wbg.__wbg_wbindgenthrow_4c11a24fca429ccf = function(arg0, arg1) {
993
+ throw new Error(getStringFromWasm0(arg0, arg1));
994
+ };
995
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
996
+ // Cast intrinsic for `Ref(String) -> Externref`.
781
997
  const ret = getStringFromWasm0(arg0, arg1);
782
998
  return ret;
783
999
  };
784
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
785
- throw new Error(getStringFromWasm0(arg0, arg1));
1000
+ imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
1001
+ // Cast intrinsic for `I128 -> Externref`.
1002
+ const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
1003
+ return ret;
1004
+ };
1005
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1006
+ // Cast intrinsic for `U64 -> Externref`.
1007
+ const ret = BigInt.asUintN(64, arg0);
1008
+ return ret;
1009
+ };
1010
+ imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
1011
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1012
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
1013
+ // Cast intrinsic for `Vector(U8) -> Externref`.
1014
+ const ret = v0;
1015
+ return ret;
1016
+ };
1017
+ imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1018
+ // Cast intrinsic for `I64 -> Externref`.
1019
+ const ret = arg0;
1020
+ return ret;
1021
+ };
1022
+ imports.wbg.__wbindgen_cast_cb60167f8bf6c33f = function(arg0, arg1) {
1023
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1658, function: Function { arguments: [Externref], shim_idx: 1669, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1024
+ const ret = makeMutClosure(arg0, arg1, 1658, __wbg_adapter_6);
1025
+ return ret;
1026
+ };
1027
+ imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1028
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1029
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1030
+ return ret;
1031
+ };
1032
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1033
+ // Cast intrinsic for `F64 -> Externref`.
1034
+ const ret = arg0;
1035
+ return ret;
1036
+ };
1037
+ imports.wbg.__wbindgen_cast_e943630f8c22ccf7 = function(arg0, arg1) {
1038
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1651, function: Function { arguments: [], shim_idx: 1652, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1039
+ const ret = makeMutClosure(arg0, arg1, 1651, __wbg_adapter_11);
1040
+ return ret;
1041
+ };
1042
+ imports.wbg.__wbindgen_init_externref_table = function() {
1043
+ const table = wasm.__wbindgen_export_2;
1044
+ const offset = table.grow(4);
1045
+ table.set(0, undefined);
1046
+ table.set(offset + 0, undefined);
1047
+ table.set(offset + 1, null);
1048
+ table.set(offset + 2, true);
1049
+ table.set(offset + 3, false);
1050
+ ;
786
1051
  };
787
1052
 
788
1053
  return imports;
@@ -856,4 +1121,4 @@ async function __wbg_init(module_or_path) {
856
1121
 
857
1122
  export { initSync };
858
1123
  export default __wbg_init;
859
- export const WASM_SRI = "sha512-2Xw4vi1zAuw6ShG+SsG+eJO/jyxat4s8pPK+OcnW963sRFiQXxjHzNcDdbpcNVYrbOO2qgk5FF0osaiBCVi7Ow==";
1124
+ export const WASM_SRI = "sha512-HdKAUgRgZE3U8ifKMx2wLpjRjuv/9EoZGIbO3E+N3F/O3JDS3qIz243yU+v5pJXfNyxvi4rzQ0dD509pA2KaUw==";
package/pkg/c2pa_bg.wasm CHANGED
Binary file
@@ -1,6 +1,19 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_wasmbuilder_free: (a: number, b: number) => void;
5
+ export const wasmbuilder_fromJson: (a: number, b: number) => [number, number, number];
6
+ export const wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
7
+ export const wasmbuilder_setNoEmbed: (a: number, b: number) => void;
8
+ export const wasmbuilder_setThumbnailFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
9
+ export const wasmbuilder_addIngredientFromBlob: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number];
10
+ export const wasmbuilder_addResourceFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
11
+ export const wasmbuilder_getDefinition: (a: number) => [number, number, number];
12
+ export const wasmbuilder_sign: (a: number, b: any, c: number, d: number, e: any) => any;
13
+ export const loadSettings: (a: number, b: number) => [number, number];
14
+ export const __wbg_wasmsigner_free: (a: number, b: number) => void;
15
+ export const wasmsigner_fromDefinition: (a: any) => [number, number, number];
16
+ export const run: () => void;
4
17
  export const __wbg_wasmreader_free: (a: number, b: number) => void;
5
18
  export const wasmreader_fromBlob: (a: number, b: number, c: any) => any;
6
19
  export const wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any) => any;
@@ -9,8 +22,6 @@ export const wasmreader_manifestStore: (a: number) => [number, number, number];
9
22
  export const wasmreader_activeManifest: (a: number) => [number, number, number];
10
23
  export const wasmreader_json: (a: number) => [number, number];
11
24
  export const wasmreader_resourceToBuffer: (a: number, b: number, c: number) => [number, number, number];
12
- export const loadSettings: (a: number, b: number) => [number, number];
13
- export const run: () => void;
14
25
  export const ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
15
26
  export const __wbindgen_exn_store: (a: number) => void;
16
27
  export const __externref_table_alloc: () => number;
@@ -20,7 +31,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
20
31
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
21
32
  export const __wbindgen_export_6: WebAssembly.Table;
22
33
  export const __externref_table_dealloc: (a: number) => void;
23
- export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf8e9222f46d15a02: (a: number, b: number) => void;
24
- export const closure1461_externref_shim: (a: number, b: number, c: any) => void;
25
- export const closure2453_externref_shim: (a: number, b: number, c: any, d: any) => void;
34
+ export const closure1669_externref_shim: (a: number, b: number, c: any) => void;
35
+ export const wasm_bindgen__convert__closures_____invoke__h09e04d5375df482d: (a: number, b: number) => void;
36
+ export const closure2615_externref_shim: (a: number, b: number, c: any, d: any) => void;
26
37
  export const __wbindgen_start: () => void;