@contentauth/c2pa-wasm 0.13.4 → 0.14.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 +1 -1
- package/package.json +1 -1
- package/pkg/c2pa.d.ts +13 -0
- package/pkg/c2pa.js +31 -3
- package/pkg/c2pa_bg.wasm +0 -0
- package/pkg/c2pa_bg.wasm.d.ts +2 -0
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Ensure the repo-wide prerequisites are installed:
|
|
|
18
18
|
- [Nx](https://nx.dev/getting-started/intro)
|
|
19
19
|
- [pnpm](https://pnpm.io/)
|
|
20
20
|
|
|
21
|
-
See the [
|
|
21
|
+
See the [contributor prerequisites](https://github.com/contentauth/c2pa-js/blob/main/docs/project-contributions.md#prerequisites) for details.
|
|
22
22
|
|
|
23
23
|
Then, install all of the following prerequisites:
|
|
24
24
|
|
package/package.json
CHANGED
package/pkg/c2pa.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ interface SignerPayload {
|
|
|
13
13
|
roles: string[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
type SignerPayloadInput = Omit<SignerPayload, 'roles'> & { roles?: string[] };
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
interface IdentityAssertionDefinition {
|
|
@@ -198,6 +200,10 @@ export class WasmBuilder {
|
|
|
198
200
|
* The label, kind, created flag, and assertion position remain unchanged.
|
|
199
201
|
*/
|
|
200
202
|
updateAssertionsAt(label: string, data: any): void;
|
|
203
|
+
/**
|
|
204
|
+
* Updates a (known) property in the manifest definition.
|
|
205
|
+
*/
|
|
206
|
+
updateManifestProperty(property: string, value: any): void;
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
/**
|
|
@@ -264,6 +270,11 @@ export class WasmSigner {
|
|
|
264
270
|
static fromDefinition(def: SignerDefinition): WasmSigner;
|
|
265
271
|
}
|
|
266
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Encode a camelCase JavaScript SignerPayload as canonical CAWG CBOR.
|
|
275
|
+
*/
|
|
276
|
+
export function encodeSignerPayload(payload: SignerPayloadInput): Uint8Array;
|
|
277
|
+
|
|
267
278
|
/**
|
|
268
279
|
* Called when the WASM binary is initialized.
|
|
269
280
|
*/
|
|
@@ -276,6 +287,7 @@ export interface InitOutput {
|
|
|
276
287
|
readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
|
|
277
288
|
readonly __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
278
289
|
readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
|
|
290
|
+
readonly encodeSignerPayload: (a: any) => [number, number, number, number];
|
|
279
291
|
readonly run: () => void;
|
|
280
292
|
readonly wasmbuilder_addAction: (a: number, b: any) => [number, number];
|
|
281
293
|
readonly wasmbuilder_addAssertion: (a: number, b: number, c: number, d: any) => [number, number];
|
|
@@ -299,6 +311,7 @@ export interface InitOutput {
|
|
|
299
311
|
readonly wasmbuilder_toArchive: (a: number) => [number, number, number];
|
|
300
312
|
readonly wasmbuilder_updateActionsAt: (a: number, b: any) => [number, number];
|
|
301
313
|
readonly wasmbuilder_updateAssertionsAt: (a: number, b: number, c: number, d: any) => [number, number];
|
|
314
|
+
readonly wasmbuilder_updateManifestProperty: (a: number, b: number, c: number, d: any) => [number, number];
|
|
302
315
|
readonly wasmreader_activeLabel: (a: number) => [number, number];
|
|
303
316
|
readonly wasmreader_activeManifest: (a: number) => [number, number, number];
|
|
304
317
|
readonly wasmreader_crJson: (a: number) => [number, number];
|
package/pkg/c2pa.js
CHANGED
|
@@ -363,6 +363,19 @@ export class WasmBuilder {
|
|
|
363
363
|
throw takeFromExternrefTable0(ret[0]);
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Updates a (known) property in the manifest definition.
|
|
368
|
+
* @param {string} property
|
|
369
|
+
* @param {any} value
|
|
370
|
+
*/
|
|
371
|
+
updateManifestProperty(property, value) {
|
|
372
|
+
const ptr0 = passStringToWasm0(property, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
373
|
+
const len0 = WASM_VECTOR_LEN;
|
|
374
|
+
const ret = wasm.wasmbuilder_updateManifestProperty(this.__wbg_ptr, ptr0, len0, value);
|
|
375
|
+
if (ret[1]) {
|
|
376
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
366
379
|
}
|
|
367
380
|
if (Symbol.dispose) WasmBuilder.prototype[Symbol.dispose] = WasmBuilder.prototype.free;
|
|
368
381
|
|
|
@@ -559,6 +572,21 @@ export class WasmSigner {
|
|
|
559
572
|
}
|
|
560
573
|
if (Symbol.dispose) WasmSigner.prototype[Symbol.dispose] = WasmSigner.prototype.free;
|
|
561
574
|
|
|
575
|
+
/**
|
|
576
|
+
* Encode a camelCase JavaScript SignerPayload as canonical CAWG CBOR.
|
|
577
|
+
* @param {SignerPayloadInput} payload
|
|
578
|
+
* @returns {Uint8Array}
|
|
579
|
+
*/
|
|
580
|
+
export function encodeSignerPayload(payload) {
|
|
581
|
+
const ret = wasm.encodeSignerPayload(payload);
|
|
582
|
+
if (ret[3]) {
|
|
583
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
584
|
+
}
|
|
585
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
586
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
587
|
+
return v1;
|
|
588
|
+
}
|
|
589
|
+
|
|
562
590
|
/**
|
|
563
591
|
* Called when the WASM binary is initialized.
|
|
564
592
|
*/
|
|
@@ -1068,12 +1096,12 @@ function __wbg_get_imports() {
|
|
|
1068
1096
|
return ret;
|
|
1069
1097
|
},
|
|
1070
1098
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1071
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1099
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3296, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1072
1100
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_255200e6d97c625a___convert__closures_____invoke___wasm_bindgen_255200e6d97c625a___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_255200e6d97c625a___JsError___true_);
|
|
1073
1101
|
return ret;
|
|
1074
1102
|
},
|
|
1075
1103
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
1076
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1104
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1986, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1077
1105
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_255200e6d97c625a___convert__closures_____invoke_______true_);
|
|
1078
1106
|
return ret;
|
|
1079
1107
|
},
|
|
@@ -1489,4 +1517,4 @@ async function __wbg_init(module_or_path) {
|
|
|
1489
1517
|
}
|
|
1490
1518
|
|
|
1491
1519
|
export { initSync, __wbg_init as default };
|
|
1492
|
-
export const WASM_SRI = "sha512-
|
|
1520
|
+
export const WASM_SRI = "sha512-8n+fD7p0Ub6oJZTuqCs9963t8zreMwliFGiAfr3DMETjZ4m8ai4kJmD2ITad/CvCUebhyB0IfHhFGn5OpY33dg==";
|
package/pkg/c2pa_bg.wasm
CHANGED
|
Binary file
|
package/pkg/c2pa_bg.wasm.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const __wbg_wasmbuilder_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
6
6
|
export const __wbg_wasmsigner_free: (a: number, b: number) => void;
|
|
7
|
+
export const encodeSignerPayload: (a: any) => [number, number, number, number];
|
|
7
8
|
export const run: () => void;
|
|
8
9
|
export const wasmbuilder_addAction: (a: number, b: any) => [number, number];
|
|
9
10
|
export const wasmbuilder_addAssertion: (a: number, b: number, c: number, d: any) => [number, number];
|
|
@@ -27,6 +28,7 @@ export const wasmbuilder_signAndGetManifestBytes: (a: number, b: any, c: any, d:
|
|
|
27
28
|
export const wasmbuilder_toArchive: (a: number) => [number, number, number];
|
|
28
29
|
export const wasmbuilder_updateActionsAt: (a: number, b: any) => [number, number];
|
|
29
30
|
export const wasmbuilder_updateAssertionsAt: (a: number, b: number, c: number, d: any) => [number, number];
|
|
31
|
+
export const wasmbuilder_updateManifestProperty: (a: number, b: number, c: number, d: any) => [number, number];
|
|
30
32
|
export const wasmreader_activeLabel: (a: number) => [number, number];
|
|
31
33
|
export const wasmreader_activeManifest: (a: number) => [number, number, number];
|
|
32
34
|
export const wasmreader_crJson: (a: number) => [number, number];
|