@trylimbo/sdk-verifier-wasm 0.2.24 → 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.
@@ -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,27 +34,30 @@ 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
  *
40
- * Throws on a malformed `input`, a repository (or binder) failure, or a validation
41
+ * Throws on a malformed `source`, a repository (or engine) failure, or a validation
41
42
  * failure.
42
- * @param {RangeSource} input
43
+ * @param {RangeSource} source
43
44
  * @param {Recovery | null} [recovery]
44
- * @returns {Promise<AssetVerification>}
45
+ * @param {string | null} [format]
46
+ * @returns {Promise<Verification>}
45
47
  */
46
- verify(input, recovery) {
47
- return wasm.assetverifier_verify(this.__wbg_ptr, input, 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;
51
55
  /**
52
- * A [`RangeSource`](crate::wasm::RangeInput) over a `Blob`: a `File` off an `<input>`, a
56
+ * A `RangeSource` over a `Blob`: a `File` off an `<input>`, a
53
57
  * `Response.blob()`, a handle from the file system access API.
54
58
  *
55
- * The only source here that holds nothing. The SDK reads one slice at a time, so an asset larger
56
- * than the tab's memory verifies at the disk's speed rather than the heap's, and neither ceiling
57
- * the other two carry applies.
59
+ * It holds no bytes at all. The SDK reads one slice at a time, so an asset larger than the tab's
60
+ * memory verifies at the disk's speed rather than the heap's.
58
61
  *
59
62
  * # Worker only
60
63
  *
@@ -113,138 +116,6 @@ var BlobSource = class {
113
116
  }
114
117
  };
115
118
  if (Symbol.dispose) BlobSource.prototype[Symbol.dispose] = BlobSource.prototype.free;
116
- /**
117
- * A [`RangeSource`](crate::wasm::RangeInput) over bytes the caller already holds, read in place.
118
- *
119
- * [`MemorySource`] without the copy: the array stays on the JS side and only the window the SDK
120
- * asks for crosses, so nothing is resident here and linear memory's 4 GiB ceiling never applies to
121
- * the asset.
122
- */
123
- var BytesSource = class {
124
- __destroy_into_raw() {
125
- const ptr = this.__wbg_ptr;
126
- this.__wbg_ptr = 0;
127
- BytesSourceFinalization.unregister(this);
128
- return ptr;
129
- }
130
- free() {
131
- const ptr = this.__destroy_into_raw();
132
- wasm.__wbg_bytessource_free(ptr, 0);
133
- }
134
- /**
135
- * @returns {number}
136
- */
137
- get length() {
138
- return wasm.bytessource_length(this.__wbg_ptr);
139
- }
140
- /**
141
- * @param {Uint8Array} data
142
- */
143
- constructor(data) {
144
- const ret = wasm.bytessource_new(data);
145
- this.__wbg_ptr = ret;
146
- BytesSourceFinalization.register(this, this.__wbg_ptr, this);
147
- return this;
148
- }
149
- /**
150
- * @param {number} offset
151
- * @param {number} length
152
- * @returns {Uint8Array}
153
- */
154
- readAt(offset, length) {
155
- return wasm.bytessource_readAt(this.__wbg_ptr, offset, length);
156
- }
157
- };
158
- if (Symbol.dispose) BytesSource.prototype[Symbol.dispose] = BytesSource.prototype.free;
159
- /**
160
- * @returns {string}
161
- */
162
- function C2PA_TRUST_LIST() {
163
- let deferred1_0;
164
- let deferred1_1;
165
- try {
166
- const ret = wasm.C2PA_TRUST_LIST();
167
- deferred1_0 = ret[0];
168
- deferred1_1 = ret[1];
169
- return getStringFromWasm0(ret[0], ret[1]);
170
- } finally {
171
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
172
- }
173
- }
174
- /**
175
- * @returns {string}
176
- */
177
- function C2PA_TSA_TRUST_LIST() {
178
- let deferred1_0;
179
- let deferred1_1;
180
- try {
181
- const ret = wasm.C2PA_TSA_TRUST_LIST();
182
- deferred1_0 = ret[0];
183
- deferred1_1 = ret[1];
184
- return getStringFromWasm0(ret[0], ret[1]);
185
- } finally {
186
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
187
- }
188
- }
189
- /**
190
- * @returns {string}
191
- */
192
- function DEV_CA() {
193
- let deferred1_0;
194
- let deferred1_1;
195
- try {
196
- const ret = wasm.DEV_CA();
197
- deferred1_0 = ret[0];
198
- deferred1_1 = ret[1];
199
- return getStringFromWasm0(ret[0], ret[1]);
200
- } finally {
201
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
202
- }
203
- }
204
- /**
205
- * A binder contributing a binding you already hold (e.g. an out-of-band video ISCC):
206
- * `new HeldBinder(binding)`, the spelling the native lane uses. A verify takes it as data,
207
- * `{ kind: "held", binding }`, in `recovery.binders`.
208
- */
209
- var HeldBinder = class {
210
- __destroy_into_raw() {
211
- const ptr = this.__wbg_ptr;
212
- this.__wbg_ptr = 0;
213
- HeldBinderFinalization.unregister(this);
214
- return ptr;
215
- }
216
- free() {
217
- const ptr = this.__destroy_into_raw();
218
- wasm.__wbg_heldbinder_free(ptr, 0);
219
- }
220
- /**
221
- * Hand back the held binding; reads nothing.
222
- *
223
- * # Errors
224
- *
225
- * Throws when the source cannot be opened.
226
- * @param {RangeSource} content
227
- * @param {DeriveOptions} options
228
- * @returns {Promise<SoftBinding | undefined>}
229
- */
230
- derive(content, options) {
231
- return wasm.heldbinder_derive(this.__wbg_ptr, content, options);
232
- }
233
- /**
234
- * # Errors
235
- *
236
- * Throws `SdkError.invalid` on a binding with an empty algorithm or value.
237
- * @param {SoftBinding} binding
238
- */
239
- constructor(binding) {
240
- const ret = wasm.heldbinder_new(binding);
241
- if (ret[2]) throw takeFromExternrefTable0(ret[1]);
242
- this.__wbg_ptr = ret[0];
243
- HeldBinderFinalization.register(this, this.__wbg_ptr, this);
244
- return this;
245
- }
246
- };
247
- if (Symbol.dispose) HeldBinder.prototype[Symbol.dispose] = HeldBinder.prototype.free;
248
119
  var IntoUnderlyingByteSource = class {
249
120
  __destroy_into_raw() {
250
121
  const ptr = this.__wbg_ptr;
@@ -348,55 +219,9 @@ var IntoUnderlyingSource = class {
348
219
  };
349
220
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
350
221
  /**
351
- * The SDK's local ISCC Image-Code binder, for a standalone `derive`: `new IsccBinder()`, the
352
- * spelling the native lane uses. A verify takes it as data, `{ kind: "iscc" }`, in
353
- * `recovery.binders`, because a class cannot cross into a worker.
354
- *
355
- * Vendor watermark detection is repository-side in this SDK: configured detectors participate in
356
- * `verify` through `byContent`, while a held binder covers values already available to the caller.
357
- */
358
- var IsccBinder = class {
359
- __destroy_into_raw() {
360
- const ptr = this.__wbg_ptr;
361
- this.__wbg_ptr = 0;
362
- IsccBinderFinalization.unregister(this);
363
- return ptr;
364
- }
365
- free() {
366
- const ptr = this.__destroy_into_raw();
367
- wasm.__wbg_isccbinder_free(ptr, 0);
368
- }
369
- /**
370
- * Derive the asset's ISCC standalone; `undefined` when the format yields none.
371
- *
372
- * # Errors
373
- *
374
- * Throws on malformed or unreadable input.
375
- * @param {RangeSource} content
376
- * @param {DeriveOptions} options
377
- * @returns {Promise<SoftBinding | undefined>}
378
- */
379
- derive(content, options) {
380
- return wasm.isccbinder_derive(this.__wbg_ptr, content, options);
381
- }
382
- constructor() {
383
- const ret = wasm.isccbinder_new();
384
- this.__wbg_ptr = ret;
385
- IsccBinderFinalization.register(this, this.__wbg_ptr, this);
386
- return this;
387
- }
388
- };
389
- if (Symbol.dispose) IsccBinder.prototype[Symbol.dispose] = IsccBinder.prototype.free;
390
- /**
391
- * An in-memory [`RangeSource`](crate::wasm::RangeInput), for a caller that already holds the whole
392
- * asset as bytes.
393
- *
394
- * # Size ceiling
395
- *
396
- * The constructor copies the bytes into wasm linear memory, which is 32-bit addressed, so the
397
- * asset and everything else the module allocates share a 4 GiB ceiling (a browser tab reaches its
398
- * own memory limit well before that). [`BytesSource`] takes the same bytes without the copy, and
399
- * [`BlobSource`] holds nothing at all.
222
+ * A `RangeSource` over bytes the caller already holds, read in place: the array stays on the JS
223
+ * side and only the window the SDK asks for crosses, so nothing is resident here and linear
224
+ * memory's 4 GiB ceiling never applies to the asset.
400
225
  */
401
226
  var MemorySource = class {
402
227
  __destroy_into_raw() {
@@ -419,9 +244,7 @@ var MemorySource = class {
419
244
  * @param {Uint8Array} data
420
245
  */
421
246
  constructor(data) {
422
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
423
- const len0 = WASM_VECTOR_LEN;
424
- const ret = wasm.memorysource_new(ptr0, len0);
247
+ const ret = wasm.memorysource_new(data);
425
248
  this.__wbg_ptr = ret;
426
249
  MemorySourceFinalization.register(this, this.__wbg_ptr, this);
427
250
  return this;
@@ -458,8 +281,8 @@ var StreamSession = class StreamSession {
458
281
  wasm.__wbg_streamsession_free(ptr, 0);
459
282
  }
460
283
  /**
461
- * Everything this stream's init segments have registered, as CBOR for another node to
462
- * `StreamVerifier.resume` from.
284
+ * This stream's id and everything its init segments have registered, as CBOR for another
285
+ * node to `StreamVerifier.resume` from.
463
286
  *
464
287
  * The one piece of stream state that leaves the SDK, and only because a clustered
465
288
  * verifier needs it: the init URL is overwritten on rotation, so a node joining during
@@ -486,11 +309,11 @@ var StreamSession = class StreamSession {
486
309
  *
487
310
  * Throws an `SdkError` on parse or signature failure, or when a media segment arrives
488
311
  * before any init was processed for the stream.
489
- * @param {RangeSource} data
312
+ * @param {RangeSource} source
490
313
  * @returns {Promise<SegmentValidation>}
491
314
  */
492
- validate(data) {
493
- return wasm.streamsession_validate(this.__wbg_ptr, data);
315
+ validate(source) {
316
+ return wasm.streamsession_validate(this.__wbg_ptr, source);
494
317
  }
495
318
  };
496
319
  if (Symbol.dispose) StreamSession.prototype[Symbol.dispose] = StreamSession.prototype.free;
@@ -526,45 +349,135 @@ var StreamVerifier = class StreamVerifier {
526
349
  return StreamVerifier.__wrap(ret[0]);
527
350
  }
528
351
  /**
529
- * Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
352
+ * Open the stream `id` for validation, handing back a `StreamSession` to feed segments to.
530
353
  *
531
354
  * No I/O: the handle carries the id so it cannot be mistyped or confused with another
532
355
  * stream's, and classification still happens per segment. Opening one id twice hands
533
356
  * back the same live session, so a component that remounts keeps the state its earlier
534
357
  * handle accumulated.
535
- * @param {string} stream_id
358
+ * @param {string} id
536
359
  * @returns {StreamSession}
537
360
  */
538
- open(stream_id) {
539
- const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
361
+ open(id) {
362
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
540
363
  const len0 = WASM_VECTOR_LEN;
541
364
  const ret = wasm.streamverifier_open(this.__wbg_ptr, ptr0, len0);
542
365
  return StreamSession.__wrap(ret);
543
366
  }
544
367
  /**
545
- * Open `stream_id` on the state another node exported, merged into whatever this one
546
- * holds for that id already.
368
+ * Open the stream another node exported, its state merged into whatever this one holds
369
+ * for that stream already.
547
370
  *
548
371
  * # Errors
549
372
  *
550
- * Throws an `SdkError` (`STREAM_INVALID`) when `state` is not a value
551
- * `StreamSession.export` produced, or carries a version this SDK no longer reads.
552
- * @param {string} stream_id
373
+ * Throws an `SdkError` with a field violation at `state` when it is not a value
374
+ * `StreamSession.export` produced (`state.malformed`), or one of another export version
375
+ * (`state.version`).
553
376
  * @param {Uint8Array} state
554
- * @returns {StreamSession}
377
+ * @returns {Promise<StreamSession>}
555
378
  */
556
- resume(stream_id, state) {
557
- const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
379
+ resume(state) {
380
+ const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
558
381
  const len0 = WASM_VECTOR_LEN;
559
- const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
560
- const len1 = WASM_VECTOR_LEN;
561
- const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0, ptr1, len1);
562
- if (ret[2]) throw takeFromExternrefTable0(ret[1]);
563
- return StreamSession.__wrap(ret[0]);
382
+ return wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0);
564
383
  }
565
384
  };
566
385
  if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
567
386
  /**
387
+ * One `verify` result held with the stores it read: `report` is the data, and `resource` reads a
388
+ * thumbnail from credential `credential` (its position in `report.credentials`) by the
389
+ * `identifier` of a resource reference in its manifest. A class rather than a field of the
390
+ * report because a store cannot be serialized, and one handle per verify is what a worker can
391
+ * proxy (a class nested in the report cannot cross a thread).
392
+ */
393
+ var Verification = class Verification {
394
+ static __wrap(ptr) {
395
+ const obj = Object.create(Verification.prototype);
396
+ obj.__wbg_ptr = ptr;
397
+ VerificationFinalization.register(obj, obj.__wbg_ptr, obj);
398
+ return obj;
399
+ }
400
+ __destroy_into_raw() {
401
+ const ptr = this.__wbg_ptr;
402
+ this.__wbg_ptr = 0;
403
+ VerificationFinalization.unregister(this);
404
+ return ptr;
405
+ }
406
+ free() {
407
+ const ptr = this.__destroy_into_raw();
408
+ wasm.__wbg_verification_free(ptr, 0);
409
+ }
410
+ /**
411
+ * The report: credentials, recovery, golden flow and verdict.
412
+ * @returns {AssetVerification}
413
+ */
414
+ get report() {
415
+ return wasm.verification_report(this.__wbg_ptr);
416
+ }
417
+ /**
418
+ * The bytes of one resource credential `credential` holds, or `undefined`.
419
+ *
420
+ * # Errors
421
+ *
422
+ * Throws `READER_INVALID` when the store holds the resource but cannot produce it, and
423
+ * `undefined` for a `credential` out of range.
424
+ * @param {number} credential
425
+ * @param {string} uri
426
+ * @returns {Uint8Array | undefined}
427
+ */
428
+ resource(credential, uri) {
429
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
430
+ const len0 = WASM_VECTOR_LEN;
431
+ const ret = wasm.verification_resource(this.__wbg_ptr, credential, ptr0, len0);
432
+ if (ret[3]) throw takeFromExternrefTable0(ret[2]);
433
+ let v2;
434
+ if (ret[0] !== 0) {
435
+ v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
436
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
437
+ }
438
+ return v2;
439
+ }
440
+ };
441
+ if (Symbol.dispose) Verification.prototype[Symbol.dispose] = Verification.prototype.free;
442
+ /**
443
+ * The values this SDK computes for `alg` over `source`, `[]` when it finds none. `format` is
444
+ * the asset's media type; omitted, the bytes name it.
445
+ *
446
+ * # Errors
447
+ *
448
+ * Throws on an algorithm this SDK computes no value of, a `format` that is no media type or that
449
+ * the bytes contradict, an unreadable source, or no trustworthy answer.
450
+ * @param {string} alg
451
+ * @param {RangeSource} source
452
+ * @param {string | null} [format]
453
+ * @returns {Promise<Block[]>}
454
+ */
455
+ function computeSoftBinding(alg, source, format) {
456
+ const ptr0 = passStringToWasm0(alg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
457
+ const len0 = WASM_VECTOR_LEN;
458
+ var ptr1 = isLikeNone(format) ? 0 : passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
459
+ var len1 = WASM_VECTOR_LEN;
460
+ return wasm.computeSoftBinding(ptr0, len0, source, ptr1, len1);
461
+ }
462
+ /**
463
+ * PEM trust anchor for the Limbo Integrity development signing environment, **development
464
+ * only**, no security guarantees: put it in `trust.anchors` for a development build, never in a
465
+ * release.
466
+ * @returns {string}
467
+ */
468
+ function devCa() {
469
+ let deferred1_0;
470
+ let deferred1_1;
471
+ try {
472
+ const ret = wasm.devCa();
473
+ deferred1_0 = ret[0];
474
+ deferred1_1 = ret[1];
475
+ return getStringFromWasm0(ret[0], ret[1]);
476
+ } finally {
477
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
478
+ }
479
+ }
480
+ /**
568
481
  * Parse a detached C2PA manifest store: a `.c2pa` sidecar, or the bytes a repository serves for a
569
482
  * manifest id.
570
483
  *
@@ -575,69 +488,33 @@ if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.pr
575
488
  *
576
489
  * # Errors
577
490
  *
578
- * 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.
579
492
  * @param {Uint8Array} manifest
580
- * @returns {import('@contentauth/c2pa-types').ManifestStore}
493
+ * @returns {Promise<import('@contentauth/c2pa-types').ManifestStore>}
581
494
  */
582
495
  function parse(manifest) {
583
496
  const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
584
497
  const len0 = WASM_VECTOR_LEN;
585
- const ret = wasm.parse(ptr0, len0);
586
- if (ret[2]) throw takeFromExternrefTable0(ret[1]);
587
- return takeFromExternrefTable0(ret[0]);
498
+ return wasm.parse(ptr0, len0);
588
499
  }
589
500
  /**
590
501
  * The bytes of one resource in a detached manifest store, or `undefined` when it holds none
591
- * under `uri`.
592
- *
593
- * `uri` is the `identifier` on a resource reference the store carries, so walking the chain in
594
- * the parsed store is what produces it: any manifest's claim thumbnail, including a non-active
595
- * one, and any ingredient's. Render it with the `format` beside that identifier. A `uri` naming a
596
- * manifest rather than a resource answers that manifest's own JUMBF, so pass what a reference
597
- * states, never a bare label.
502
+ * under `uri`: the `identifier` on a resource reference the parsed store carries.
598
503
  *
599
504
  * # Errors
600
505
  *
601
- * 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
602
507
  * holds the resource but cannot produce it.
603
508
  * @param {Uint8Array} manifest
604
509
  * @param {string} uri
605
- * @returns {Uint8Array | undefined}
510
+ * @returns {Promise<Uint8Array | undefined>}
606
511
  */
607
512
  function resource(manifest, uri) {
608
513
  const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
609
514
  const len0 = WASM_VECTOR_LEN;
610
515
  const ptr1 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
611
516
  const len1 = WASM_VECTOR_LEN;
612
- const ret = wasm.resource(ptr0, len0, ptr1, len1);
613
- if (ret[3]) throw takeFromExternrefTable0(ret[2]);
614
- let v3;
615
- if (ret[0] !== 0) {
616
- v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
617
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
618
- }
619
- return v3;
620
- }
621
- /**
622
- * Every thumbnail the store references, by the `identifier` it references them under: each
623
- * manifest's claim thumbnail and each ingredient's, whichever manifest carries them.
624
- *
625
- * One parse for the whole set, where `resource` pays one per call, so a chain view asks once
626
- * instead of once per tile. Render each one as the `format` beside its identifier. A reference
627
- * the store cannot produce is left out rather than failing the set.
628
- *
629
- * # Errors
630
- *
631
- * Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
632
- * @param {Uint8Array} manifest
633
- * @returns {Record<string, Uint8Array>}
634
- */
635
- function thumbnails(manifest) {
636
- const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
637
- const len0 = WASM_VECTOR_LEN;
638
- const ret = wasm.thumbnails(ptr0, len0);
639
- if (ret[2]) throw takeFromExternrefTable0(ret[1]);
640
- return takeFromExternrefTable0(ret[0]);
517
+ return wasm.resource(ptr0, len0, ptr1, len1);
641
518
  }
642
519
  function __wbg_get_imports() {
643
520
  return {
@@ -724,6 +601,12 @@ function __wbg_get_imports() {
724
601
  __wbg_abort_eee9248a6d680839: function(arg0, arg1) {
725
602
  arg0.abort(arg1);
726
603
  },
604
+ __wbg_aborted_2b7b403d16663f24: function(arg0) {
605
+ return arg0.aborted;
606
+ },
607
+ __wbg_any_a57fdb241e47190d: function(arg0) {
608
+ return AbortSignal.any(arg0);
609
+ },
727
610
  __wbg_append_01c74e5c6b58aa64: function() {
728
611
  return handleError(function(arg0, arg1, arg2, arg3, arg4) {
729
612
  arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
@@ -734,6 +617,9 @@ function __wbg_get_imports() {
734
617
  return arg0.arrayBuffer();
735
618
  }, arguments);
736
619
  },
620
+ __wbg_assign_fd82cd5b89efb160: function(arg0, arg1) {
621
+ return Object.assign(arg0, arg1);
622
+ },
737
623
  __wbg_body_18c9f2ac15ead4b2: function(arg0) {
738
624
  const ret = arg0.body;
739
625
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -1031,6 +917,9 @@ function __wbg_get_imports() {
1031
917
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
1032
918
  return arg0.now();
1033
919
  },
920
+ __wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
921
+ return Array.of(arg0, arg1);
922
+ },
1034
923
  __wbg_parse_1c0d8a8656d7e016: function() {
1035
924
  return handleError(function(arg0, arg1) {
1036
925
  return JSON.parse(getStringFromWasm0(arg0, arg1));
@@ -1056,6 +945,9 @@ function __wbg_get_imports() {
1056
945
  __wbg_read_8afa15f12a160ef8: function(arg0) {
1057
946
  return arg0.read();
1058
947
  },
948
+ __wbg_reject_90df95b492dd8563: function(arg0) {
949
+ return Promise.reject(arg0);
950
+ },
1059
951
  __wbg_releaseLock_5b92874cad775644: function(arg0) {
1060
952
  arg0.releaseLock();
1061
953
  },
@@ -1084,11 +976,6 @@ function __wbg_get_imports() {
1084
976
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1085
977
  arg0[arg1] = arg2;
1086
978
  },
1087
- __wbg_set_8535240470bf2500: function() {
1088
- return handleError(function(arg0, arg1, arg2) {
1089
- return Reflect.set(arg0, arg1, arg2);
1090
- }, arguments);
1091
- },
1092
979
  __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
1093
980
  arg0[arg1 >>> 0] = arg2;
1094
981
  },
@@ -1110,6 +997,12 @@ function __wbg_get_imports() {
1110
997
  __wbg_set_mode_66c79886ad78fc05: function(arg0, arg1) {
1111
998
  arg0.mode = __wbindgen_enum_RequestMode[arg1];
1112
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
+ },
1113
1006
  __wbg_set_signal_c4ef8faddb4c1446: function(arg0, arg1) {
1114
1007
  arg0.signal = arg1;
1115
1008
  },
@@ -1150,6 +1043,9 @@ function __wbg_get_imports() {
1150
1043
  __wbg_status_c45b3b9b3033184a: function(arg0) {
1151
1044
  return arg0.status;
1152
1045
  },
1046
+ __wbg_streamsession_new: function(arg0) {
1047
+ return StreamSession.__wrap(arg0);
1048
+ },
1153
1049
  __wbg_stringify_b54333f60f1e4dad: function() {
1154
1050
  return handleError(function(arg0) {
1155
1051
  return JSON.stringify(arg0);
@@ -1164,6 +1060,9 @@ function __wbg_get_imports() {
1164
1060
  __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
1165
1061
  return arg0.then(arg1);
1166
1062
  },
1063
+ __wbg_timeout_c971ded6d319fad2: function(arg0) {
1064
+ return AbortSignal.timeout(arg0 >>> 0);
1065
+ },
1167
1066
  __wbg_url_abdb8fb08377f8c0: function(arg0, arg1) {
1168
1067
  const ret = arg1.url;
1169
1068
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1174,6 +1073,9 @@ function __wbg_get_imports() {
1174
1073
  __wbg_value_a5d5488a9589444a: function(arg0) {
1175
1074
  return arg0.value;
1176
1075
  },
1076
+ __wbg_verification_new: function(arg0) {
1077
+ return Verification.__wrap(arg0);
1078
+ },
1177
1079
  __wbg_view_21f1d4a4f175dfa9: function(arg0) {
1178
1080
  const ret = arg0.view;
1179
1081
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -1182,10 +1084,10 @@ function __wbg_get_imports() {
1182
1084
  return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1);
1183
1085
  },
1184
1086
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1185
- return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
1087
+ return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbfbf6526ca40dbc0);
1186
1088
  },
1187
1089
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1188
- return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5);
1090
+ return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479);
1189
1091
  },
1190
1092
  __wbindgen_cast_0000000000000004: function(arg0) {
1191
1093
  return arg0;
@@ -1202,6 +1104,16 @@ function __wbg_get_imports() {
1202
1104
  __wbindgen_cast_0000000000000008: function(arg0) {
1203
1105
  return BigInt.asUintN(64, arg0);
1204
1106
  },
1107
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
1108
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
1109
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
1110
+ return v0;
1111
+ },
1112
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
1113
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1114
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
1115
+ return v0;
1116
+ },
1205
1117
  __wbindgen_init_externref_table: function() {
1206
1118
  const table = wasm.__wbindgen_externrefs;
1207
1119
  const offset = table.grow(4);
@@ -1214,11 +1126,11 @@ function __wbg_get_imports() {
1214
1126
  }
1215
1127
  };
1216
1128
  }
1217
- function wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1) {
1218
- wasm.wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1);
1129
+ function wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479(arg0, arg1) {
1130
+ wasm.wasm_bindgen__convert__closures_____invoke__h66de60f9da4a5479(arg0, arg1);
1219
1131
  }
1220
- function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
1221
- 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);
1222
1134
  }
1223
1135
  function wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2) {
1224
1136
  const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2);
@@ -1247,6 +1159,11 @@ const __wbindgen_enum_RequestMode = [
1247
1159
  "cors",
1248
1160
  "navigate"
1249
1161
  ];
1162
+ const __wbindgen_enum_RequestRedirect = [
1163
+ "follow",
1164
+ "error",
1165
+ "manual"
1166
+ ];
1250
1167
  const AssetVerifierFinalization = typeof FinalizationRegistry === "undefined" ? {
1251
1168
  register: () => {},
1252
1169
  unregister: () => {}
@@ -1255,14 +1172,6 @@ const BlobSourceFinalization = typeof FinalizationRegistry === "undefined" ? {
1255
1172
  register: () => {},
1256
1173
  unregister: () => {}
1257
1174
  } : new FinalizationRegistry((ptr) => wasm.__wbg_blobsource_free(ptr, 1));
1258
- const BytesSourceFinalization = typeof FinalizationRegistry === "undefined" ? {
1259
- register: () => {},
1260
- unregister: () => {}
1261
- } : new FinalizationRegistry((ptr) => wasm.__wbg_bytessource_free(ptr, 1));
1262
- const HeldBinderFinalization = typeof FinalizationRegistry === "undefined" ? {
1263
- register: () => {},
1264
- unregister: () => {}
1265
- } : new FinalizationRegistry((ptr) => wasm.__wbg_heldbinder_free(ptr, 1));
1266
1175
  const IntoUnderlyingByteSourceFinalization = typeof FinalizationRegistry === "undefined" ? {
1267
1176
  register: () => {},
1268
1177
  unregister: () => {}
@@ -1275,10 +1184,6 @@ const IntoUnderlyingSourceFinalization = typeof FinalizationRegistry === "undefi
1275
1184
  register: () => {},
1276
1185
  unregister: () => {}
1277
1186
  } : new FinalizationRegistry((ptr) => wasm.__wbg_intounderlyingsource_free(ptr, 1));
1278
- const IsccBinderFinalization = typeof FinalizationRegistry === "undefined" ? {
1279
- register: () => {},
1280
- unregister: () => {}
1281
- } : new FinalizationRegistry((ptr) => wasm.__wbg_isccbinder_free(ptr, 1));
1282
1187
  const MemorySourceFinalization = typeof FinalizationRegistry === "undefined" ? {
1283
1188
  register: () => {},
1284
1189
  unregister: () => {}
@@ -1291,6 +1196,10 @@ const StreamVerifierFinalization = typeof FinalizationRegistry === "undefined" ?
1291
1196
  register: () => {},
1292
1197
  unregister: () => {}
1293
1198
  } : new FinalizationRegistry((ptr) => wasm.__wbg_streamverifier_free(ptr, 1));
1199
+ const VerificationFinalization = typeof FinalizationRegistry === "undefined" ? {
1200
+ register: () => {},
1201
+ unregister: () => {}
1202
+ } : new FinalizationRegistry((ptr) => wasm.__wbg_verification_free(ptr, 1));
1294
1203
  function addToExternrefTable0(obj) {
1295
1204
  const idx = wasm.__externref_table_alloc();
1296
1205
  wasm.__wbindgen_externrefs.set(idx, obj);
@@ -1334,6 +1243,14 @@ function debugString(val) {
1334
1243
  if (val instanceof Error) return `${val.name}: ${val.message}\n${val.stack}`;
1335
1244
  return className;
1336
1245
  }
1246
+ function getArrayJsValueFromWasm0(ptr, len) {
1247
+ ptr = ptr >>> 0;
1248
+ const mem = getDataViewMemory0();
1249
+ const result = [];
1250
+ for (let i = ptr; i < ptr + 4 * len; i += 4) result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1251
+ wasm.__externref_drop_slice(ptr, len);
1252
+ return result;
1253
+ }
1337
1254
  function getArrayU8FromWasm0(ptr, len) {
1338
1255
  ptr = ptr >>> 0;
1339
1256
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -1512,7 +1429,7 @@ async function __wbg_init(module_or_path) {
1512
1429
  * a slice and a local file. Choosing the store is all that is left here.
1513
1430
  */
1514
1431
  function source(asset) {
1515
- return asset instanceof Blob ? new BlobSource(asset) : new BytesSource(asset instanceof Uint8Array ? asset : new Uint8Array(asset));
1432
+ return asset instanceof Blob ? new BlobSource(asset) : new MemorySource(asset instanceof Uint8Array ? asset : new Uint8Array(asset));
1516
1433
  }
1517
1434
  /**
1518
1435
  * The caller's asset as the bytes a manifest read takes. A `Blob` is read here rather than in the
@@ -1522,13 +1439,6 @@ async function bytes(asset) {
1522
1439
  if (asset instanceof Blob) return new Uint8Array(await asset.arrayBuffer());
1523
1440
  return asset instanceof Uint8Array ? asset : new Uint8Array(asset);
1524
1441
  }
1525
- function binder(spec) {
1526
- switch (spec.kind) {
1527
- case "iscc": return new IsccBinder();
1528
- case "held": return new HeldBinder(spec.binding);
1529
- default: throw new TypeError(`unknown binder: ${JSON.stringify(spec)}`);
1530
- }
1531
- }
1532
1442
  /**
1533
1443
  * A wasm object held in this thread on the caller's behalf.
1534
1444
  *
@@ -1549,10 +1459,23 @@ var Handle = class {
1549
1459
  this.inner.free();
1550
1460
  }
1551
1461
  };
1462
+ /**
1463
+ * One verify result. A wasm class cannot cross the thread, so the report and the stores behind it
1464
+ * stay here and the caller holds this: `report()` is the data, `resource()` reads a thumbnail from
1465
+ * a credential by its position in `report().credentials`.
1466
+ */
1467
+ var VerificationHandle = class extends Handle {
1468
+ report() {
1469
+ return this.inner.report;
1470
+ }
1471
+ resource(credential, uri) {
1472
+ return this.inner.resource(credential, uri);
1473
+ }
1474
+ };
1552
1475
  var AssetVerifierHandle = class extends Handle {
1553
1476
  /** `recovery` is what this verify may do to recover a manifest, as the direct import takes it. */
1554
- verify(asset, recovery) {
1555
- return 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)));
1556
1479
  }
1557
1480
  };
1558
1481
  /** One stream being validated. Dropping the handle releases the session it accumulated. */
@@ -1565,13 +1488,31 @@ var StreamSessionHandle = class extends Handle {
1565
1488
  }
1566
1489
  };
1567
1490
  var StreamVerifierHandle = class extends Handle {
1568
- open(streamId) {
1569
- return proxy(new StreamSessionHandle(this.inner.open(streamId)));
1491
+ open(id) {
1492
+ return proxy(new StreamSessionHandle(this.inner.open(id)));
1570
1493
  }
1571
- resume(streamId, state) {
1572
- return proxy(new StreamSessionHandle(this.inner.resume(streamId, state)));
1494
+ async resume(state) {
1495
+ return proxy(new StreamSessionHandle(await this.inner.resume(state)));
1573
1496
  }
1574
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
+ });
1575
1516
  let ready;
1576
1517
  /** The module's own surface, name for name with the direct import. */
1577
1518
  const sdk = {
@@ -1585,12 +1526,13 @@ const sdk = {
1585
1526
  },
1586
1527
  AssetVerifier: proxy({ create: (options) => proxy(new AssetVerifierHandle(AssetVerifier.create(options))) }),
1587
1528
  StreamVerifier: proxy({ create: (options) => proxy(new StreamVerifierHandle(StreamVerifier.create(options))) }),
1588
- Binder: proxy({
1589
1529
  /**
1590
- * Derive one binder's binding standalone. The binder is built, used and dropped here, so there
1591
- * is no handle to keep: what the caller wants back is the binding.
1530
+ * The values this SDK computes for `alg` over the asset, `[]` when it finds none. `format` is the
1531
+ * asset's media type; omitted, the bytes name it.
1592
1532
  */
1593
- derive: (spec, content, options) => binder(spec).derive(source(content), options) }),
1533
+ computeSoftBinding(alg, asset, format) {
1534
+ return computeSoftBinding(alg, source(asset), format);
1535
+ },
1594
1536
  /**
1595
1537
  * Read a detached manifest store. Contents, not a verdict: with no asset there is no hard binding
1596
1538
  * to check, so the store's validation fields state nothing this established.
@@ -1605,20 +1547,11 @@ derive: (spec, content, options) => binder(spec).derive(source(content), options
1605
1547
  async resource(manifest, uri) {
1606
1548
  return resource(await bytes(manifest), uri);
1607
1549
  },
1608
- /**
1609
- * Every thumbnail the store references, by the identifier it references them under. One parse
1610
- * and one thread hop for the whole set, where `resource` pays both per call.
1611
- */
1612
- async thumbnails(manifest) {
1613
- return thumbnails(await bytes(manifest));
1614
- },
1615
- C2PA_TRUST_LIST,
1616
- C2PA_TSA_TRUST_LIST,
1617
- DEV_CA,
1550
+ devCa,
1618
1551
  close() {
1619
1552
  setTimeout(() => self.close(), 0);
1620
1553
  }
1621
1554
  };
1622
1555
  expose(sdk);
1623
1556
  //#endregion
1624
- export { AssetVerifierHandle, Handle, StreamSessionHandle, StreamVerifierHandle };
1557
+ export { AssetVerifierHandle, Handle, StreamSessionHandle, StreamVerifierHandle, VerificationHandle };