@trylimbo/sdk-verifier-wasm 0.2.25-canary.37 → 0.2.25-canary.38

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.
@@ -267,4 +267,4 @@ function generateUUID() {
267
267
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
268
268
  }
269
269
  //#endregion
270
- export { wrap as i, finalizer as n, proxy as r, expose as t };
270
+ export { wrap as a, transferHandlers as i, finalizer as n, proxy as r, expose as t };
@@ -77,7 +77,7 @@ export interface SessionKey {
77
77
  */
78
78
  kid: Uint8Array;
79
79
  /**
80
- * The session key\'s public half (SEC1-encoded bytes).
80
+ * SEC1 EC, raw Ed25519 or PKCS#1 DER RSA public-key bytes.
81
81
  */
82
82
  publicKey: Uint8Array;
83
83
  }
@@ -211,7 +211,7 @@ export interface InitValidation {
211
211
  /**
212
212
  * Result of `StreamSession.validate`, discriminated by `kind`.
213
213
  */
214
- export type SegmentValidation = ({ kind: "init" } & InitValidation) | ({ kind: "media" } & MediaValidation) | { kind: "unknown" };
214
+ export type SegmentValidation = ({ kind: "init" } & InitValidation) | ({ kind: "media" } & MediaValidation);
215
215
 
216
216
  /**
217
217
  * The C2PA 2.4 golden-flow comparison of the embedded manifest against what the repository holds.
@@ -233,6 +233,9 @@ export type DiscoveryVia = { kind: "byBinding"; value: Uint8Array } | { kind: "b
233
233
  * by `kind`. A consumer switches on `err.kind` (`\"reason\" | \"invalid\" | \"status\"`)
234
234
  * and reads the shape-specific fields; `code` and `message` are common to every
235
235
  * shape.
236
+ *
237
+ * What is thrown is an `Error` named `SdkError` (a stack, `instanceof Error`) that carries
238
+ * these fields; this type is the shape of its properties.
236
239
  */
237
240
  export type SdkError = ({ kind: "status" } & StatusError) | ({ kind: "reason" } & ReasonError) | ({ kind: "invalid" } & InvalidError);
238
241
 
@@ -279,9 +282,9 @@ export interface Hint {
279
282
  */
280
283
  export interface SegmentTiming {
281
284
  /**
282
- * The segment\'s `sequenceNumber` (exact below 2^53).
285
+ * The segment\'s `sequenceNumber`, a `bigint` as in the Node FFI lane.
283
286
  */
284
- sequence: number;
287
+ sequence: bigint;
285
288
  /**
286
289
  * The span its C2PA `emsg` covers, in milliseconds.
287
290
  */
@@ -298,6 +301,10 @@ export interface StreamVerifierOptions {
298
301
  * in milliseconds. Absent, 5 minutes.
299
302
  */
300
303
  skewTolerance?: number;
304
+ /**
305
+ * Exact HTTPS origins approved for external live-video manifest recovery.
306
+ */
307
+ manifestOrigins?: string[];
301
308
  }
302
309
 
303
310
  /**
@@ -359,7 +366,7 @@ export interface Recovery {
359
366
  /**
360
367
  * What this verify concludes about the asset, from signed evidence alone.
361
368
  */
362
- export type Verdict = { kind: "unsigned" } | { kind: "inconclusive" } | { kind: "embedded" } | { kind: "recovered"; index: number; decidedBy: VerdictRule } | { kind: "recoveredDerivative"; index: number; decidedBy: VerdictRule } | { kind: "ambiguous"; candidates: number[] };
369
+ export type Verdict = { kind: "unsigned" } | { kind: "inconclusive" } | { kind: "embedded" } | { kind: "invalid"; index: number } | { kind: "recovered"; index: number; decidedBy: VerdictRule } | { kind: "recoveredDerivative"; index: number; decidedBy: VerdictRule } | { kind: "ambiguous"; candidates: number[] };
363
370
 
364
371
  /**
365
372
  * When a verify asks the repositories.
@@ -395,7 +402,7 @@ export type FingerprintCheck = { kind: "notNeeded" } | { kind: "missing" } | { k
395
402
  /**
396
403
  * Whether the manifest\'s hard binding holds over the bytes this verify read.
397
404
  */
398
- export type HardBinding = "match" | "mismatch";
405
+ export type HardBinding = "match" | "mismatch" | "unverified";
399
406
 
400
407
  /**
401
408
  * Why repository recovery did not complete cleanly, or why one candidate was omitted.
@@ -435,13 +442,14 @@ export class AssetVerifier {
435
442
  *
436
443
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
437
444
  * are native, so a master is verified through the native SDK.
445
+ * `format` optionally declares the media type for inputs such as SVG and plain text.
438
446
  *
439
447
  * # Errors
440
448
  *
441
449
  * Throws on a malformed `source`, a repository (or engine) failure, or a validation
442
450
  * failure.
443
451
  */
444
- verify(source: RangeSource, recovery?: Recovery | null): Promise<Verification>;
452
+ verify(source: RangeSource, recovery?: Recovery | null, format?: string | null): Promise<Verification>;
445
453
  }
446
454
 
447
455
  /**
@@ -589,7 +597,7 @@ export class StreamVerifier {
589
597
  * `StreamSession.export` produced (`state.malformed`), or one of another export version
590
598
  * (`state.version`).
591
599
  */
592
- resume(state: Uint8Array): StreamSession;
600
+ resume(state: Uint8Array): Promise<StreamSession>;
593
601
  }
594
602
 
595
603
  /**
@@ -660,7 +668,7 @@ export function init_panic_hook(): void;
660
668
  *
661
669
  * # Errors
662
670
  *
663
- * Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
671
+ * Rejects with `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
664
672
  */
665
673
  export function parse(manifest: Uint8Array): Promise<import('@contentauth/c2pa-types').ManifestStore>;
666
674
 
@@ -670,7 +678,7 @@ export function parse(manifest: Uint8Array): Promise<import('@contentauth/c2pa-t
670
678
  *
671
679
  * # Errors
672
680
  *
673
- * Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse, or the store
681
+ * Rejects with `READER_INVALID` when the bytes are not a manifest store c2pa can parse, or the store
674
682
  * holds the resource but cannot produce it.
675
683
  */
676
684
  export function resource(manifest: Uint8Array, uri: string): Promise<Uint8Array | undefined>;
@@ -679,6 +687,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
679
687
 
680
688
  export interface InitOutput {
681
689
  readonly memory: WebAssembly.Memory;
690
+ readonly parse: (a: number, b: number) => any;
691
+ readonly resource: (a: number, b: number, c: number, d: number) => any;
692
+ readonly c2paTrustList: () => [number, number];
693
+ readonly c2paTsaTrustList: () => [number, number];
694
+ readonly devCa: () => [number, number];
695
+ readonly init_panic_hook: () => void;
682
696
  readonly computeSoftBinding: (a: number, b: number, c: any, d: number, e: number) => any;
683
697
  readonly __wbg_assetverifier_free: (a: number, b: number) => void;
684
698
  readonly __wbg_blobsource_free: (a: number, b: number) => void;
@@ -687,26 +701,20 @@ export interface InitOutput {
687
701
  readonly __wbg_streamverifier_free: (a: number, b: number) => void;
688
702
  readonly __wbg_verification_free: (a: number, b: number) => void;
689
703
  readonly assetverifier_create: (a: any) => [number, number, number];
690
- readonly assetverifier_verify: (a: number, b: any, c: number) => any;
704
+ readonly assetverifier_verify: (a: number, b: any, c: number, d: number, e: number) => any;
691
705
  readonly blobsource_length: (a: number) => number;
692
706
  readonly blobsource_new: (a: any) => [number, number, number];
693
707
  readonly blobsource_readAt: (a: number, b: number, c: number) => [number, number, number];
694
708
  readonly memorysource_length: (a: number) => number;
695
709
  readonly memorysource_new: (a: any) => number;
696
710
  readonly memorysource_readAt: (a: number, b: number, c: number) => any;
697
- readonly parse: (a: number, b: number) => any;
698
- readonly resource: (a: number, b: number, c: number, d: number) => any;
699
711
  readonly streamsession_export: (a: number) => [number, number, number, number];
700
712
  readonly streamsession_validate: (a: number, b: any) => any;
701
713
  readonly streamverifier_create: (a: any) => [number, number, number];
702
714
  readonly streamverifier_open: (a: number, b: number, c: number) => number;
703
- readonly streamverifier_resume: (a: number, b: number, c: number) => [number, number, number];
715
+ readonly streamverifier_resume: (a: number, b: number, c: number) => any;
704
716
  readonly verification_report: (a: number) => any;
705
717
  readonly verification_resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
706
- readonly c2paTrustList: () => [number, number];
707
- readonly c2paTsaTrustList: () => [number, number];
708
- readonly devCa: () => [number, number];
709
- readonly init_panic_hook: () => void;
710
718
  readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
711
719
  readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
712
720
  readonly intounderlyingbytesource_cancel: (a: number) => void;
@@ -722,8 +730,8 @@ export interface InitOutput {
722
730
  readonly intounderlyingsink_write: (a: number, b: any) => any;
723
731
  readonly wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1: (a: number, b: number, c: any) => [number, number];
724
732
  readonly wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf: (a: number, b: number, c: any, d: any) => void;
725
- readonly wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3: (a: number, b: number, c: any) => void;
726
- readonly wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846: (a: number, b: number) => void;
733
+ readonly wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0: (a: number, b: number, c: any) => void;
734
+ readonly wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479: (a: number, b: number) => void;
727
735
  readonly __wbindgen_malloc: (a: number, b: number) => number;
728
736
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
729
737
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -36,6 +36,7 @@ export class AssetVerifier {
36
36
  *
37
37
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
38
38
  * are native, so a master is verified through the native SDK.
39
+ * `format` optionally declares the media type for inputs such as SVG and plain text.
39
40
  *
40
41
  * # Errors
41
42
  *
@@ -43,10 +44,13 @@ export class AssetVerifier {
43
44
  * failure.
44
45
  * @param {RangeSource} source
45
46
  * @param {Recovery | null} [recovery]
47
+ * @param {string | null} [format]
46
48
  * @returns {Promise<Verification>}
47
49
  */
48
- verify(source, recovery) {
49
- const ret = wasm.assetverifier_verify(this.__wbg_ptr, source, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery));
50
+ verify(source, recovery, format) {
51
+ var ptr0 = isLikeNone(format) ? 0 : passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
52
+ var len0 = WASM_VECTOR_LEN;
53
+ const ret = wasm.assetverifier_verify(this.__wbg_ptr, source, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery), ptr0, len0);
50
54
  return ret;
51
55
  }
52
56
  }
@@ -398,16 +402,13 @@ export class StreamVerifier {
398
402
  * `StreamSession.export` produced (`state.malformed`), or one of another export version
399
403
  * (`state.version`).
400
404
  * @param {Uint8Array} state
401
- * @returns {StreamSession}
405
+ * @returns {Promise<StreamSession>}
402
406
  */
403
407
  resume(state) {
404
408
  const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
405
409
  const len0 = WASM_VECTOR_LEN;
406
410
  const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0);
407
- if (ret[2]) {
408
- throw takeFromExternrefTable0(ret[1]);
409
- }
410
- return StreamSession.__wrap(ret[0]);
411
+ return ret;
411
412
  }
412
413
  }
413
414
  if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
@@ -563,9 +564,9 @@ export function init_panic_hook() {
563
564
  *
564
565
  * # Errors
565
566
  *
566
- * Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
567
+ * Rejects with `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
567
568
  * @param {Uint8Array} manifest
568
- * @returns {import('@contentauth/c2pa-types').ManifestStore}
569
+ * @returns {Promise<import('@contentauth/c2pa-types').ManifestStore>}
569
570
  */
570
571
  export function parse(manifest) {
571
572
  const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
@@ -580,7 +581,7 @@ export function parse(manifest) {
580
581
  *
581
582
  * # Errors
582
583
  *
583
- * Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse, or the store
584
+ * Rejects with `READER_INVALID` when the bytes are not a manifest store c2pa can parse, or the store
584
585
  * holds the resource but cannot produce it.
585
586
  * @param {Uint8Array} manifest
586
587
  * @param {string} uri
@@ -704,6 +705,10 @@ function __wbg_get_imports() {
704
705
  const ret = arg0.arrayBuffer();
705
706
  return ret;
706
707
  }, arguments); },
708
+ __wbg_assign_fd82cd5b89efb160: function(arg0, arg1) {
709
+ const ret = Object.assign(arg0, arg1);
710
+ return ret;
711
+ },
707
712
  __wbg_body_18c9f2ac15ead4b2: function(arg0) {
708
713
  const ret = arg0.body;
709
714
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -1050,6 +1055,10 @@ function __wbg_get_imports() {
1050
1055
  const ret = arg0.read();
1051
1056
  return ret;
1052
1057
  },
1058
+ __wbg_reject_90df95b492dd8563: function(arg0) {
1059
+ const ret = Promise.reject(arg0);
1060
+ return ret;
1061
+ },
1053
1062
  __wbg_releaseLock_5b92874cad775644: function(arg0) {
1054
1063
  arg0.releaseLock();
1055
1064
  },
@@ -1098,6 +1107,12 @@ function __wbg_get_imports() {
1098
1107
  __wbg_set_mode_66c79886ad78fc05: function(arg0, arg1) {
1099
1108
  arg0.mode = __wbindgen_enum_RequestMode[arg1];
1100
1109
  },
1110
+ __wbg_set_name_3bbc583faefa4193: function(arg0, arg1, arg2) {
1111
+ arg0.name = getStringFromWasm0(arg1, arg2);
1112
+ },
1113
+ __wbg_set_redirect_badd73a0bcb765e3: function(arg0, arg1) {
1114
+ arg0.redirect = __wbindgen_enum_RequestRedirect[arg1];
1115
+ },
1101
1116
  __wbg_set_signal_c4ef8faddb4c1446: function(arg0, arg1) {
1102
1117
  arg0.signal = arg1;
1103
1118
  },
@@ -1140,6 +1155,10 @@ function __wbg_get_imports() {
1140
1155
  const ret = arg0.status;
1141
1156
  return ret;
1142
1157
  },
1158
+ __wbg_streamsession_new: function(arg0) {
1159
+ const ret = StreamSession.__wrap(arg0);
1160
+ return ret;
1161
+ },
1143
1162
  __wbg_stringify_b54333f60f1e4dad: function() { return handleError(function (arg0) {
1144
1163
  const ret = JSON.stringify(arg0);
1145
1164
  return ret;
@@ -1180,18 +1199,18 @@ function __wbg_get_imports() {
1180
1199
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1181
1200
  },
1182
1201
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1183
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2185, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1202
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2234, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1184
1203
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1);
1185
1204
  return ret;
1186
1205
  },
1187
1206
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1188
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 5888, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1189
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
1207
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 5988, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1208
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0);
1190
1209
  return ret;
1191
1210
  },
1192
1211
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1193
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3433, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1194
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846);
1212
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1213
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479);
1195
1214
  return ret;
1196
1215
  },
1197
1216
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -1249,12 +1268,12 @@ function __wbg_get_imports() {
1249
1268
  };
1250
1269
  }
1251
1270
 
1252
- function wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1) {
1253
- wasm.wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1);
1271
+ function wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479(arg0, arg1) {
1272
+ wasm.wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479(arg0, arg1);
1254
1273
  }
1255
1274
 
1256
- function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
1257
- wasm.wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2);
1275
+ function wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0(arg0, arg1, arg2) {
1276
+ wasm.wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0(arg0, arg1, arg2);
1258
1277
  }
1259
1278
 
1260
1279
  function wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2) {
@@ -1279,6 +1298,9 @@ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
1279
1298
 
1280
1299
 
1281
1300
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
1301
+
1302
+
1303
+ const __wbindgen_enum_RequestRedirect = ["follow", "error", "manual"];
1282
1304
  const AssetVerifierFinalization = (typeof FinalizationRegistry === 'undefined')
1283
1305
  ? { register: () => {}, unregister: () => {} }
1284
1306
  : new FinalizationRegistry(ptr => wasm.__wbg_assetverifier_free(ptr, 1));
@@ -1,6 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const parse: (a: number, b: number) => any;
5
+ export const resource: (a: number, b: number, c: number, d: number) => any;
6
+ export const c2paTrustList: () => [number, number];
7
+ export const c2paTsaTrustList: () => [number, number];
8
+ export const devCa: () => [number, number];
9
+ export const init_panic_hook: () => void;
4
10
  export const computeSoftBinding: (a: number, b: number, c: any, d: number, e: number) => any;
5
11
  export const __wbg_assetverifier_free: (a: number, b: number) => void;
6
12
  export const __wbg_blobsource_free: (a: number, b: number) => void;
@@ -9,26 +15,20 @@ export const __wbg_streamsession_free: (a: number, b: number) => void;
9
15
  export const __wbg_streamverifier_free: (a: number, b: number) => void;
10
16
  export const __wbg_verification_free: (a: number, b: number) => void;
11
17
  export const assetverifier_create: (a: any) => [number, number, number];
12
- export const assetverifier_verify: (a: number, b: any, c: number) => any;
18
+ export const assetverifier_verify: (a: number, b: any, c: number, d: number, e: number) => any;
13
19
  export const blobsource_length: (a: number) => number;
14
20
  export const blobsource_new: (a: any) => [number, number, number];
15
21
  export const blobsource_readAt: (a: number, b: number, c: number) => [number, number, number];
16
22
  export const memorysource_length: (a: number) => number;
17
23
  export const memorysource_new: (a: any) => number;
18
24
  export const memorysource_readAt: (a: number, b: number, c: number) => any;
19
- export const parse: (a: number, b: number) => any;
20
- export const resource: (a: number, b: number, c: number, d: number) => any;
21
25
  export const streamsession_export: (a: number) => [number, number, number, number];
22
26
  export const streamsession_validate: (a: number, b: any) => any;
23
27
  export const streamverifier_create: (a: any) => [number, number, number];
24
28
  export const streamverifier_open: (a: number, b: number, c: number) => number;
25
- export const streamverifier_resume: (a: number, b: number, c: number) => [number, number, number];
29
+ export const streamverifier_resume: (a: number, b: number, c: number) => any;
26
30
  export const verification_report: (a: number) => any;
27
31
  export const verification_resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
28
- export const c2paTrustList: () => [number, number];
29
- export const c2paTsaTrustList: () => [number, number];
30
- export const devCa: () => [number, number];
31
- export const init_panic_hook: () => void;
32
32
  export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
33
33
  export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
34
34
  export const intounderlyingbytesource_cancel: (a: number) => void;
@@ -44,8 +44,8 @@ export const intounderlyingsink_close: (a: number) => any;
44
44
  export const intounderlyingsink_write: (a: number, b: any) => any;
45
45
  export const wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1: (a: number, b: number, c: any) => [number, number];
46
46
  export const wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf: (a: number, b: number, c: any, d: any) => void;
47
- export const wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3: (a: number, b: number, c: any) => void;
48
- export const wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846: (a: number, b: number) => void;
47
+ export const wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0: (a: number, b: number, c: any) => void;
48
+ export const wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479: (a: number, b: number) => void;
49
49
  export const __wbindgen_malloc: (a: number, b: number) => number;
50
50
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
51
51
  export const __wbindgen_exn_store: (a: number) => void;
@@ -1,4 +1,4 @@
1
- import { n as finalizer, r as proxy, t as expose } from "./comlink.js";
1
+ import { i as transferHandlers, n as finalizer, r as proxy, t as expose } from "./comlink.js";
2
2
  //#region gen/wasm/trylimbo_sdk_verifier.js
3
3
  var AssetVerifier = class AssetVerifier {
4
4
  static __wrap(ptr) {
@@ -34,6 +34,7 @@ var AssetVerifier = class AssetVerifier {
34
34
  *
35
35
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
36
36
  * are native, so a master is verified through the native SDK.
37
+ * `format` optionally declares the media type for inputs such as SVG and plain text.
37
38
  *
38
39
  * # Errors
39
40
  *
@@ -41,10 +42,13 @@ var AssetVerifier = class AssetVerifier {
41
42
  * failure.
42
43
  * @param {RangeSource} source
43
44
  * @param {Recovery | null} [recovery]
45
+ * @param {string | null} [format]
44
46
  * @returns {Promise<Verification>}
45
47
  */
46
- verify(source, recovery) {
47
- return wasm.assetverifier_verify(this.__wbg_ptr, source, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery));
48
+ verify(source, recovery, format) {
49
+ var ptr0 = isLikeNone(format) ? 0 : passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
50
+ var len0 = WASM_VECTOR_LEN;
51
+ return wasm.assetverifier_verify(this.__wbg_ptr, source, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery), ptr0, len0);
48
52
  }
49
53
  };
50
54
  if (Symbol.dispose) AssetVerifier.prototype[Symbol.dispose] = AssetVerifier.prototype.free;
@@ -370,14 +374,12 @@ var StreamVerifier = class StreamVerifier {
370
374
  * `StreamSession.export` produced (`state.malformed`), or one of another export version
371
375
  * (`state.version`).
372
376
  * @param {Uint8Array} state
373
- * @returns {StreamSession}
377
+ * @returns {Promise<StreamSession>}
374
378
  */
375
379
  resume(state) {
376
380
  const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
377
381
  const len0 = WASM_VECTOR_LEN;
378
- const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0);
379
- if (ret[2]) throw takeFromExternrefTable0(ret[1]);
380
- return StreamSession.__wrap(ret[0]);
382
+ return wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0);
381
383
  }
382
384
  };
383
385
  if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
@@ -486,9 +488,9 @@ function devCa() {
486
488
  *
487
489
  * # Errors
488
490
  *
489
- * Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
491
+ * Rejects with `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
490
492
  * @param {Uint8Array} manifest
491
- * @returns {import('@contentauth/c2pa-types').ManifestStore}
493
+ * @returns {Promise<import('@contentauth/c2pa-types').ManifestStore>}
492
494
  */
493
495
  function parse(manifest) {
494
496
  const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
@@ -501,7 +503,7 @@ function parse(manifest) {
501
503
  *
502
504
  * # Errors
503
505
  *
504
- * Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse, or the store
506
+ * Rejects with `READER_INVALID` when the bytes are not a manifest store c2pa can parse, or the store
505
507
  * holds the resource but cannot produce it.
506
508
  * @param {Uint8Array} manifest
507
509
  * @param {string} uri
@@ -615,6 +617,9 @@ function __wbg_get_imports() {
615
617
  return arg0.arrayBuffer();
616
618
  }, arguments);
617
619
  },
620
+ __wbg_assign_fd82cd5b89efb160: function(arg0, arg1) {
621
+ return Object.assign(arg0, arg1);
622
+ },
618
623
  __wbg_body_18c9f2ac15ead4b2: function(arg0) {
619
624
  const ret = arg0.body;
620
625
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -940,6 +945,9 @@ function __wbg_get_imports() {
940
945
  __wbg_read_8afa15f12a160ef8: function(arg0) {
941
946
  return arg0.read();
942
947
  },
948
+ __wbg_reject_90df95b492dd8563: function(arg0) {
949
+ return Promise.reject(arg0);
950
+ },
943
951
  __wbg_releaseLock_5b92874cad775644: function(arg0) {
944
952
  arg0.releaseLock();
945
953
  },
@@ -989,6 +997,12 @@ function __wbg_get_imports() {
989
997
  __wbg_set_mode_66c79886ad78fc05: function(arg0, arg1) {
990
998
  arg0.mode = __wbindgen_enum_RequestMode[arg1];
991
999
  },
1000
+ __wbg_set_name_3bbc583faefa4193: function(arg0, arg1, arg2) {
1001
+ arg0.name = getStringFromWasm0(arg1, arg2);
1002
+ },
1003
+ __wbg_set_redirect_badd73a0bcb765e3: function(arg0, arg1) {
1004
+ arg0.redirect = __wbindgen_enum_RequestRedirect[arg1];
1005
+ },
992
1006
  __wbg_set_signal_c4ef8faddb4c1446: function(arg0, arg1) {
993
1007
  arg0.signal = arg1;
994
1008
  },
@@ -1029,6 +1043,9 @@ function __wbg_get_imports() {
1029
1043
  __wbg_status_c45b3b9b3033184a: function(arg0) {
1030
1044
  return arg0.status;
1031
1045
  },
1046
+ __wbg_streamsession_new: function(arg0) {
1047
+ return StreamSession.__wrap(arg0);
1048
+ },
1032
1049
  __wbg_stringify_b54333f60f1e4dad: function() {
1033
1050
  return handleError(function(arg0) {
1034
1051
  return JSON.stringify(arg0);
@@ -1067,10 +1084,10 @@ function __wbg_get_imports() {
1067
1084
  return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1);
1068
1085
  },
1069
1086
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1070
- return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
1087
+ return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0);
1071
1088
  },
1072
1089
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1073
- return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846);
1090
+ return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479);
1074
1091
  },
1075
1092
  __wbindgen_cast_0000000000000004: function(arg0) {
1076
1093
  return arg0;
@@ -1109,11 +1126,11 @@ function __wbg_get_imports() {
1109
1126
  }
1110
1127
  };
1111
1128
  }
1112
- function wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1) {
1113
- wasm.wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1);
1129
+ function wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479(arg0, arg1) {
1130
+ wasm.wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479(arg0, arg1);
1114
1131
  }
1115
- function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
1116
- wasm.wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2);
1132
+ function wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0(arg0, arg1, arg2) {
1133
+ wasm.wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0(arg0, arg1, arg2);
1117
1134
  }
1118
1135
  function wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2) {
1119
1136
  const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2);
@@ -1142,6 +1159,11 @@ const __wbindgen_enum_RequestMode = [
1142
1159
  "cors",
1143
1160
  "navigate"
1144
1161
  ];
1162
+ const __wbindgen_enum_RequestRedirect = [
1163
+ "follow",
1164
+ "error",
1165
+ "manual"
1166
+ ];
1145
1167
  const AssetVerifierFinalization = typeof FinalizationRegistry === "undefined" ? {
1146
1168
  register: () => {},
1147
1169
  unregister: () => {}
@@ -1452,8 +1474,8 @@ var VerificationHandle = class extends Handle {
1452
1474
  };
1453
1475
  var AssetVerifierHandle = class extends Handle {
1454
1476
  /** `recovery` is what this verify may do to recover a manifest, as the direct import takes it. */
1455
- async verify(asset, recovery) {
1456
- return proxy(new VerificationHandle(await this.inner.verify(source(asset), recovery)));
1477
+ async verify(asset, recovery, format) {
1478
+ return proxy(new VerificationHandle(await this.inner.verify(source(asset), recovery, format)));
1457
1479
  }
1458
1480
  };
1459
1481
  /** One stream being validated. Dropping the handle releases the session it accumulated. */
@@ -1469,10 +1491,28 @@ var StreamVerifierHandle = class extends Handle {
1469
1491
  open(id) {
1470
1492
  return proxy(new StreamSessionHandle(this.inner.open(id)));
1471
1493
  }
1472
- resume(state) {
1473
- return proxy(new StreamSessionHandle(this.inner.resume(state)));
1494
+ async resume(state) {
1495
+ return proxy(new StreamSessionHandle(await this.inner.resume(state)));
1474
1496
  }
1475
1497
  };
1498
+ const thrown = transferHandlers.get("throw");
1499
+ transferHandlers.set("throw", {
1500
+ ...thrown,
1501
+ serialize: (payload) => {
1502
+ const { value } = payload;
1503
+ if (!(value instanceof Error)) return thrown.serialize(payload);
1504
+ const { message, name, stack } = value;
1505
+ return [{
1506
+ isError: true,
1507
+ value: {
1508
+ ...value,
1509
+ message,
1510
+ name,
1511
+ stack
1512
+ }
1513
+ }, []];
1514
+ }
1515
+ });
1476
1516
  let ready;
1477
1517
  /** The module's own surface, name for name with the direct import. */
1478
1518
  const sdk = {
@@ -192,7 +192,7 @@ interface SessionKey {
192
192
  */
193
193
  kid: Uint8Array;
194
194
  /**
195
- * The session key\'s public half (SEC1-encoded bytes).
195
+ * SEC1 EC, raw Ed25519 or PKCS#1 DER RSA public-key bytes.
196
196
  */
197
197
  publicKey: Uint8Array;
198
198
  }
@@ -311,9 +311,7 @@ type SegmentValidation = ({
311
311
  kind: "init";
312
312
  } & InitValidation) | ({
313
313
  kind: "media";
314
- } & MediaValidation) | {
315
- kind: "unknown";
316
- };
314
+ } & MediaValidation);
317
315
  /**
318
316
  * The C2PA 2.4 golden-flow comparison of the embedded manifest against what the repository holds.
319
317
  */
@@ -386,9 +384,9 @@ interface Hint {
386
384
  */
387
385
  interface SegmentTiming {
388
386
  /**
389
- * The segment\'s `sequenceNumber` (exact below 2^53).
387
+ * The segment\'s `sequenceNumber`, a `bigint` as in the Node FFI lane.
390
388
  */
391
- sequence: number;
389
+ sequence: bigint;
392
390
  /**
393
391
  * The span its C2PA `emsg` covers, in milliseconds.
394
392
  */
@@ -404,6 +402,10 @@ interface StreamVerifierOptions {
404
402
  * in milliseconds. Absent, 5 minutes.
405
403
  */
406
404
  skewTolerance?: number;
405
+ /**
406
+ * Exact HTTPS origins approved for external live-video manifest recovery.
407
+ */
408
+ manifestOrigins?: string[];
407
409
  }
408
410
  /**
409
411
  * What a verifier trusts. An omitted list trusts nothing.
@@ -467,6 +469,9 @@ type Verdict = {
467
469
  kind: "inconclusive";
468
470
  } | {
469
471
  kind: "embedded";
472
+ } | {
473
+ kind: "invalid";
474
+ index: number;
470
475
  } | {
471
476
  kind: "recovered";
472
477
  index: number;
@@ -532,7 +537,7 @@ type FingerprintCheck = {
532
537
  /**
533
538
  * Whether the manifest\'s hard binding holds over the bytes this verify read.
534
539
  */
535
- type HardBinding = "match" | "mismatch";
540
+ type HardBinding = "match" | "mismatch" | "unverified";
536
541
  /**
537
542
  * Why repository recovery did not complete cleanly, or why one candidate was omitted.
538
543
  */
@@ -609,13 +614,14 @@ declare class AssetVerifier {
609
614
  *
610
615
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
611
616
  * are native, so a master is verified through the native SDK.
617
+ * `format` optionally declares the media type for inputs such as SVG and plain text.
612
618
  *
613
619
  * # Errors
614
620
  *
615
621
  * Throws on a malformed `source`, a repository (or engine) failure, or a validation
616
622
  * failure.
617
623
  */
618
- verify(source: RangeSource, recovery?: Recovery | null): Promise<Verification>;
624
+ verify(source: RangeSource, recovery?: Recovery | null, format?: string | null): Promise<Verification>;
619
625
  }
620
626
  /**
621
627
  * One stream being validated. It owns the session keys and manifest ids its init segments
@@ -681,7 +687,7 @@ declare class StreamVerifier {
681
687
  * `StreamSession.export` produced (`state.malformed`), or one of another export version
682
688
  * (`state.version`).
683
689
  */
684
- resume(state: Uint8Array): StreamSession;
690
+ resume(state: Uint8Array): Promise<StreamSession>;
685
691
  }
686
692
  /**
687
693
  * One `verify` result held with the stores it read: `report` is the data, and `resource` reads a
@@ -751,7 +757,7 @@ declare class VerificationHandle extends Handle<Verification> {
751
757
  }
752
758
  declare class AssetVerifierHandle extends Handle<AssetVerifier> {
753
759
  /** `recovery` is what this verify may do to recover a manifest, as the direct import takes it. */
754
- verify(asset: Asset, recovery: Recovery | undefined): Promise<VerificationHandle & ProxyMarked>;
760
+ verify(asset: Asset, recovery: Recovery | undefined, format?: string): Promise<VerificationHandle & ProxyMarked>;
755
761
  }
756
762
  /** One stream being validated. Dropping the handle releases the session it accumulated. */
757
763
  declare class StreamSessionHandle extends Handle<StreamSession> {
@@ -760,7 +766,7 @@ declare class StreamSessionHandle extends Handle<StreamSession> {
760
766
  }
761
767
  declare class StreamVerifierHandle extends Handle<StreamVerifier> {
762
768
  open(id: string): StreamSessionHandle & ProxyMarked;
763
- resume(state: Uint8Array): StreamSessionHandle & ProxyMarked;
769
+ resume(state: Uint8Array): Promise<StreamSessionHandle & ProxyMarked>;
764
770
  }
765
771
  /** The module's own surface, name for name with the direct import. */
766
772
  declare const sdk: {
@@ -1,4 +1,4 @@
1
- import { i as wrap } from "./comlink.js";
1
+ import { a as wrap } from "./comlink.js";
2
2
  //#region src/worker.ts
3
3
  /**
4
4
  * Start the SDK in a Worker and wait for its module to instantiate.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trylimbo/sdk-verifier-wasm",
3
- "version": "0.2.25-canary.37",
3
+ "version": "0.2.25-canary.38",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",