@contentauth/c2pa-wasm 0.13.5 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentauth/c2pa-wasm",
3
- "version": "0.13.5",
3
+ "version": "0.14.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
  */
@@ -1081,12 +1096,12 @@ function __wbg_get_imports() {
1081
1096
  return ret;
1082
1097
  },
1083
1098
  __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`.
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`.
1085
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_);
1086
1101
  return ret;
1087
1102
  },
1088
1103
  __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`.
1104
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1986, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1090
1105
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_255200e6d97c625a___convert__closures_____invoke_______true_);
1091
1106
  return ret;
1092
1107
  },
@@ -1502,4 +1517,4 @@ async function __wbg_init(module_or_path) {
1502
1517
  }
1503
1518
 
1504
1519
  export { initSync, __wbg_init as default };
1505
- export const WASM_SRI = "sha512-s2/YQz2mTLJbZSB73zg1sbKJLNjqVhf46jsaa2crYCWtCf0oaKG8VKPCRckKPKqKacdJMm4vT9Ov0yQw9ESGMA==";
1520
+ export const WASM_SRI = "sha512-8n+fD7p0Ub6oJZTuqCs9963t8zreMwliFGiAfr3DMETjZ4m8ai4kJmD2ITad/CvCUebhyB0IfHhFGn5OpY33dg==";
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];