@contentauth/c2pa-wasm 0.10.0 → 0.11.1
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/package.json +1 -1
- package/pkg/c2pa.d.ts +17 -0
- package/pkg/c2pa.js +38 -3
- package/pkg/c2pa_bg.wasm +0 -0
- package/pkg/c2pa_bg.wasm.d.ts +2 -0
package/package.json
CHANGED
package/pkg/c2pa.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export class WasmBuilder {
|
|
|
20
20
|
* Add an action to the manifest's `Actions` assertion.
|
|
21
21
|
*/
|
|
22
22
|
addAction(action: any): void;
|
|
23
|
+
/**
|
|
24
|
+
* Add an assertion to the manifest under `label` with the given `data`.
|
|
25
|
+
*/
|
|
26
|
+
addAssertion(label: string, data: any): void;
|
|
23
27
|
/**
|
|
24
28
|
* Add an ingredient to the manifest from a JSON ingredient definition without a blob
|
|
25
29
|
*
|
|
@@ -47,6 +51,17 @@ export class WasmBuilder {
|
|
|
47
51
|
* Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
|
|
48
52
|
*/
|
|
49
53
|
addResourceFromBlob(id: string, blob: Blob): void;
|
|
54
|
+
/**
|
|
55
|
+
* Retains actions and ingredients together in one step, per
|
|
56
|
+
* `Builder::filter_actions_and_ingredients`. `action_indices`/`ingredient_indices` are
|
|
57
|
+
* 0-based indices into [`Self::get_definition`]'s `c2pa.actions` assertion / `ingredients`
|
|
58
|
+
* array, resolved on the JS side for the same reason as [`Self::filter_actions_at`].
|
|
59
|
+
*
|
|
60
|
+
* `rescue_ingredient` (driven by `ingredient_indices`) is evaluated for every ingredient
|
|
61
|
+
* first; any action referencing an ingredient it would rescue is force-kept regardless of
|
|
62
|
+
* `keep_action`.
|
|
63
|
+
*/
|
|
64
|
+
filterActionsAndIngredientsAt(action_indices: Uint32Array, ingredient_indices: Uint32Array): void;
|
|
50
65
|
/**
|
|
51
66
|
* Retains only the actions at the given 0-based indices into the actions currently returned
|
|
52
67
|
* by [`Self::get_definition`]'s `c2pa.actions` assertion.
|
|
@@ -206,10 +221,12 @@ export interface InitOutput {
|
|
|
206
221
|
readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
|
|
207
222
|
readonly __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
208
223
|
readonly wasmbuilder_addAction: (a: number, b: any) => [number, number];
|
|
224
|
+
readonly wasmbuilder_addAssertion: (a: number, b: number, c: number, d: any) => [number, number];
|
|
209
225
|
readonly wasmbuilder_addIngredient: (a: number, b: number, c: number) => [number, number];
|
|
210
226
|
readonly wasmbuilder_addIngredientFromBlob: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
211
227
|
readonly wasmbuilder_addRedaction: (a: number, b: number, c: number, d: any) => [number, number];
|
|
212
228
|
readonly wasmbuilder_addResourceFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
|
|
229
|
+
readonly wasmbuilder_filterActionsAndIngredientsAt: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
213
230
|
readonly wasmbuilder_filterActionsAt: (a: number, b: number, c: number) => [number, number];
|
|
214
231
|
readonly wasmbuilder_filterIngredientsAt: (a: number, b: number, c: number) => [number, number];
|
|
215
232
|
readonly wasmbuilder_fromArchive: (a: any, b: number, c: number) => [number, number, number];
|
package/pkg/c2pa.js
CHANGED
|
@@ -30,6 +30,19 @@ export class WasmBuilder {
|
|
|
30
30
|
throw takeFromExternrefTable0(ret[0]);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Add an assertion to the manifest under `label` with the given `data`.
|
|
35
|
+
* @param {string} label
|
|
36
|
+
* @param {any} data
|
|
37
|
+
*/
|
|
38
|
+
addAssertion(label, data) {
|
|
39
|
+
const ptr0 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
40
|
+
const len0 = WASM_VECTOR_LEN;
|
|
41
|
+
const ret = wasm.wasmbuilder_addAssertion(this.__wbg_ptr, ptr0, len0, data);
|
|
42
|
+
if (ret[1]) {
|
|
43
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
33
46
|
/**
|
|
34
47
|
* Add an ingredient to the manifest from a JSON ingredient definition without a blob
|
|
35
48
|
*
|
|
@@ -94,6 +107,28 @@ export class WasmBuilder {
|
|
|
94
107
|
throw takeFromExternrefTable0(ret[0]);
|
|
95
108
|
}
|
|
96
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Retains actions and ingredients together in one step, per
|
|
112
|
+
* `Builder::filter_actions_and_ingredients`. `action_indices`/`ingredient_indices` are
|
|
113
|
+
* 0-based indices into [`Self::get_definition`]'s `c2pa.actions` assertion / `ingredients`
|
|
114
|
+
* array, resolved on the JS side for the same reason as [`Self::filter_actions_at`].
|
|
115
|
+
*
|
|
116
|
+
* `rescue_ingredient` (driven by `ingredient_indices`) is evaluated for every ingredient
|
|
117
|
+
* first; any action referencing an ingredient it would rescue is force-kept regardless of
|
|
118
|
+
* `keep_action`.
|
|
119
|
+
* @param {Uint32Array} action_indices
|
|
120
|
+
* @param {Uint32Array} ingredient_indices
|
|
121
|
+
*/
|
|
122
|
+
filterActionsAndIngredientsAt(action_indices, ingredient_indices) {
|
|
123
|
+
const ptr0 = passArray32ToWasm0(action_indices, wasm.__wbindgen_malloc);
|
|
124
|
+
const len0 = WASM_VECTOR_LEN;
|
|
125
|
+
const ptr1 = passArray32ToWasm0(ingredient_indices, wasm.__wbindgen_malloc);
|
|
126
|
+
const len1 = WASM_VECTOR_LEN;
|
|
127
|
+
const ret = wasm.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
128
|
+
if (ret[1]) {
|
|
129
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
97
132
|
/**
|
|
98
133
|
* Retains only the actions at the given 0-based indices into the actions currently returned
|
|
99
134
|
* by [`Self::get_definition`]'s `c2pa.actions` assertion.
|
|
@@ -965,12 +1000,12 @@ function __wbg_get_imports() {
|
|
|
965
1000
|
return ret;
|
|
966
1001
|
},
|
|
967
1002
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
968
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1003
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3101, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
969
1004
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke___wasm_bindgen_304c265eb9e6f0af___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_304c265eb9e6f0af___JsError___true_);
|
|
970
1005
|
return ret;
|
|
971
1006
|
},
|
|
972
1007
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
973
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1008
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1859, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
974
1009
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke_______true_);
|
|
975
1010
|
return ret;
|
|
976
1011
|
},
|
|
@@ -1375,4 +1410,4 @@ async function __wbg_init(module_or_path) {
|
|
|
1375
1410
|
}
|
|
1376
1411
|
|
|
1377
1412
|
export { initSync, __wbg_init as default };
|
|
1378
|
-
export const WASM_SRI = "sha512
|
|
1413
|
+
export const WASM_SRI = "sha512-+BnfUs0JjFsZpaZrWl5iHedhKgzGXsqF2E5aGIqCUn3jwdAw0VCqidVaSZoVD56LIfGUkxdBDJmXEa+U5m5FgA==";
|
package/pkg/c2pa_bg.wasm
CHANGED
|
Binary file
|
package/pkg/c2pa_bg.wasm.d.ts
CHANGED
|
@@ -8,10 +8,12 @@ export const run: () => void;
|
|
|
8
8
|
export const __wbg_wasmbuilder_free: (a: number, b: number) => void;
|
|
9
9
|
export const __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
10
10
|
export const wasmbuilder_addAction: (a: number, b: any) => [number, number];
|
|
11
|
+
export const wasmbuilder_addAssertion: (a: number, b: number, c: number, d: any) => [number, number];
|
|
11
12
|
export const wasmbuilder_addIngredient: (a: number, b: number, c: number) => [number, number];
|
|
12
13
|
export const wasmbuilder_addIngredientFromBlob: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
13
14
|
export const wasmbuilder_addRedaction: (a: number, b: number, c: number, d: any) => [number, number];
|
|
14
15
|
export const wasmbuilder_addResourceFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
|
|
16
|
+
export const wasmbuilder_filterActionsAndIngredientsAt: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
15
17
|
export const wasmbuilder_filterActionsAt: (a: number, b: number, c: number) => [number, number];
|
|
16
18
|
export const wasmbuilder_filterIngredientsAt: (a: number, b: number, c: number) => [number, number];
|
|
17
19
|
export const wasmbuilder_fromArchive: (a: any, b: number, c: number) => [number, number, number];
|