@contentauth/c2pa-wasm 0.1.1 → 0.2.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/LICENSE +21 -0
- package/package.json +2 -1
- package/pkg/c2pa.d.ts +22 -10
- package/pkg/c2pa.js +103 -25
- package/pkg/c2pa_bg.wasm +0 -0
- package/pkg/c2pa_bg.wasm.d.ts +8 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
package/pkg/c2pa.d.ts
CHANGED
|
@@ -22,14 +22,24 @@ export class WasmReader {
|
|
|
22
22
|
* Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
|
|
23
23
|
*/
|
|
24
24
|
static fromBlobFragment(format: string, init: Blob, fragment: Blob): Promise<WasmReader>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a JSON representation of the asset's manifest store.
|
|
27
|
-
*/
|
|
28
|
-
json(): string;
|
|
29
25
|
/**
|
|
30
26
|
* Returns the label of the asset's active manifest.
|
|
31
27
|
*/
|
|
32
28
|
activeLabel(): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the asset's manifest store.
|
|
31
|
+
* NOTE: at the moment, CAWG data is not decoded via this function. Use WasmReader::json() if CAWG is a requirement.
|
|
32
|
+
*/
|
|
33
|
+
manifestStore(): any;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the asset's active manifest.
|
|
36
|
+
* NOTE: at the moment, CAWG data is not decoded via this function. Use WasmReader::json() if CAWG is a requirement.
|
|
37
|
+
*/
|
|
38
|
+
activeManifest(): any;
|
|
39
|
+
/**
|
|
40
|
+
* Returns a JSON representation of the asset's manifest store.
|
|
41
|
+
*/
|
|
42
|
+
json(): string;
|
|
33
43
|
/**
|
|
34
44
|
* Accepts a URI reference to a binary object in the resource store and returns a `js_sys::ArrayBuffer` containing the resource's bytes.
|
|
35
45
|
*/
|
|
@@ -40,14 +50,16 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
40
50
|
|
|
41
51
|
export interface InitOutput {
|
|
42
52
|
readonly memory: WebAssembly.Memory;
|
|
43
|
-
readonly loadSettings: (a: number, b: number) => [number, number];
|
|
44
|
-
readonly run: () => void;
|
|
45
53
|
readonly __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
46
54
|
readonly wasmreader_fromBlob: (a: number, b: number, c: any) => any;
|
|
47
55
|
readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any) => any;
|
|
48
|
-
readonly wasmreader_json: (a: number) => [number, number];
|
|
49
56
|
readonly wasmreader_activeLabel: (a: number) => [number, number];
|
|
57
|
+
readonly wasmreader_manifestStore: (a: number) => [number, number, number];
|
|
58
|
+
readonly wasmreader_activeManifest: (a: number) => [number, number, number];
|
|
59
|
+
readonly wasmreader_json: (a: number) => [number, number];
|
|
50
60
|
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;
|
|
51
63
|
readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
52
64
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
53
65
|
readonly __externref_table_alloc: () => number;
|
|
@@ -57,9 +69,9 @@ export interface InitOutput {
|
|
|
57
69
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
58
70
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
59
71
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
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;
|
|
63
75
|
readonly __wbindgen_start: () => void;
|
|
64
76
|
}
|
|
65
77
|
|
package/pkg/c2pa.js
CHANGED
|
@@ -223,16 +223,16 @@ export function run() {
|
|
|
223
223
|
wasm.run();
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
function
|
|
227
|
-
wasm.
|
|
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);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
function
|
|
231
|
-
wasm.
|
|
230
|
+
function __wbg_adapter_41(arg0, arg1, arg2) {
|
|
231
|
+
wasm.closure1461_externref_shim(arg0, arg1, arg2);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
function
|
|
235
|
-
wasm.
|
|
234
|
+
function __wbg_adapter_153(arg0, arg1, arg2, arg3) {
|
|
235
|
+
wasm.closure2453_externref_shim(arg0, arg1, arg2, arg3);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -291,6 +291,43 @@ export class WasmReader {
|
|
|
291
291
|
const ret = wasm.wasmreader_fromBlobFragment(ptr0, len0, init, fragment);
|
|
292
292
|
return ret;
|
|
293
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Returns the label of the asset's active manifest.
|
|
296
|
+
* @returns {string | undefined}
|
|
297
|
+
*/
|
|
298
|
+
activeLabel() {
|
|
299
|
+
const ret = wasm.wasmreader_activeLabel(this.__wbg_ptr);
|
|
300
|
+
let v1;
|
|
301
|
+
if (ret[0] !== 0) {
|
|
302
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
303
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
304
|
+
}
|
|
305
|
+
return v1;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Returns the asset's manifest store.
|
|
309
|
+
* NOTE: at the moment, CAWG data is not decoded via this function. Use WasmReader::json() if CAWG is a requirement.
|
|
310
|
+
* @returns {any}
|
|
311
|
+
*/
|
|
312
|
+
manifestStore() {
|
|
313
|
+
const ret = wasm.wasmreader_manifestStore(this.__wbg_ptr);
|
|
314
|
+
if (ret[2]) {
|
|
315
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
316
|
+
}
|
|
317
|
+
return takeFromExternrefTable0(ret[0]);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Returns the asset's active manifest.
|
|
321
|
+
* NOTE: at the moment, CAWG data is not decoded via this function. Use WasmReader::json() if CAWG is a requirement.
|
|
322
|
+
* @returns {any}
|
|
323
|
+
*/
|
|
324
|
+
activeManifest() {
|
|
325
|
+
const ret = wasm.wasmreader_activeManifest(this.__wbg_ptr);
|
|
326
|
+
if (ret[2]) {
|
|
327
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
328
|
+
}
|
|
329
|
+
return takeFromExternrefTable0(ret[0]);
|
|
330
|
+
}
|
|
294
331
|
/**
|
|
295
332
|
* Returns a JSON representation of the asset's manifest store.
|
|
296
333
|
* @returns {string}
|
|
@@ -307,19 +344,6 @@ export class WasmReader {
|
|
|
307
344
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
308
345
|
}
|
|
309
346
|
}
|
|
310
|
-
/**
|
|
311
|
-
* Returns the label of the asset's active manifest.
|
|
312
|
-
* @returns {string | undefined}
|
|
313
|
-
*/
|
|
314
|
-
activeLabel() {
|
|
315
|
-
const ret = wasm.wasmreader_activeLabel(this.__wbg_ptr);
|
|
316
|
-
let v1;
|
|
317
|
-
if (ret[0] !== 0) {
|
|
318
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
319
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
320
|
-
}
|
|
321
|
-
return v1;
|
|
322
|
-
}
|
|
323
347
|
/**
|
|
324
348
|
* Accepts a URI reference to a binary object in the resource store and returns a `js_sys::ArrayBuffer` containing the resource's bytes.
|
|
325
349
|
* @param {string} uri
|
|
@@ -430,6 +454,14 @@ function __wbg_get_imports() {
|
|
|
430
454
|
const ret = arg0.fetch(arg1);
|
|
431
455
|
return ret;
|
|
432
456
|
};
|
|
457
|
+
imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
|
|
458
|
+
const ret = Array.from(arg0);
|
|
459
|
+
return ret;
|
|
460
|
+
};
|
|
461
|
+
imports.wbg.__wbg_getTime_46267b1c24877e30 = function(arg0) {
|
|
462
|
+
const ret = arg0.getTime();
|
|
463
|
+
return ret;
|
|
464
|
+
};
|
|
433
465
|
imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
|
|
434
466
|
const ret = Reflect.get(arg0, arg1);
|
|
435
467
|
return ret;
|
|
@@ -460,6 +492,10 @@ function __wbg_get_imports() {
|
|
|
460
492
|
const ret = arg0.length;
|
|
461
493
|
return ret;
|
|
462
494
|
};
|
|
495
|
+
imports.wbg.__wbg_new0_f788a2397c7ca929 = function() {
|
|
496
|
+
const ret = new Date();
|
|
497
|
+
return ret;
|
|
498
|
+
};
|
|
463
499
|
imports.wbg.__wbg_new_018dcc2d6c8c2f6a = function() { return handleError(function () {
|
|
464
500
|
const ret = new Headers();
|
|
465
501
|
return ret;
|
|
@@ -475,7 +511,7 @@ function __wbg_get_imports() {
|
|
|
475
511
|
const a = state0.a;
|
|
476
512
|
state0.a = 0;
|
|
477
513
|
try {
|
|
478
|
-
return
|
|
514
|
+
return __wbg_adapter_153(a, state0.b, arg0, arg1);
|
|
479
515
|
} finally {
|
|
480
516
|
state0.a = a;
|
|
481
517
|
}
|
|
@@ -490,6 +526,14 @@ function __wbg_get_imports() {
|
|
|
490
526
|
const ret = new Object();
|
|
491
527
|
return ret;
|
|
492
528
|
};
|
|
529
|
+
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
530
|
+
const ret = new Map();
|
|
531
|
+
return ret;
|
|
532
|
+
};
|
|
533
|
+
imports.wbg.__wbg_new_78feb108b6472713 = function() {
|
|
534
|
+
const ret = new Array();
|
|
535
|
+
return ret;
|
|
536
|
+
};
|
|
493
537
|
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
494
538
|
const ret = new Error();
|
|
495
539
|
return ret;
|
|
@@ -553,9 +597,19 @@ function __wbg_get_imports() {
|
|
|
553
597
|
const ret = setTimeout(arg0, arg1);
|
|
554
598
|
return ret;
|
|
555
599
|
};
|
|
600
|
+
imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
601
|
+
arg0[arg1 >>> 0] = arg2;
|
|
602
|
+
};
|
|
603
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
604
|
+
arg0[arg1] = arg2;
|
|
605
|
+
};
|
|
556
606
|
imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
|
|
557
607
|
arg0.set(arg1, arg2 >>> 0);
|
|
558
608
|
};
|
|
609
|
+
imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
|
|
610
|
+
const ret = arg0.set(arg1, arg2);
|
|
611
|
+
return ret;
|
|
612
|
+
};
|
|
559
613
|
imports.wbg.__wbg_setbody_5923b78a95eedf29 = function(arg0, arg1) {
|
|
560
614
|
arg0.body = arg1;
|
|
561
615
|
};
|
|
@@ -640,6 +694,18 @@ function __wbg_get_imports() {
|
|
|
640
694
|
const ret = WasmReader.__wrap(arg0);
|
|
641
695
|
return ret;
|
|
642
696
|
};
|
|
697
|
+
imports.wbg.__wbindgen_as_number = function(arg0) {
|
|
698
|
+
const ret = +arg0;
|
|
699
|
+
return ret;
|
|
700
|
+
};
|
|
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);
|
|
707
|
+
return ret;
|
|
708
|
+
};
|
|
643
709
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
644
710
|
const obj = arg0.original;
|
|
645
711
|
if (obj.cnt-- == 1) {
|
|
@@ -649,12 +715,12 @@ function __wbg_get_imports() {
|
|
|
649
715
|
const ret = false;
|
|
650
716
|
return ret;
|
|
651
717
|
};
|
|
652
|
-
imports.wbg.
|
|
653
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
718
|
+
imports.wbg.__wbindgen_closure_wrapper10863 = function(arg0, arg1, arg2) {
|
|
719
|
+
const ret = makeMutClosure(arg0, arg1, 1444, __wbg_adapter_38);
|
|
654
720
|
return ret;
|
|
655
721
|
};
|
|
656
|
-
imports.wbg.
|
|
657
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
722
|
+
imports.wbg.__wbindgen_closure_wrapper10914 = function(arg0, arg1, arg2) {
|
|
723
|
+
const ret = makeMutClosure(arg0, arg1, 1462, __wbg_adapter_41);
|
|
658
724
|
return ret;
|
|
659
725
|
};
|
|
660
726
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
@@ -664,6 +730,10 @@ function __wbg_get_imports() {
|
|
|
664
730
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
665
731
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
666
732
|
};
|
|
733
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
734
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
735
|
+
return ret;
|
|
736
|
+
};
|
|
667
737
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
668
738
|
const table = wasm.__wbindgen_export_2;
|
|
669
739
|
const offset = table.grow(4);
|
|
@@ -683,6 +753,10 @@ function __wbg_get_imports() {
|
|
|
683
753
|
const ret = typeof(val) === 'object' && val !== null;
|
|
684
754
|
return ret;
|
|
685
755
|
};
|
|
756
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
757
|
+
const ret = typeof(arg0) === 'string';
|
|
758
|
+
return ret;
|
|
759
|
+
};
|
|
686
760
|
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
687
761
|
const ret = arg0 === undefined;
|
|
688
762
|
return ret;
|
|
@@ -691,6 +765,10 @@ function __wbg_get_imports() {
|
|
|
691
765
|
const ret = wasm.memory;
|
|
692
766
|
return ret;
|
|
693
767
|
};
|
|
768
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
769
|
+
const ret = arg0;
|
|
770
|
+
return ret;
|
|
771
|
+
};
|
|
694
772
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
695
773
|
const obj = arg1;
|
|
696
774
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -778,4 +856,4 @@ async function __wbg_init(module_or_path) {
|
|
|
778
856
|
|
|
779
857
|
export { initSync };
|
|
780
858
|
export default __wbg_init;
|
|
781
|
-
export const WASM_SRI = "sha512-
|
|
859
|
+
export const WASM_SRI = "sha512-2Xw4vi1zAuw6ShG+SsG+eJO/jyxat4s8pPK+OcnW963sRFiQXxjHzNcDdbpcNVYrbOO2qgk5FF0osaiBCVi7Ow==";
|
package/pkg/c2pa_bg.wasm
CHANGED
|
Binary file
|
package/pkg/c2pa_bg.wasm.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const loadSettings: (a: number, b: number) => [number, number];
|
|
5
|
-
export const run: () => void;
|
|
6
4
|
export const __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
7
5
|
export const wasmreader_fromBlob: (a: number, b: number, c: any) => any;
|
|
8
6
|
export const wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any) => any;
|
|
9
|
-
export const wasmreader_json: (a: number) => [number, number];
|
|
10
7
|
export const wasmreader_activeLabel: (a: number) => [number, number];
|
|
8
|
+
export const wasmreader_manifestStore: (a: number) => [number, number, number];
|
|
9
|
+
export const wasmreader_activeManifest: (a: number) => [number, number, number];
|
|
10
|
+
export const wasmreader_json: (a: number) => [number, number];
|
|
11
11
|
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;
|
|
12
14
|
export const ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
13
15
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
14
16
|
export const __externref_table_alloc: () => number;
|
|
@@ -18,7 +20,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
18
20
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
19
21
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
20
22
|
export const __externref_table_dealloc: (a: number) => void;
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
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;
|
|
24
26
|
export const __wbindgen_start: () => void;
|