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

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.
@@ -37,24 +37,23 @@ var AssetVerifier = class AssetVerifier {
37
37
  *
38
38
  * # Errors
39
39
  *
40
- * Throws on a malformed `input`, a repository (or binder) failure, or a validation
40
+ * Throws on a malformed `source`, a repository (or engine) failure, or a validation
41
41
  * failure.
42
- * @param {RangeSource} input
42
+ * @param {RangeSource} source
43
43
  * @param {Recovery | null} [recovery]
44
- * @returns {Promise<AssetVerification>}
44
+ * @returns {Promise<Verification>}
45
45
  */
46
- verify(input, recovery) {
47
- return wasm.assetverifier_verify(this.__wbg_ptr, input, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery));
46
+ verify(source, recovery) {
47
+ return wasm.assetverifier_verify(this.__wbg_ptr, source, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery));
48
48
  }
49
49
  };
50
50
  if (Symbol.dispose) AssetVerifier.prototype[Symbol.dispose] = AssetVerifier.prototype.free;
51
51
  /**
52
- * A [`RangeSource`](crate::wasm::RangeInput) over a `Blob`: a `File` off an `<input>`, a
52
+ * A `RangeSource` over a `Blob`: a `File` off an `<input>`, a
53
53
  * `Response.blob()`, a handle from the file system access API.
54
54
  *
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.
55
+ * It holds no bytes at all. The SDK reads one slice at a time, so an asset larger than the tab's
56
+ * memory verifies at the disk's speed rather than the heap's.
58
57
  *
59
58
  * # Worker only
60
59
  *
@@ -113,138 +112,6 @@ var BlobSource = class {
113
112
  }
114
113
  };
115
114
  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
115
  var IntoUnderlyingByteSource = class {
249
116
  __destroy_into_raw() {
250
117
  const ptr = this.__wbg_ptr;
@@ -348,55 +215,9 @@ var IntoUnderlyingSource = class {
348
215
  };
349
216
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
350
217
  /**
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.
218
+ * A `RangeSource` over bytes the caller already holds, read in place: the array stays on the JS
219
+ * side and only the window the SDK asks for crosses, so nothing is resident here and linear
220
+ * memory's 4 GiB ceiling never applies to the asset.
400
221
  */
401
222
  var MemorySource = class {
402
223
  __destroy_into_raw() {
@@ -419,9 +240,7 @@ var MemorySource = class {
419
240
  * @param {Uint8Array} data
420
241
  */
421
242
  constructor(data) {
422
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
423
- const len0 = WASM_VECTOR_LEN;
424
- const ret = wasm.memorysource_new(ptr0, len0);
243
+ const ret = wasm.memorysource_new(data);
425
244
  this.__wbg_ptr = ret;
426
245
  MemorySourceFinalization.register(this, this.__wbg_ptr, this);
427
246
  return this;
@@ -458,8 +277,8 @@ var StreamSession = class StreamSession {
458
277
  wasm.__wbg_streamsession_free(ptr, 0);
459
278
  }
460
279
  /**
461
- * Everything this stream's init segments have registered, as CBOR for another node to
462
- * `StreamVerifier.resume` from.
280
+ * This stream's id and everything its init segments have registered, as CBOR for another
281
+ * node to `StreamVerifier.resume` from.
463
282
  *
464
283
  * The one piece of stream state that leaves the SDK, and only because a clustered
465
284
  * verifier needs it: the init URL is overwritten on rotation, so a node joining during
@@ -486,11 +305,11 @@ var StreamSession = class StreamSession {
486
305
  *
487
306
  * Throws an `SdkError` on parse or signature failure, or when a media segment arrives
488
307
  * before any init was processed for the stream.
489
- * @param {RangeSource} data
308
+ * @param {RangeSource} source
490
309
  * @returns {Promise<SegmentValidation>}
491
310
  */
492
- validate(data) {
493
- return wasm.streamsession_validate(this.__wbg_ptr, data);
311
+ validate(source) {
312
+ return wasm.streamsession_validate(this.__wbg_ptr, source);
494
313
  }
495
314
  };
496
315
  if (Symbol.dispose) StreamSession.prototype[Symbol.dispose] = StreamSession.prototype.free;
@@ -526,45 +345,137 @@ var StreamVerifier = class StreamVerifier {
526
345
  return StreamVerifier.__wrap(ret[0]);
527
346
  }
528
347
  /**
529
- * Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
348
+ * Open the stream `id` for validation, handing back a `StreamSession` to feed segments to.
530
349
  *
531
350
  * No I/O: the handle carries the id so it cannot be mistyped or confused with another
532
351
  * stream's, and classification still happens per segment. Opening one id twice hands
533
352
  * back the same live session, so a component that remounts keeps the state its earlier
534
353
  * handle accumulated.
535
- * @param {string} stream_id
354
+ * @param {string} id
536
355
  * @returns {StreamSession}
537
356
  */
538
- open(stream_id) {
539
- const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
357
+ open(id) {
358
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
540
359
  const len0 = WASM_VECTOR_LEN;
541
360
  const ret = wasm.streamverifier_open(this.__wbg_ptr, ptr0, len0);
542
361
  return StreamSession.__wrap(ret);
543
362
  }
544
363
  /**
545
- * Open `stream_id` on the state another node exported, merged into whatever this one
546
- * holds for that id already.
364
+ * Open the stream another node exported, its state merged into whatever this one holds
365
+ * for that stream already.
547
366
  *
548
367
  * # Errors
549
368
  *
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
369
+ * Throws an `SdkError` with a field violation at `state` when it is not a value
370
+ * `StreamSession.export` produced (`state.malformed`), or one of another export version
371
+ * (`state.version`).
553
372
  * @param {Uint8Array} state
554
373
  * @returns {StreamSession}
555
374
  */
556
- resume(stream_id, state) {
557
- const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
375
+ resume(state) {
376
+ const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
558
377
  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);
378
+ const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0);
562
379
  if (ret[2]) throw takeFromExternrefTable0(ret[1]);
563
380
  return StreamSession.__wrap(ret[0]);
564
381
  }
565
382
  };
566
383
  if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
567
384
  /**
385
+ * One `verify` result held with the stores it read: `report` is the data, and `resource` reads a
386
+ * thumbnail from credential `credential` (its position in `report.credentials`) by the
387
+ * `identifier` of a resource reference in its manifest. A class rather than a field of the
388
+ * report because a store cannot be serialized, and one handle per verify is what a worker can
389
+ * proxy (a class nested in the report cannot cross a thread).
390
+ */
391
+ var Verification = class Verification {
392
+ static __wrap(ptr) {
393
+ const obj = Object.create(Verification.prototype);
394
+ obj.__wbg_ptr = ptr;
395
+ VerificationFinalization.register(obj, obj.__wbg_ptr, obj);
396
+ return obj;
397
+ }
398
+ __destroy_into_raw() {
399
+ const ptr = this.__wbg_ptr;
400
+ this.__wbg_ptr = 0;
401
+ VerificationFinalization.unregister(this);
402
+ return ptr;
403
+ }
404
+ free() {
405
+ const ptr = this.__destroy_into_raw();
406
+ wasm.__wbg_verification_free(ptr, 0);
407
+ }
408
+ /**
409
+ * The report: credentials, recovery, golden flow and verdict.
410
+ * @returns {AssetVerification}
411
+ */
412
+ get report() {
413
+ return wasm.verification_report(this.__wbg_ptr);
414
+ }
415
+ /**
416
+ * The bytes of one resource credential `credential` holds, or `undefined`.
417
+ *
418
+ * # Errors
419
+ *
420
+ * Throws `READER_INVALID` when the store holds the resource but cannot produce it, and
421
+ * `undefined` for a `credential` out of range.
422
+ * @param {number} credential
423
+ * @param {string} uri
424
+ * @returns {Uint8Array | undefined}
425
+ */
426
+ resource(credential, uri) {
427
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
428
+ const len0 = WASM_VECTOR_LEN;
429
+ const ret = wasm.verification_resource(this.__wbg_ptr, credential, ptr0, len0);
430
+ if (ret[3]) throw takeFromExternrefTable0(ret[2]);
431
+ let v2;
432
+ if (ret[0] !== 0) {
433
+ v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
434
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
435
+ }
436
+ return v2;
437
+ }
438
+ };
439
+ if (Symbol.dispose) Verification.prototype[Symbol.dispose] = Verification.prototype.free;
440
+ /**
441
+ * The values this SDK computes for `alg` over `source`, `[]` when it finds none. `format` is
442
+ * the asset's media type; omitted, the bytes name it.
443
+ *
444
+ * # Errors
445
+ *
446
+ * Throws on an algorithm this SDK computes no value of, a `format` that is no media type or that
447
+ * the bytes contradict, an unreadable source, or no trustworthy answer.
448
+ * @param {string} alg
449
+ * @param {RangeSource} source
450
+ * @param {string | null} [format]
451
+ * @returns {Promise<Block[]>}
452
+ */
453
+ function computeSoftBinding(alg, source, format) {
454
+ const ptr0 = passStringToWasm0(alg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
455
+ const len0 = WASM_VECTOR_LEN;
456
+ var ptr1 = isLikeNone(format) ? 0 : passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
457
+ var len1 = WASM_VECTOR_LEN;
458
+ return wasm.computeSoftBinding(ptr0, len0, source, ptr1, len1);
459
+ }
460
+ /**
461
+ * PEM trust anchor for the Limbo Integrity development signing environment, **development
462
+ * only**, no security guarantees: put it in `trust.anchors` for a development build, never in a
463
+ * release.
464
+ * @returns {string}
465
+ */
466
+ function devCa() {
467
+ let deferred1_0;
468
+ let deferred1_1;
469
+ try {
470
+ const ret = wasm.devCa();
471
+ deferred1_0 = ret[0];
472
+ deferred1_1 = ret[1];
473
+ return getStringFromWasm0(ret[0], ret[1]);
474
+ } finally {
475
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
476
+ }
477
+ }
478
+ /**
568
479
  * Parse a detached C2PA manifest store: a `.c2pa` sidecar, or the bytes a repository serves for a
569
480
  * manifest id.
570
481
  *
@@ -582,19 +493,11 @@ if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.pr
582
493
  function parse(manifest) {
583
494
  const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
584
495
  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]);
496
+ return wasm.parse(ptr0, len0);
588
497
  }
589
498
  /**
590
499
  * 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.
500
+ * under `uri`: the `identifier` on a resource reference the parsed store carries.
598
501
  *
599
502
  * # Errors
600
503
  *
@@ -602,42 +505,14 @@ function parse(manifest) {
602
505
  * holds the resource but cannot produce it.
603
506
  * @param {Uint8Array} manifest
604
507
  * @param {string} uri
605
- * @returns {Uint8Array | undefined}
508
+ * @returns {Promise<Uint8Array | undefined>}
606
509
  */
607
510
  function resource(manifest, uri) {
608
511
  const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
609
512
  const len0 = WASM_VECTOR_LEN;
610
513
  const ptr1 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
611
514
  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]);
515
+ return wasm.resource(ptr0, len0, ptr1, len1);
641
516
  }
642
517
  function __wbg_get_imports() {
643
518
  return {
@@ -724,6 +599,12 @@ function __wbg_get_imports() {
724
599
  __wbg_abort_eee9248a6d680839: function(arg0, arg1) {
725
600
  arg0.abort(arg1);
726
601
  },
602
+ __wbg_aborted_2b7b403d16663f24: function(arg0) {
603
+ return arg0.aborted;
604
+ },
605
+ __wbg_any_a57fdb241e47190d: function(arg0) {
606
+ return AbortSignal.any(arg0);
607
+ },
727
608
  __wbg_append_01c74e5c6b58aa64: function() {
728
609
  return handleError(function(arg0, arg1, arg2, arg3, arg4) {
729
610
  arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
@@ -1031,6 +912,9 @@ function __wbg_get_imports() {
1031
912
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
1032
913
  return arg0.now();
1033
914
  },
915
+ __wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
916
+ return Array.of(arg0, arg1);
917
+ },
1034
918
  __wbg_parse_1c0d8a8656d7e016: function() {
1035
919
  return handleError(function(arg0, arg1) {
1036
920
  return JSON.parse(getStringFromWasm0(arg0, arg1));
@@ -1084,11 +968,6 @@ function __wbg_get_imports() {
1084
968
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1085
969
  arg0[arg1] = arg2;
1086
970
  },
1087
- __wbg_set_8535240470bf2500: function() {
1088
- return handleError(function(arg0, arg1, arg2) {
1089
- return Reflect.set(arg0, arg1, arg2);
1090
- }, arguments);
1091
- },
1092
971
  __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
1093
972
  arg0[arg1 >>> 0] = arg2;
1094
973
  },
@@ -1164,6 +1043,9 @@ function __wbg_get_imports() {
1164
1043
  __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
1165
1044
  return arg0.then(arg1);
1166
1045
  },
1046
+ __wbg_timeout_c971ded6d319fad2: function(arg0) {
1047
+ return AbortSignal.timeout(arg0 >>> 0);
1048
+ },
1167
1049
  __wbg_url_abdb8fb08377f8c0: function(arg0, arg1) {
1168
1050
  const ret = arg1.url;
1169
1051
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1174,6 +1056,9 @@ function __wbg_get_imports() {
1174
1056
  __wbg_value_a5d5488a9589444a: function(arg0) {
1175
1057
  return arg0.value;
1176
1058
  },
1059
+ __wbg_verification_new: function(arg0) {
1060
+ return Verification.__wrap(arg0);
1061
+ },
1177
1062
  __wbg_view_21f1d4a4f175dfa9: function(arg0) {
1178
1063
  const ret = arg0.view;
1179
1064
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -1185,7 +1070,7 @@ function __wbg_get_imports() {
1185
1070
  return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
1186
1071
  },
1187
1072
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1188
- return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5);
1073
+ return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846);
1189
1074
  },
1190
1075
  __wbindgen_cast_0000000000000004: function(arg0) {
1191
1076
  return arg0;
@@ -1202,6 +1087,16 @@ function __wbg_get_imports() {
1202
1087
  __wbindgen_cast_0000000000000008: function(arg0) {
1203
1088
  return BigInt.asUintN(64, arg0);
1204
1089
  },
1090
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
1091
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
1092
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
1093
+ return v0;
1094
+ },
1095
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
1096
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1097
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
1098
+ return v0;
1099
+ },
1205
1100
  __wbindgen_init_externref_table: function() {
1206
1101
  const table = wasm.__wbindgen_externrefs;
1207
1102
  const offset = table.grow(4);
@@ -1214,8 +1109,8 @@ function __wbg_get_imports() {
1214
1109
  }
1215
1110
  };
1216
1111
  }
1217
- function wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1) {
1218
- wasm.wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1);
1112
+ function wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1) {
1113
+ wasm.wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1);
1219
1114
  }
1220
1115
  function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
1221
1116
  wasm.wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2);
@@ -1255,14 +1150,6 @@ const BlobSourceFinalization = typeof FinalizationRegistry === "undefined" ? {
1255
1150
  register: () => {},
1256
1151
  unregister: () => {}
1257
1152
  } : 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
1153
  const IntoUnderlyingByteSourceFinalization = typeof FinalizationRegistry === "undefined" ? {
1267
1154
  register: () => {},
1268
1155
  unregister: () => {}
@@ -1275,10 +1162,6 @@ const IntoUnderlyingSourceFinalization = typeof FinalizationRegistry === "undefi
1275
1162
  register: () => {},
1276
1163
  unregister: () => {}
1277
1164
  } : 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
1165
  const MemorySourceFinalization = typeof FinalizationRegistry === "undefined" ? {
1283
1166
  register: () => {},
1284
1167
  unregister: () => {}
@@ -1291,6 +1174,10 @@ const StreamVerifierFinalization = typeof FinalizationRegistry === "undefined" ?
1291
1174
  register: () => {},
1292
1175
  unregister: () => {}
1293
1176
  } : new FinalizationRegistry((ptr) => wasm.__wbg_streamverifier_free(ptr, 1));
1177
+ const VerificationFinalization = typeof FinalizationRegistry === "undefined" ? {
1178
+ register: () => {},
1179
+ unregister: () => {}
1180
+ } : new FinalizationRegistry((ptr) => wasm.__wbg_verification_free(ptr, 1));
1294
1181
  function addToExternrefTable0(obj) {
1295
1182
  const idx = wasm.__externref_table_alloc();
1296
1183
  wasm.__wbindgen_externrefs.set(idx, obj);
@@ -1334,6 +1221,14 @@ function debugString(val) {
1334
1221
  if (val instanceof Error) return `${val.name}: ${val.message}\n${val.stack}`;
1335
1222
  return className;
1336
1223
  }
1224
+ function getArrayJsValueFromWasm0(ptr, len) {
1225
+ ptr = ptr >>> 0;
1226
+ const mem = getDataViewMemory0();
1227
+ const result = [];
1228
+ for (let i = ptr; i < ptr + 4 * len; i += 4) result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1229
+ wasm.__externref_drop_slice(ptr, len);
1230
+ return result;
1231
+ }
1337
1232
  function getArrayU8FromWasm0(ptr, len) {
1338
1233
  ptr = ptr >>> 0;
1339
1234
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -1512,7 +1407,7 @@ async function __wbg_init(module_or_path) {
1512
1407
  * a slice and a local file. Choosing the store is all that is left here.
1513
1408
  */
1514
1409
  function source(asset) {
1515
- return asset instanceof Blob ? new BlobSource(asset) : new BytesSource(asset instanceof Uint8Array ? asset : new Uint8Array(asset));
1410
+ return asset instanceof Blob ? new BlobSource(asset) : new MemorySource(asset instanceof Uint8Array ? asset : new Uint8Array(asset));
1516
1411
  }
1517
1412
  /**
1518
1413
  * The caller's asset as the bytes a manifest read takes. A `Blob` is read here rather than in the
@@ -1522,13 +1417,6 @@ async function bytes(asset) {
1522
1417
  if (asset instanceof Blob) return new Uint8Array(await asset.arrayBuffer());
1523
1418
  return asset instanceof Uint8Array ? asset : new Uint8Array(asset);
1524
1419
  }
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
1420
  /**
1533
1421
  * A wasm object held in this thread on the caller's behalf.
1534
1422
  *
@@ -1549,10 +1437,23 @@ var Handle = class {
1549
1437
  this.inner.free();
1550
1438
  }
1551
1439
  };
1440
+ /**
1441
+ * One verify result. A wasm class cannot cross the thread, so the report and the stores behind it
1442
+ * stay here and the caller holds this: `report()` is the data, `resource()` reads a thumbnail from
1443
+ * a credential by its position in `report().credentials`.
1444
+ */
1445
+ var VerificationHandle = class extends Handle {
1446
+ report() {
1447
+ return this.inner.report;
1448
+ }
1449
+ resource(credential, uri) {
1450
+ return this.inner.resource(credential, uri);
1451
+ }
1452
+ };
1552
1453
  var AssetVerifierHandle = class extends Handle {
1553
1454
  /** `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);
1455
+ async verify(asset, recovery) {
1456
+ return proxy(new VerificationHandle(await this.inner.verify(source(asset), recovery)));
1556
1457
  }
1557
1458
  };
1558
1459
  /** One stream being validated. Dropping the handle releases the session it accumulated. */
@@ -1565,11 +1466,11 @@ var StreamSessionHandle = class extends Handle {
1565
1466
  }
1566
1467
  };
1567
1468
  var StreamVerifierHandle = class extends Handle {
1568
- open(streamId) {
1569
- return proxy(new StreamSessionHandle(this.inner.open(streamId)));
1469
+ open(id) {
1470
+ return proxy(new StreamSessionHandle(this.inner.open(id)));
1570
1471
  }
1571
- resume(streamId, state) {
1572
- return proxy(new StreamSessionHandle(this.inner.resume(streamId, state)));
1472
+ resume(state) {
1473
+ return proxy(new StreamSessionHandle(this.inner.resume(state)));
1573
1474
  }
1574
1475
  };
1575
1476
  let ready;
@@ -1585,12 +1486,13 @@ const sdk = {
1585
1486
  },
1586
1487
  AssetVerifier: proxy({ create: (options) => proxy(new AssetVerifierHandle(AssetVerifier.create(options))) }),
1587
1488
  StreamVerifier: proxy({ create: (options) => proxy(new StreamVerifierHandle(StreamVerifier.create(options))) }),
1588
- Binder: proxy({
1589
1489
  /**
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.
1490
+ * The values this SDK computes for `alg` over the asset, `[]` when it finds none. `format` is the
1491
+ * asset's media type; omitted, the bytes name it.
1592
1492
  */
1593
- derive: (spec, content, options) => binder(spec).derive(source(content), options) }),
1493
+ computeSoftBinding(alg, asset, format) {
1494
+ return computeSoftBinding(alg, source(asset), format);
1495
+ },
1594
1496
  /**
1595
1497
  * Read a detached manifest store. Contents, not a verdict: with no asset there is no hard binding
1596
1498
  * to check, so the store's validation fields state nothing this established.
@@ -1605,20 +1507,11 @@ derive: (spec, content, options) => binder(spec).derive(source(content), options
1605
1507
  async resource(manifest, uri) {
1606
1508
  return resource(await bytes(manifest), uri);
1607
1509
  },
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,
1510
+ devCa,
1618
1511
  close() {
1619
1512
  setTimeout(() => self.close(), 0);
1620
1513
  }
1621
1514
  };
1622
1515
  expose(sdk);
1623
1516
  //#endregion
1624
- export { AssetVerifierHandle, Handle, StreamSessionHandle, StreamVerifierHandle };
1517
+ export { AssetVerifierHandle, Handle, StreamSessionHandle, StreamVerifierHandle, VerificationHandle };