@contentauth/c2pa-wasm 0.13.5 → 0.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentauth/c2pa-wasm",
3
- "version": "0.13.5",
3
+ "version": "0.15.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
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 {
@@ -268,6 +270,11 @@ export class WasmSigner {
268
270
  static fromDefinition(def: SignerDefinition): WasmSigner;
269
271
  }
270
272
 
273
+ /**
274
+ * Encode a camelCase JavaScript SignerPayload as canonical CAWG CBOR.
275
+ */
276
+ export function encodeSignerPayload(payload: SignerPayloadInput): Uint8Array;
277
+
271
278
  /**
272
279
  * Called when the WASM binary is initialized.
273
280
  */
@@ -280,6 +287,7 @@ export interface InitOutput {
280
287
  readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
281
288
  readonly __wbg_wasmreader_free: (a: number, b: number) => void;
282
289
  readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
290
+ readonly encodeSignerPayload: (a: any) => [number, number, number, number];
283
291
  readonly run: () => void;
284
292
  readonly wasmbuilder_addAction: (a: number, b: any) => [number, number];
285
293
  readonly wasmbuilder_addAssertion: (a: number, b: number, c: number, d: any) => [number, number];
package/pkg/c2pa.js CHANGED
@@ -572,6 +572,21 @@ export class WasmSigner {
572
572
  }
573
573
  if (Symbol.dispose) WasmSigner.prototype[Symbol.dispose] = WasmSigner.prototype.free;
574
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
+
575
590
  /**
576
591
  * Called when the WASM binary is initialized.
577
592
  */
@@ -935,6 +950,14 @@ function __wbg_get_imports() {
935
950
  const ret = Date.now();
936
951
  return ret;
937
952
  },
953
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
954
+ const ret = arg0.now();
955
+ return ret;
956
+ },
957
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
958
+ const ret = arg0.performance;
959
+ return ret;
960
+ },
938
961
  __wbg_process_44c7a14e11e9f69e: function(arg0) {
939
962
  const ret = arg0.process;
940
963
  return ret;
@@ -1081,12 +1104,12 @@ function __wbg_get_imports() {
1081
1104
  return ret;
1082
1105
  },
1083
1106
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1084
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3294, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1107
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3386, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1085
1108
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_255200e6d97c625a___convert__closures_____invoke___wasm_bindgen_255200e6d97c625a___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_255200e6d97c625a___JsError___true_);
1086
1109
  return ret;
1087
1110
  },
1088
1111
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1089
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1984, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1112
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2066, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1090
1113
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_255200e6d97c625a___convert__closures_____invoke_______true_);
1091
1114
  return ret;
1092
1115
  },
@@ -1502,4 +1525,4 @@ async function __wbg_init(module_or_path) {
1502
1525
  }
1503
1526
 
1504
1527
  export { initSync, __wbg_init as default };
1505
- export const WASM_SRI = "sha512-s2/YQz2mTLJbZSB73zg1sbKJLNjqVhf46jsaa2crYCWtCf0oaKG8VKPCRckKPKqKacdJMm4vT9Ov0yQw9ESGMA==";
1528
+ export const WASM_SRI = "sha512-oytYB3955KeLptXFrX5WjxwZPgqsF+jTVCBqPVer0LGtnbSX6bJfF7E7xMMHKTxJ9x2itQdoTKzCkF1rsmFk0w==";
package/pkg/c2pa_bg.wasm CHANGED
Binary file
@@ -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];