@contentauth/c2pa-wasm 0.15.0 → 0.15.2
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 +35 -0
- package/package.json +1 -1
- package/pkg/c2pa.d.ts +45 -3
- package/pkg/c2pa.js +128 -12
- package/pkg/c2pa_bg.wasm +0 -0
- package/pkg/c2pa_bg.wasm.d.ts +10 -3
package/README.md
CHANGED
|
@@ -8,6 +8,41 @@ The WebAssembly wrapper for [`c2pa-rs`](https://github.com/contentauth/c2pa-rs)
|
|
|
8
8
|
npm install @contentauth/c2pa-wasm
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Reusing settings contexts
|
|
12
|
+
|
|
13
|
+
Direct WASM callers can create `new WasmContext(settingsJson)` once, then pass the
|
|
14
|
+
owned, WASM-instance-local handle to `WasmReader.fromBlobWithContext`,
|
|
15
|
+
`WasmReader.fromBlobFragmentWithContext`, `WasmBuilder.newWithContext`,
|
|
16
|
+
`WasmBuilder.fromJsonWithContext`, or `WasmBuilder.fromArchiveWithContext`.
|
|
17
|
+
These constructors do not transfer settings JSON into WASM again.
|
|
18
|
+
|
|
19
|
+
There is no global WASM context registry or implicit cache. The caller owns the
|
|
20
|
+
handle and must call `context.free()` when it is no longer needed, just as with
|
|
21
|
+
Readers and Builders. Each constructor takes its own native shared reference;
|
|
22
|
+
freeing the handle does not invalidate existing objects or pending Reader
|
|
23
|
+
Promises. Native settings are released when the last owner is freed. Each
|
|
24
|
+
Reader and Builder retains independent manifest state.
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
const context = new WasmContext(settingsJson);
|
|
28
|
+
const pendingReader = WasmReader.fromBlobWithContext(
|
|
29
|
+
'image/jpeg',
|
|
30
|
+
blob,
|
|
31
|
+
context
|
|
32
|
+
);
|
|
33
|
+
const builder = WasmBuilder.newWithContext(context);
|
|
34
|
+
context.free(); // Safe even before pendingReader settles.
|
|
35
|
+
const reader = await pendingReader;
|
|
36
|
+
// Use reader and builder, then free each when finished.
|
|
37
|
+
reader.free();
|
|
38
|
+
builder.free();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`c2pa-web` owns a bounded cache of these handles inside each worker and frees them
|
|
42
|
+
on eviction. Direct WASM callers choose their own handle lifetimes. All existing
|
|
43
|
+
JSON-based constructors, including `fromBytes`, remain supported; those entry
|
|
44
|
+
points parse their supplied settings per call rather than retaining them globally.
|
|
45
|
+
|
|
11
46
|
## Development
|
|
12
47
|
|
|
13
48
|
### Prerequisites
|
package/package.json
CHANGED
package/pkg/c2pa.d.ts
CHANGED
|
@@ -114,11 +114,19 @@ export class WasmBuilder {
|
|
|
114
114
|
* See [`Self::filter_actions_at`] for why this takes indices rather than a predicate.
|
|
115
115
|
*/
|
|
116
116
|
filterIngredientsAt(indices: Uint32Array): void;
|
|
117
|
+
/**
|
|
118
|
+
* Creates a builder from an archive sharing the handle's settings.
|
|
119
|
+
*/
|
|
120
|
+
static fromArchiveWithContext(archive: Blob, context: WasmContext): WasmBuilder;
|
|
117
121
|
/**
|
|
118
122
|
* Attempts to create a new `WasmBuilder` from a builder archive.
|
|
119
123
|
* Optionally accepts a context JSON string to configure the builder.
|
|
120
124
|
*/
|
|
121
125
|
static fromArchive(archive: Blob, context_json?: string | null): WasmBuilder;
|
|
126
|
+
/**
|
|
127
|
+
* Creates a builder from manifest JSON sharing the handle's settings.
|
|
128
|
+
*/
|
|
129
|
+
static fromJsonWithContext(json: string, context: WasmContext): WasmBuilder;
|
|
122
130
|
/**
|
|
123
131
|
* Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
|
|
124
132
|
* Optionally accepts a context JSON string to configure the builder.
|
|
@@ -128,6 +136,10 @@ export class WasmBuilder {
|
|
|
128
136
|
* Get the current manifest definition.
|
|
129
137
|
*/
|
|
130
138
|
getDefinition(): string;
|
|
139
|
+
/**
|
|
140
|
+
* Creates a builder sharing the handle's settings, with independent manifest state.
|
|
141
|
+
*/
|
|
142
|
+
static newWithContext(context: WasmContext): WasmBuilder;
|
|
131
143
|
/**
|
|
132
144
|
* Creates a new `WasmBuilder` with a minimal manifest definition.
|
|
133
145
|
* Optionally accepts a context JSON string to configure the builder.
|
|
@@ -206,6 +218,19 @@ export class WasmBuilder {
|
|
|
206
218
|
updateManifestProperty(property: string, value: any): void;
|
|
207
219
|
}
|
|
208
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Owns resolved settings for reuse within a WASM instance.
|
|
223
|
+
* Freeing the handle releases its ownership, not that of existing Readers or Builders.
|
|
224
|
+
*/
|
|
225
|
+
export class WasmContext {
|
|
226
|
+
free(): void;
|
|
227
|
+
[Symbol.dispose](): void;
|
|
228
|
+
/**
|
|
229
|
+
* Parses settings once. Omit the JSON argument to use default settings.
|
|
230
|
+
*/
|
|
231
|
+
constructor(context_json?: string | null);
|
|
232
|
+
}
|
|
233
|
+
|
|
209
234
|
/**
|
|
210
235
|
* Wraps a `c2pa::Reader`.
|
|
211
236
|
*/
|
|
@@ -225,11 +250,21 @@ export class WasmReader {
|
|
|
225
250
|
* Returns the asset's manifest store as crJSON.
|
|
226
251
|
*/
|
|
227
252
|
crJson(): string;
|
|
253
|
+
/**
|
|
254
|
+
* Creates a fragment reader sharing the handle's settings.
|
|
255
|
+
* The handle can be freed immediately, even while the returned Promise is pending.
|
|
256
|
+
*/
|
|
257
|
+
static fromBlobFragmentWithContext(format: string, init: Blob, fragment: Blob, context: WasmContext): Promise<WasmReader>;
|
|
228
258
|
/**
|
|
229
259
|
* Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
|
|
230
260
|
* Optionally accepts a context JSON string to configure the reader.
|
|
231
261
|
*/
|
|
232
262
|
static fromBlobFragment(format: string, init: Blob, fragment: Blob, context_json?: string | null): Promise<WasmReader>;
|
|
263
|
+
/**
|
|
264
|
+
* Creates a reader sharing the handle's settings.
|
|
265
|
+
* The handle can be freed immediately, even while the returned Promise is pending.
|
|
266
|
+
*/
|
|
267
|
+
static fromBlobWithContext(format: string, blob: Blob, context: WasmContext): Promise<WasmReader>;
|
|
233
268
|
/**
|
|
234
269
|
* Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
|
|
235
270
|
* Optionally accepts a context JSON string to configure the reader.
|
|
@@ -285,6 +320,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
285
320
|
export interface InitOutput {
|
|
286
321
|
readonly memory: WebAssembly.Memory;
|
|
287
322
|
readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
|
|
323
|
+
readonly __wbg_wasmcontext_free: (a: number, b: number) => void;
|
|
288
324
|
readonly __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
289
325
|
readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
|
|
290
326
|
readonly encodeSignerPayload: (a: any) => [number, number, number, number];
|
|
@@ -299,9 +335,12 @@ export interface InitOutput {
|
|
|
299
335
|
readonly wasmbuilder_filterActionsAt: (a: number, b: number, c: number) => [number, number];
|
|
300
336
|
readonly wasmbuilder_filterIngredientsAt: (a: number, b: number, c: number) => [number, number];
|
|
301
337
|
readonly wasmbuilder_fromArchive: (a: any, b: number, c: number) => [number, number, number];
|
|
338
|
+
readonly wasmbuilder_fromArchiveWithContext: (a: any, b: number) => [number, number, number];
|
|
302
339
|
readonly wasmbuilder_fromJson: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
340
|
+
readonly wasmbuilder_fromJsonWithContext: (a: number, b: number, c: number) => [number, number, number];
|
|
303
341
|
readonly wasmbuilder_getDefinition: (a: number) => [number, number, number];
|
|
304
342
|
readonly wasmbuilder_new: (a: number, b: number) => [number, number, number];
|
|
343
|
+
readonly wasmbuilder_newWithContext: (a: number) => [number, number, number];
|
|
305
344
|
readonly wasmbuilder_setIntent: (a: number, b: any) => [number, number];
|
|
306
345
|
readonly wasmbuilder_setNoEmbed: (a: number, b: number) => void;
|
|
307
346
|
readonly wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
|
|
@@ -312,19 +351,22 @@ export interface InitOutput {
|
|
|
312
351
|
readonly wasmbuilder_updateActionsAt: (a: number, b: any) => [number, number];
|
|
313
352
|
readonly wasmbuilder_updateAssertionsAt: (a: number, b: number, c: number, d: any) => [number, number];
|
|
314
353
|
readonly wasmbuilder_updateManifestProperty: (a: number, b: number, c: number, d: any) => [number, number];
|
|
354
|
+
readonly wasmcontext_new: (a: number, b: number) => [number, number, number];
|
|
315
355
|
readonly wasmreader_activeLabel: (a: number) => [number, number];
|
|
316
356
|
readonly wasmreader_activeManifest: (a: number) => [number, number, number];
|
|
317
357
|
readonly wasmreader_crJson: (a: number) => [number, number];
|
|
318
358
|
readonly wasmreader_fromBlob: (a: number, b: number, c: any, d: number, e: number) => any;
|
|
319
359
|
readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any, e: number, f: number) => any;
|
|
360
|
+
readonly wasmreader_fromBlobFragmentWithContext: (a: number, b: number, c: any, d: any, e: number) => any;
|
|
361
|
+
readonly wasmreader_fromBlobWithContext: (a: number, b: number, c: any, d: number) => any;
|
|
320
362
|
readonly wasmreader_fromBytes: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
321
363
|
readonly wasmreader_json: (a: number) => [number, number];
|
|
322
364
|
readonly wasmreader_manifestStore: (a: number) => [number, number, number];
|
|
323
365
|
readonly wasmreader_resourceToBytes: (a: number, b: number, c: number) => [number, number, number];
|
|
324
366
|
readonly wasmsigner_fromDefinition: (a: any) => [number, number, number];
|
|
325
|
-
readonly
|
|
326
|
-
readonly
|
|
327
|
-
readonly
|
|
367
|
+
readonly wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
368
|
+
readonly wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___wasm_bindgen_cb414c02e4f83cd6___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_cb414c02e4f83cd6___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
369
|
+
readonly wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
328
370
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
329
371
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
330
372
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/pkg/c2pa.js
CHANGED
|
@@ -171,6 +171,20 @@ export class WasmBuilder {
|
|
|
171
171
|
throw takeFromExternrefTable0(ret[0]);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Creates a builder from an archive sharing the handle's settings.
|
|
176
|
+
* @param {Blob} archive
|
|
177
|
+
* @param {WasmContext} context
|
|
178
|
+
* @returns {WasmBuilder}
|
|
179
|
+
*/
|
|
180
|
+
static fromArchiveWithContext(archive, context) {
|
|
181
|
+
_assertClass(context, WasmContext);
|
|
182
|
+
const ret = wasm.wasmbuilder_fromArchiveWithContext(archive, context.__wbg_ptr);
|
|
183
|
+
if (ret[2]) {
|
|
184
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
185
|
+
}
|
|
186
|
+
return WasmBuilder.__wrap(ret[0]);
|
|
187
|
+
}
|
|
174
188
|
/**
|
|
175
189
|
* Attempts to create a new `WasmBuilder` from a builder archive.
|
|
176
190
|
* Optionally accepts a context JSON string to configure the builder.
|
|
@@ -187,6 +201,22 @@ export class WasmBuilder {
|
|
|
187
201
|
}
|
|
188
202
|
return WasmBuilder.__wrap(ret[0]);
|
|
189
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Creates a builder from manifest JSON sharing the handle's settings.
|
|
206
|
+
* @param {string} json
|
|
207
|
+
* @param {WasmContext} context
|
|
208
|
+
* @returns {WasmBuilder}
|
|
209
|
+
*/
|
|
210
|
+
static fromJsonWithContext(json, context) {
|
|
211
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
212
|
+
const len0 = WASM_VECTOR_LEN;
|
|
213
|
+
_assertClass(context, WasmContext);
|
|
214
|
+
const ret = wasm.wasmbuilder_fromJsonWithContext(ptr0, len0, context.__wbg_ptr);
|
|
215
|
+
if (ret[2]) {
|
|
216
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
217
|
+
}
|
|
218
|
+
return WasmBuilder.__wrap(ret[0]);
|
|
219
|
+
}
|
|
190
220
|
/**
|
|
191
221
|
* Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
|
|
192
222
|
* Optionally accepts a context JSON string to configure the builder.
|
|
@@ -216,6 +246,19 @@ export class WasmBuilder {
|
|
|
216
246
|
}
|
|
217
247
|
return takeFromExternrefTable0(ret[0]);
|
|
218
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Creates a builder sharing the handle's settings, with independent manifest state.
|
|
251
|
+
* @param {WasmContext} context
|
|
252
|
+
* @returns {WasmBuilder}
|
|
253
|
+
*/
|
|
254
|
+
static newWithContext(context) {
|
|
255
|
+
_assertClass(context, WasmContext);
|
|
256
|
+
const ret = wasm.wasmbuilder_newWithContext(context.__wbg_ptr);
|
|
257
|
+
if (ret[2]) {
|
|
258
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
259
|
+
}
|
|
260
|
+
return WasmBuilder.__wrap(ret[0]);
|
|
261
|
+
}
|
|
219
262
|
/**
|
|
220
263
|
* Creates a new `WasmBuilder` with a minimal manifest definition.
|
|
221
264
|
* Optionally accepts a context JSON string to configure the builder.
|
|
@@ -379,6 +422,39 @@ export class WasmBuilder {
|
|
|
379
422
|
}
|
|
380
423
|
if (Symbol.dispose) WasmBuilder.prototype[Symbol.dispose] = WasmBuilder.prototype.free;
|
|
381
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Owns resolved settings for reuse within a WASM instance.
|
|
427
|
+
* Freeing the handle releases its ownership, not that of existing Readers or Builders.
|
|
428
|
+
*/
|
|
429
|
+
export class WasmContext {
|
|
430
|
+
__destroy_into_raw() {
|
|
431
|
+
const ptr = this.__wbg_ptr;
|
|
432
|
+
this.__wbg_ptr = 0;
|
|
433
|
+
WasmContextFinalization.unregister(this);
|
|
434
|
+
return ptr;
|
|
435
|
+
}
|
|
436
|
+
free() {
|
|
437
|
+
const ptr = this.__destroy_into_raw();
|
|
438
|
+
wasm.__wbg_wasmcontext_free(ptr, 0);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Parses settings once. Omit the JSON argument to use default settings.
|
|
442
|
+
* @param {string | null} [context_json]
|
|
443
|
+
*/
|
|
444
|
+
constructor(context_json) {
|
|
445
|
+
var ptr0 = isLikeNone(context_json) ? 0 : passStringToWasm0(context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
446
|
+
var len0 = WASM_VECTOR_LEN;
|
|
447
|
+
const ret = wasm.wasmcontext_new(ptr0, len0);
|
|
448
|
+
if (ret[2]) {
|
|
449
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
450
|
+
}
|
|
451
|
+
this.__wbg_ptr = ret[0];
|
|
452
|
+
WasmContextFinalization.register(this, this.__wbg_ptr, this);
|
|
453
|
+
return this;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (Symbol.dispose) WasmContext.prototype[Symbol.dispose] = WasmContext.prototype.free;
|
|
457
|
+
|
|
382
458
|
/**
|
|
383
459
|
* Wraps a `c2pa::Reader`.
|
|
384
460
|
*/
|
|
@@ -439,6 +515,22 @@ export class WasmReader {
|
|
|
439
515
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
440
516
|
}
|
|
441
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Creates a fragment reader sharing the handle's settings.
|
|
520
|
+
* The handle can be freed immediately, even while the returned Promise is pending.
|
|
521
|
+
* @param {string} format
|
|
522
|
+
* @param {Blob} init
|
|
523
|
+
* @param {Blob} fragment
|
|
524
|
+
* @param {WasmContext} context
|
|
525
|
+
* @returns {Promise<WasmReader>}
|
|
526
|
+
*/
|
|
527
|
+
static fromBlobFragmentWithContext(format, init, fragment, context) {
|
|
528
|
+
const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
529
|
+
const len0 = WASM_VECTOR_LEN;
|
|
530
|
+
_assertClass(context, WasmContext);
|
|
531
|
+
const ret = wasm.wasmreader_fromBlobFragmentWithContext(ptr0, len0, init, fragment, context.__wbg_ptr);
|
|
532
|
+
return ret;
|
|
533
|
+
}
|
|
442
534
|
/**
|
|
443
535
|
* Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
|
|
444
536
|
* Optionally accepts a context JSON string to configure the reader.
|
|
@@ -456,6 +548,21 @@ export class WasmReader {
|
|
|
456
548
|
const ret = wasm.wasmreader_fromBlobFragment(ptr0, len0, init, fragment, ptr1, len1);
|
|
457
549
|
return ret;
|
|
458
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Creates a reader sharing the handle's settings.
|
|
553
|
+
* The handle can be freed immediately, even while the returned Promise is pending.
|
|
554
|
+
* @param {string} format
|
|
555
|
+
* @param {Blob} blob
|
|
556
|
+
* @param {WasmContext} context
|
|
557
|
+
* @returns {Promise<WasmReader>}
|
|
558
|
+
*/
|
|
559
|
+
static fromBlobWithContext(format, blob, context) {
|
|
560
|
+
const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
561
|
+
const len0 = WASM_VECTOR_LEN;
|
|
562
|
+
_assertClass(context, WasmContext);
|
|
563
|
+
const ret = wasm.wasmreader_fromBlobWithContext(ptr0, len0, blob, context.__wbg_ptr);
|
|
564
|
+
return ret;
|
|
565
|
+
}
|
|
459
566
|
/**
|
|
460
567
|
* Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
|
|
461
568
|
* Optionally accepts a context JSON string to configure the reader.
|
|
@@ -915,7 +1022,7 @@ function __wbg_get_imports() {
|
|
|
915
1022
|
const a = state0.a;
|
|
916
1023
|
state0.a = 0;
|
|
917
1024
|
try {
|
|
918
|
-
return
|
|
1025
|
+
return wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
919
1026
|
} finally {
|
|
920
1027
|
state0.a = a;
|
|
921
1028
|
}
|
|
@@ -1104,13 +1211,13 @@ function __wbg_get_imports() {
|
|
|
1104
1211
|
return ret;
|
|
1105
1212
|
},
|
|
1106
1213
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1107
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1108
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1214
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3395, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1215
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___wasm_bindgen_cb414c02e4f83cd6___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_cb414c02e4f83cd6___JsError___true_);
|
|
1109
1216
|
return ret;
|
|
1110
1217
|
},
|
|
1111
1218
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
1112
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1113
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1219
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2085, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1220
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke_______true_);
|
|
1114
1221
|
return ret;
|
|
1115
1222
|
},
|
|
1116
1223
|
__wbindgen_generic_0000000000000003: function(arg0) {
|
|
@@ -1161,19 +1268,19 @@ function __wbg_get_imports() {
|
|
|
1161
1268
|
};
|
|
1162
1269
|
}
|
|
1163
1270
|
|
|
1164
|
-
function
|
|
1165
|
-
wasm.
|
|
1271
|
+
function wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke_______true_(arg0, arg1) {
|
|
1272
|
+
wasm.wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke_______true_(arg0, arg1);
|
|
1166
1273
|
}
|
|
1167
1274
|
|
|
1168
|
-
function
|
|
1169
|
-
const ret = wasm.
|
|
1275
|
+
function wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___wasm_bindgen_cb414c02e4f83cd6___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_cb414c02e4f83cd6___JsError___true_(arg0, arg1, arg2) {
|
|
1276
|
+
const ret = wasm.wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___wasm_bindgen_cb414c02e4f83cd6___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_cb414c02e4f83cd6___JsError___true_(arg0, arg1, arg2);
|
|
1170
1277
|
if (ret[1]) {
|
|
1171
1278
|
throw takeFromExternrefTable0(ret[0]);
|
|
1172
1279
|
}
|
|
1173
1280
|
}
|
|
1174
1281
|
|
|
1175
|
-
function
|
|
1176
|
-
wasm.
|
|
1282
|
+
function wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
|
|
1283
|
+
wasm.wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
1177
1284
|
}
|
|
1178
1285
|
|
|
1179
1286
|
|
|
@@ -1187,6 +1294,9 @@ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate
|
|
|
1187
1294
|
const WasmBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1188
1295
|
? { register: () => {}, unregister: () => {} }
|
|
1189
1296
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmbuilder_free(ptr, 1));
|
|
1297
|
+
const WasmContextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1298
|
+
? { register: () => {}, unregister: () => {} }
|
|
1299
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmcontext_free(ptr, 1));
|
|
1190
1300
|
const WasmReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1191
1301
|
? { register: () => {}, unregister: () => {} }
|
|
1192
1302
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmreader_free(ptr, 1));
|
|
@@ -1200,6 +1310,12 @@ function addToExternrefTable0(obj) {
|
|
|
1200
1310
|
return idx;
|
|
1201
1311
|
}
|
|
1202
1312
|
|
|
1313
|
+
function _assertClass(instance, klass) {
|
|
1314
|
+
if (!(instance instanceof klass)) {
|
|
1315
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1203
1319
|
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1204
1320
|
? { register: () => {}, unregister: () => {} }
|
|
1205
1321
|
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
@@ -1525,4 +1641,4 @@ async function __wbg_init(module_or_path) {
|
|
|
1525
1641
|
}
|
|
1526
1642
|
|
|
1527
1643
|
export { initSync, __wbg_init as default };
|
|
1528
|
-
export const WASM_SRI = "sha512-
|
|
1644
|
+
export const WASM_SRI = "sha512-rYCAbTh83gL8zLqFNrMVGdp0gqWWZ3yYNyxORyqfRIg9M7vMk+xjFGLlVNFaZvzg1Ce1x87yejuoWHAh+fGsUw==";
|
package/pkg/c2pa_bg.wasm
CHANGED
|
Binary file
|
package/pkg/c2pa_bg.wasm.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_wasmbuilder_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmcontext_free: (a: number, b: number) => void;
|
|
5
6
|
export const __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
6
7
|
export const __wbg_wasmsigner_free: (a: number, b: number) => void;
|
|
7
8
|
export const encodeSignerPayload: (a: any) => [number, number, number, number];
|
|
@@ -16,9 +17,12 @@ export const wasmbuilder_filterActionsAndIngredientsAt: (a: number, b: number, c
|
|
|
16
17
|
export const wasmbuilder_filterActionsAt: (a: number, b: number, c: number) => [number, number];
|
|
17
18
|
export const wasmbuilder_filterIngredientsAt: (a: number, b: number, c: number) => [number, number];
|
|
18
19
|
export const wasmbuilder_fromArchive: (a: any, b: number, c: number) => [number, number, number];
|
|
20
|
+
export const wasmbuilder_fromArchiveWithContext: (a: any, b: number) => [number, number, number];
|
|
19
21
|
export const wasmbuilder_fromJson: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
22
|
+
export const wasmbuilder_fromJsonWithContext: (a: number, b: number, c: number) => [number, number, number];
|
|
20
23
|
export const wasmbuilder_getDefinition: (a: number) => [number, number, number];
|
|
21
24
|
export const wasmbuilder_new: (a: number, b: number) => [number, number, number];
|
|
25
|
+
export const wasmbuilder_newWithContext: (a: number) => [number, number, number];
|
|
22
26
|
export const wasmbuilder_setIntent: (a: number, b: any) => [number, number];
|
|
23
27
|
export const wasmbuilder_setNoEmbed: (a: number, b: number) => void;
|
|
24
28
|
export const wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
|
|
@@ -29,19 +33,22 @@ export const wasmbuilder_toArchive: (a: number) => [number, number, number];
|
|
|
29
33
|
export const wasmbuilder_updateActionsAt: (a: number, b: any) => [number, number];
|
|
30
34
|
export const wasmbuilder_updateAssertionsAt: (a: number, b: number, c: number, d: any) => [number, number];
|
|
31
35
|
export const wasmbuilder_updateManifestProperty: (a: number, b: number, c: number, d: any) => [number, number];
|
|
36
|
+
export const wasmcontext_new: (a: number, b: number) => [number, number, number];
|
|
32
37
|
export const wasmreader_activeLabel: (a: number) => [number, number];
|
|
33
38
|
export const wasmreader_activeManifest: (a: number) => [number, number, number];
|
|
34
39
|
export const wasmreader_crJson: (a: number) => [number, number];
|
|
35
40
|
export const wasmreader_fromBlob: (a: number, b: number, c: any, d: number, e: number) => any;
|
|
36
41
|
export const wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any, e: number, f: number) => any;
|
|
42
|
+
export const wasmreader_fromBlobFragmentWithContext: (a: number, b: number, c: any, d: any, e: number) => any;
|
|
43
|
+
export const wasmreader_fromBlobWithContext: (a: number, b: number, c: any, d: number) => any;
|
|
37
44
|
export const wasmreader_fromBytes: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
38
45
|
export const wasmreader_json: (a: number) => [number, number];
|
|
39
46
|
export const wasmreader_manifestStore: (a: number) => [number, number, number];
|
|
40
47
|
export const wasmreader_resourceToBytes: (a: number, b: number, c: number) => [number, number, number];
|
|
41
48
|
export const wasmsigner_fromDefinition: (a: any) => [number, number, number];
|
|
42
|
-
export const
|
|
43
|
-
export const
|
|
44
|
-
export const
|
|
49
|
+
export const wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined___js_sys_1746cd361478c686___Function_fn_wasm_bindgen_cb414c02e4f83cd6___JsValue_____wasm_bindgen_cb414c02e4f83cd6___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
50
|
+
export const wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke___wasm_bindgen_cb414c02e4f83cd6___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_cb414c02e4f83cd6___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
51
|
+
export const wasm_bindgen_cb414c02e4f83cd6___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
45
52
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
46
53
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
47
54
|
export const __wbindgen_exn_store: (a: number) => void;
|