@trylimbo/sdk-verifier-wasm 0.2.25-canary.37 → 0.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/wasm/trylimbo_sdk_verifier.d.ts +317 -284
- package/gen/wasm/trylimbo_sdk_verifier.js +288 -223
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm +0 -0
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm.d.ts +19 -13
- package/gen/wasm/worker-thread.js +301 -194
- package/gen/wasm/worker.d.ts +306 -309
- package/package.json +1 -1
|
@@ -39,25 +39,26 @@ export class AssetVerifier {
|
|
|
39
39
|
*
|
|
40
40
|
* # Errors
|
|
41
41
|
*
|
|
42
|
-
* Throws on a malformed `
|
|
42
|
+
* Throws on a malformed `input`, a repository (or binder) failure, or a validation
|
|
43
43
|
* failure.
|
|
44
|
-
* @param {RangeSource}
|
|
44
|
+
* @param {RangeSource} input
|
|
45
45
|
* @param {Recovery | null} [recovery]
|
|
46
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<AssetVerification>}
|
|
47
47
|
*/
|
|
48
|
-
verify(
|
|
49
|
-
const ret = wasm.assetverifier_verify(this.__wbg_ptr,
|
|
48
|
+
verify(input, recovery) {
|
|
49
|
+
const ret = wasm.assetverifier_verify(this.__wbg_ptr, input, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery));
|
|
50
50
|
return ret;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
if (Symbol.dispose) AssetVerifier.prototype[Symbol.dispose] = AssetVerifier.prototype.free;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* A `RangeSource` over a `Blob`: a `File` off an `<input>`, a
|
|
56
|
+
* A [`RangeSource`](crate::wasm::RangeInput) over a `Blob`: a `File` off an `<input>`, a
|
|
57
57
|
* `Response.blob()`, a handle from the file system access API.
|
|
58
58
|
*
|
|
59
|
-
*
|
|
60
|
-
* memory verifies at the disk's speed rather than the heap's
|
|
59
|
+
* The only source here that holds nothing. The SDK reads one slice at a time, so an asset larger
|
|
60
|
+
* than the tab's memory verifies at the disk's speed rather than the heap's, and neither ceiling
|
|
61
|
+
* the other two carry applies.
|
|
61
62
|
*
|
|
62
63
|
* # Worker only
|
|
63
64
|
*
|
|
@@ -122,6 +123,148 @@ export class BlobSource {
|
|
|
122
123
|
}
|
|
123
124
|
if (Symbol.dispose) BlobSource.prototype[Symbol.dispose] = BlobSource.prototype.free;
|
|
124
125
|
|
|
126
|
+
/**
|
|
127
|
+
* A [`RangeSource`](crate::wasm::RangeInput) over bytes the caller already holds, read in place.
|
|
128
|
+
*
|
|
129
|
+
* [`MemorySource`] without the copy: the array stays on the JS side and only the window the SDK
|
|
130
|
+
* asks for crosses, so nothing is resident here and linear memory's 4 GiB ceiling never applies to
|
|
131
|
+
* the asset.
|
|
132
|
+
*/
|
|
133
|
+
export class BytesSource {
|
|
134
|
+
__destroy_into_raw() {
|
|
135
|
+
const ptr = this.__wbg_ptr;
|
|
136
|
+
this.__wbg_ptr = 0;
|
|
137
|
+
BytesSourceFinalization.unregister(this);
|
|
138
|
+
return ptr;
|
|
139
|
+
}
|
|
140
|
+
free() {
|
|
141
|
+
const ptr = this.__destroy_into_raw();
|
|
142
|
+
wasm.__wbg_bytessource_free(ptr, 0);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @returns {number}
|
|
146
|
+
*/
|
|
147
|
+
get length() {
|
|
148
|
+
const ret = wasm.bytessource_length(this.__wbg_ptr);
|
|
149
|
+
return ret;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* @param {Uint8Array} data
|
|
153
|
+
*/
|
|
154
|
+
constructor(data) {
|
|
155
|
+
const ret = wasm.bytessource_new(data);
|
|
156
|
+
this.__wbg_ptr = ret;
|
|
157
|
+
BytesSourceFinalization.register(this, this.__wbg_ptr, this);
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @param {number} offset
|
|
162
|
+
* @param {number} length
|
|
163
|
+
* @returns {Uint8Array}
|
|
164
|
+
*/
|
|
165
|
+
readAt(offset, length) {
|
|
166
|
+
const ret = wasm.bytessource_readAt(this.__wbg_ptr, offset, length);
|
|
167
|
+
return ret;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (Symbol.dispose) BytesSource.prototype[Symbol.dispose] = BytesSource.prototype.free;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @returns {string}
|
|
174
|
+
*/
|
|
175
|
+
export function C2PA_TRUST_LIST() {
|
|
176
|
+
let deferred1_0;
|
|
177
|
+
let deferred1_1;
|
|
178
|
+
try {
|
|
179
|
+
const ret = wasm.C2PA_TRUST_LIST();
|
|
180
|
+
deferred1_0 = ret[0];
|
|
181
|
+
deferred1_1 = ret[1];
|
|
182
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
183
|
+
} finally {
|
|
184
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @returns {string}
|
|
190
|
+
*/
|
|
191
|
+
export function C2PA_TSA_TRUST_LIST() {
|
|
192
|
+
let deferred1_0;
|
|
193
|
+
let deferred1_1;
|
|
194
|
+
try {
|
|
195
|
+
const ret = wasm.C2PA_TSA_TRUST_LIST();
|
|
196
|
+
deferred1_0 = ret[0];
|
|
197
|
+
deferred1_1 = ret[1];
|
|
198
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
199
|
+
} finally {
|
|
200
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @returns {string}
|
|
206
|
+
*/
|
|
207
|
+
export function DEV_CA() {
|
|
208
|
+
let deferred1_0;
|
|
209
|
+
let deferred1_1;
|
|
210
|
+
try {
|
|
211
|
+
const ret = wasm.DEV_CA();
|
|
212
|
+
deferred1_0 = ret[0];
|
|
213
|
+
deferred1_1 = ret[1];
|
|
214
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
215
|
+
} finally {
|
|
216
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* A binder contributing a binding you already hold (e.g. an out-of-band video ISCC):
|
|
222
|
+
* `new HeldBinder(binding)`, the spelling the native lane uses. A verify takes it as data,
|
|
223
|
+
* `{ kind: "held", binding }`, in `recovery.binders`.
|
|
224
|
+
*/
|
|
225
|
+
export class HeldBinder {
|
|
226
|
+
__destroy_into_raw() {
|
|
227
|
+
const ptr = this.__wbg_ptr;
|
|
228
|
+
this.__wbg_ptr = 0;
|
|
229
|
+
HeldBinderFinalization.unregister(this);
|
|
230
|
+
return ptr;
|
|
231
|
+
}
|
|
232
|
+
free() {
|
|
233
|
+
const ptr = this.__destroy_into_raw();
|
|
234
|
+
wasm.__wbg_heldbinder_free(ptr, 0);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Hand back the held binding; reads nothing.
|
|
238
|
+
*
|
|
239
|
+
* # Errors
|
|
240
|
+
*
|
|
241
|
+
* Throws when the source cannot be opened.
|
|
242
|
+
* @param {RangeSource} content
|
|
243
|
+
* @param {DeriveOptions} options
|
|
244
|
+
* @returns {Promise<SoftBinding | undefined>}
|
|
245
|
+
*/
|
|
246
|
+
derive(content, options) {
|
|
247
|
+
const ret = wasm.heldbinder_derive(this.__wbg_ptr, content, options);
|
|
248
|
+
return ret;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* # Errors
|
|
252
|
+
*
|
|
253
|
+
* Throws `SdkError.invalid` on a binding with an empty algorithm or value.
|
|
254
|
+
* @param {SoftBinding} binding
|
|
255
|
+
*/
|
|
256
|
+
constructor(binding) {
|
|
257
|
+
const ret = wasm.heldbinder_new(binding);
|
|
258
|
+
if (ret[2]) {
|
|
259
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
260
|
+
}
|
|
261
|
+
this.__wbg_ptr = ret[0];
|
|
262
|
+
HeldBinderFinalization.register(this, this.__wbg_ptr, this);
|
|
263
|
+
return this;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (Symbol.dispose) HeldBinder.prototype[Symbol.dispose] = HeldBinder.prototype.free;
|
|
267
|
+
|
|
125
268
|
export class IntoUnderlyingByteSource {
|
|
126
269
|
__destroy_into_raw() {
|
|
127
270
|
const ptr = this.__wbg_ptr;
|
|
@@ -234,9 +377,57 @@ export class IntoUnderlyingSource {
|
|
|
234
377
|
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
|
|
235
378
|
|
|
236
379
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
380
|
+
* The SDK's local ISCC Image-Code binder, for a standalone `derive`: `new IsccBinder()`, the
|
|
381
|
+
* spelling the native lane uses. A verify takes it as data, `{ kind: "iscc" }`, in
|
|
382
|
+
* `recovery.binders`, because a class cannot cross into a worker.
|
|
383
|
+
*
|
|
384
|
+
* Vendor watermark detection is repository-side in this SDK: configured detectors participate in
|
|
385
|
+
* `verify` through `byContent`, while a held binder covers values already available to the caller.
|
|
386
|
+
*/
|
|
387
|
+
export class IsccBinder {
|
|
388
|
+
__destroy_into_raw() {
|
|
389
|
+
const ptr = this.__wbg_ptr;
|
|
390
|
+
this.__wbg_ptr = 0;
|
|
391
|
+
IsccBinderFinalization.unregister(this);
|
|
392
|
+
return ptr;
|
|
393
|
+
}
|
|
394
|
+
free() {
|
|
395
|
+
const ptr = this.__destroy_into_raw();
|
|
396
|
+
wasm.__wbg_isccbinder_free(ptr, 0);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Derive the asset's ISCC standalone; `undefined` when the format yields none.
|
|
400
|
+
*
|
|
401
|
+
* # Errors
|
|
402
|
+
*
|
|
403
|
+
* Throws on malformed or unreadable input.
|
|
404
|
+
* @param {RangeSource} content
|
|
405
|
+
* @param {DeriveOptions} options
|
|
406
|
+
* @returns {Promise<SoftBinding | undefined>}
|
|
407
|
+
*/
|
|
408
|
+
derive(content, options) {
|
|
409
|
+
const ret = wasm.isccbinder_derive(this.__wbg_ptr, content, options);
|
|
410
|
+
return ret;
|
|
411
|
+
}
|
|
412
|
+
constructor() {
|
|
413
|
+
const ret = wasm.isccbinder_new();
|
|
414
|
+
this.__wbg_ptr = ret;
|
|
415
|
+
IsccBinderFinalization.register(this, this.__wbg_ptr, this);
|
|
416
|
+
return this;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (Symbol.dispose) IsccBinder.prototype[Symbol.dispose] = IsccBinder.prototype.free;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* An in-memory [`RangeSource`](crate::wasm::RangeInput), for a caller that already holds the whole
|
|
423
|
+
* asset as bytes.
|
|
424
|
+
*
|
|
425
|
+
* # Size ceiling
|
|
426
|
+
*
|
|
427
|
+
* The constructor copies the bytes into wasm linear memory, which is 32-bit addressed, so the
|
|
428
|
+
* asset and everything else the module allocates share a 4 GiB ceiling (a browser tab reaches its
|
|
429
|
+
* own memory limit well before that). [`BytesSource`] takes the same bytes without the copy, and
|
|
430
|
+
* [`BlobSource`] holds nothing at all.
|
|
240
431
|
*/
|
|
241
432
|
export class MemorySource {
|
|
242
433
|
__destroy_into_raw() {
|
|
@@ -260,7 +451,9 @@ export class MemorySource {
|
|
|
260
451
|
* @param {Uint8Array} data
|
|
261
452
|
*/
|
|
262
453
|
constructor(data) {
|
|
263
|
-
const
|
|
454
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
455
|
+
const len0 = WASM_VECTOR_LEN;
|
|
456
|
+
const ret = wasm.memorysource_new(ptr0, len0);
|
|
264
457
|
this.__wbg_ptr = ret;
|
|
265
458
|
MemorySourceFinalization.register(this, this.__wbg_ptr, this);
|
|
266
459
|
return this;
|
|
@@ -299,8 +492,8 @@ export class StreamSession {
|
|
|
299
492
|
wasm.__wbg_streamsession_free(ptr, 0);
|
|
300
493
|
}
|
|
301
494
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
495
|
+
* Everything this stream's init segments have registered, as CBOR for another node to
|
|
496
|
+
* `StreamVerifier.resume` from.
|
|
304
497
|
*
|
|
305
498
|
* The one piece of stream state that leaves the SDK, and only because a clustered
|
|
306
499
|
* verifier needs it: the init URL is overwritten on rotation, so a node joining during
|
|
@@ -329,11 +522,11 @@ export class StreamSession {
|
|
|
329
522
|
*
|
|
330
523
|
* Throws an `SdkError` on parse or signature failure, or when a media segment arrives
|
|
331
524
|
* before any init was processed for the stream.
|
|
332
|
-
* @param {RangeSource}
|
|
525
|
+
* @param {RangeSource} data
|
|
333
526
|
* @returns {Promise<SegmentValidation>}
|
|
334
527
|
*/
|
|
335
|
-
validate(
|
|
336
|
-
const ret = wasm.streamsession_validate(this.__wbg_ptr,
|
|
528
|
+
validate(data) {
|
|
529
|
+
const ret = wasm.streamsession_validate(this.__wbg_ptr, data);
|
|
337
530
|
return ret;
|
|
338
531
|
}
|
|
339
532
|
}
|
|
@@ -373,37 +566,39 @@ export class StreamVerifier {
|
|
|
373
566
|
return StreamVerifier.__wrap(ret[0]);
|
|
374
567
|
}
|
|
375
568
|
/**
|
|
376
|
-
* Open
|
|
569
|
+
* Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
|
|
377
570
|
*
|
|
378
571
|
* No I/O: the handle carries the id so it cannot be mistyped or confused with another
|
|
379
572
|
* stream's, and classification still happens per segment. Opening one id twice hands
|
|
380
573
|
* back the same live session, so a component that remounts keeps the state its earlier
|
|
381
574
|
* handle accumulated.
|
|
382
|
-
* @param {string}
|
|
575
|
+
* @param {string} stream_id
|
|
383
576
|
* @returns {StreamSession}
|
|
384
577
|
*/
|
|
385
|
-
open(
|
|
386
|
-
const ptr0 = passStringToWasm0(
|
|
578
|
+
open(stream_id) {
|
|
579
|
+
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
387
580
|
const len0 = WASM_VECTOR_LEN;
|
|
388
581
|
const ret = wasm.streamverifier_open(this.__wbg_ptr, ptr0, len0);
|
|
389
582
|
return StreamSession.__wrap(ret);
|
|
390
583
|
}
|
|
391
584
|
/**
|
|
392
|
-
* Open the
|
|
393
|
-
* for that
|
|
585
|
+
* Open `stream_id` on the state another node exported, merged into whatever this one
|
|
586
|
+
* holds for that id already.
|
|
394
587
|
*
|
|
395
588
|
* # Errors
|
|
396
589
|
*
|
|
397
|
-
* Throws an `SdkError`
|
|
398
|
-
* `StreamSession.export` produced
|
|
399
|
-
*
|
|
590
|
+
* Throws an `SdkError` (`STREAM_INVALID`) when `state` is not a value
|
|
591
|
+
* `StreamSession.export` produced, or carries a version this SDK no longer reads.
|
|
592
|
+
* @param {string} stream_id
|
|
400
593
|
* @param {Uint8Array} state
|
|
401
594
|
* @returns {StreamSession}
|
|
402
595
|
*/
|
|
403
|
-
resume(state) {
|
|
404
|
-
const ptr0 =
|
|
596
|
+
resume(stream_id, state) {
|
|
597
|
+
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
405
598
|
const len0 = WASM_VECTOR_LEN;
|
|
406
|
-
const
|
|
599
|
+
const ptr1 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
|
|
600
|
+
const len1 = WASM_VECTOR_LEN;
|
|
601
|
+
const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
407
602
|
if (ret[2]) {
|
|
408
603
|
throw takeFromExternrefTable0(ret[1]);
|
|
409
604
|
}
|
|
@@ -412,142 +607,6 @@ export class StreamVerifier {
|
|
|
412
607
|
}
|
|
413
608
|
if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
|
|
414
609
|
|
|
415
|
-
/**
|
|
416
|
-
* One `verify` result held with the stores it read: `report` is the data, and `resource` reads a
|
|
417
|
-
* thumbnail from credential `credential` (its position in `report.credentials`) by the
|
|
418
|
-
* `identifier` of a resource reference in its manifest. A class rather than a field of the
|
|
419
|
-
* report because a store cannot be serialized, and one handle per verify is what a worker can
|
|
420
|
-
* proxy (a class nested in the report cannot cross a thread).
|
|
421
|
-
*/
|
|
422
|
-
export class Verification {
|
|
423
|
-
static __wrap(ptr) {
|
|
424
|
-
const obj = Object.create(Verification.prototype);
|
|
425
|
-
obj.__wbg_ptr = ptr;
|
|
426
|
-
VerificationFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
427
|
-
return obj;
|
|
428
|
-
}
|
|
429
|
-
__destroy_into_raw() {
|
|
430
|
-
const ptr = this.__wbg_ptr;
|
|
431
|
-
this.__wbg_ptr = 0;
|
|
432
|
-
VerificationFinalization.unregister(this);
|
|
433
|
-
return ptr;
|
|
434
|
-
}
|
|
435
|
-
free() {
|
|
436
|
-
const ptr = this.__destroy_into_raw();
|
|
437
|
-
wasm.__wbg_verification_free(ptr, 0);
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* The report: credentials, recovery, golden flow and verdict.
|
|
441
|
-
* @returns {AssetVerification}
|
|
442
|
-
*/
|
|
443
|
-
get report() {
|
|
444
|
-
const ret = wasm.verification_report(this.__wbg_ptr);
|
|
445
|
-
return ret;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* The bytes of one resource credential `credential` holds, or `undefined`.
|
|
449
|
-
*
|
|
450
|
-
* # Errors
|
|
451
|
-
*
|
|
452
|
-
* Throws `READER_INVALID` when the store holds the resource but cannot produce it, and
|
|
453
|
-
* `undefined` for a `credential` out of range.
|
|
454
|
-
* @param {number} credential
|
|
455
|
-
* @param {string} uri
|
|
456
|
-
* @returns {Uint8Array | undefined}
|
|
457
|
-
*/
|
|
458
|
-
resource(credential, uri) {
|
|
459
|
-
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
460
|
-
const len0 = WASM_VECTOR_LEN;
|
|
461
|
-
const ret = wasm.verification_resource(this.__wbg_ptr, credential, ptr0, len0);
|
|
462
|
-
if (ret[3]) {
|
|
463
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
464
|
-
}
|
|
465
|
-
let v2;
|
|
466
|
-
if (ret[0] !== 0) {
|
|
467
|
-
v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
468
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
469
|
-
}
|
|
470
|
-
return v2;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
if (Symbol.dispose) Verification.prototype[Symbol.dispose] = Verification.prototype.free;
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* The bundled C2PA Conformance Program signing-CA trust list (a release snapshot). Trusted by
|
|
477
|
-
* default with `trust.c2pa`; read it to pin or extend your own list.
|
|
478
|
-
* @returns {string}
|
|
479
|
-
*/
|
|
480
|
-
export function c2paTrustList() {
|
|
481
|
-
let deferred1_0;
|
|
482
|
-
let deferred1_1;
|
|
483
|
-
try {
|
|
484
|
-
const ret = wasm.c2paTrustList();
|
|
485
|
-
deferred1_0 = ret[0];
|
|
486
|
-
deferred1_1 = ret[1];
|
|
487
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
488
|
-
} finally {
|
|
489
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* The bundled C2PA time-stamping-authority trust list (a release snapshot).
|
|
495
|
-
* @returns {string}
|
|
496
|
-
*/
|
|
497
|
-
export function c2paTsaTrustList() {
|
|
498
|
-
let deferred1_0;
|
|
499
|
-
let deferred1_1;
|
|
500
|
-
try {
|
|
501
|
-
const ret = wasm.c2paTsaTrustList();
|
|
502
|
-
deferred1_0 = ret[0];
|
|
503
|
-
deferred1_1 = ret[1];
|
|
504
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
505
|
-
} finally {
|
|
506
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* The values this SDK computes for `alg` over `source`, `[]` when it finds none. `format` is
|
|
512
|
-
* the asset's media type; omitted, the bytes name it.
|
|
513
|
-
*
|
|
514
|
-
* # Errors
|
|
515
|
-
*
|
|
516
|
-
* Throws on an algorithm this SDK computes no value of, a `format` that is no media type or that
|
|
517
|
-
* the bytes contradict, an unreadable source, or no trustworthy answer.
|
|
518
|
-
* @param {string} alg
|
|
519
|
-
* @param {RangeSource} source
|
|
520
|
-
* @param {string | null} [format]
|
|
521
|
-
* @returns {Promise<Block[]>}
|
|
522
|
-
*/
|
|
523
|
-
export function computeSoftBinding(alg, source, format) {
|
|
524
|
-
const ptr0 = passStringToWasm0(alg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
525
|
-
const len0 = WASM_VECTOR_LEN;
|
|
526
|
-
var ptr1 = isLikeNone(format) ? 0 : passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
527
|
-
var len1 = WASM_VECTOR_LEN;
|
|
528
|
-
const ret = wasm.computeSoftBinding(ptr0, len0, source, ptr1, len1);
|
|
529
|
-
return ret;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* PEM trust anchor for the Limbo Integrity development signing environment, **development
|
|
534
|
-
* only**, no security guarantees: put it in `trust.anchors` for a development build, never in a
|
|
535
|
-
* release.
|
|
536
|
-
* @returns {string}
|
|
537
|
-
*/
|
|
538
|
-
export function devCa() {
|
|
539
|
-
let deferred1_0;
|
|
540
|
-
let deferred1_1;
|
|
541
|
-
try {
|
|
542
|
-
const ret = wasm.devCa();
|
|
543
|
-
deferred1_0 = ret[0];
|
|
544
|
-
deferred1_1 = ret[1];
|
|
545
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
546
|
-
} finally {
|
|
547
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
|
|
551
610
|
export function init_panic_hook() {
|
|
552
611
|
wasm.init_panic_hook();
|
|
553
612
|
}
|
|
@@ -571,12 +630,21 @@ export function parse(manifest) {
|
|
|
571
630
|
const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
|
|
572
631
|
const len0 = WASM_VECTOR_LEN;
|
|
573
632
|
const ret = wasm.parse(ptr0, len0);
|
|
574
|
-
|
|
633
|
+
if (ret[2]) {
|
|
634
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
635
|
+
}
|
|
636
|
+
return takeFromExternrefTable0(ret[0]);
|
|
575
637
|
}
|
|
576
638
|
|
|
577
639
|
/**
|
|
578
640
|
* The bytes of one resource in a detached manifest store, or `undefined` when it holds none
|
|
579
|
-
* under `uri
|
|
641
|
+
* under `uri`.
|
|
642
|
+
*
|
|
643
|
+
* `uri` is the `identifier` on a resource reference the store carries, so walking the chain in
|
|
644
|
+
* the parsed store is what produces it: any manifest's claim thumbnail, including a non-active
|
|
645
|
+
* one, and any ingredient's. Render it with the `format` beside that identifier. A `uri` naming a
|
|
646
|
+
* manifest rather than a resource answers that manifest's own JUMBF, so pass what a reference
|
|
647
|
+
* states, never a bare label.
|
|
580
648
|
*
|
|
581
649
|
* # Errors
|
|
582
650
|
*
|
|
@@ -584,7 +652,7 @@ export function parse(manifest) {
|
|
|
584
652
|
* holds the resource but cannot produce it.
|
|
585
653
|
* @param {Uint8Array} manifest
|
|
586
654
|
* @param {string} uri
|
|
587
|
-
* @returns {
|
|
655
|
+
* @returns {Uint8Array | undefined}
|
|
588
656
|
*/
|
|
589
657
|
export function resource(manifest, uri) {
|
|
590
658
|
const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
|
|
@@ -592,7 +660,39 @@ export function resource(manifest, uri) {
|
|
|
592
660
|
const ptr1 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
593
661
|
const len1 = WASM_VECTOR_LEN;
|
|
594
662
|
const ret = wasm.resource(ptr0, len0, ptr1, len1);
|
|
595
|
-
|
|
663
|
+
if (ret[3]) {
|
|
664
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
665
|
+
}
|
|
666
|
+
let v3;
|
|
667
|
+
if (ret[0] !== 0) {
|
|
668
|
+
v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
669
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
670
|
+
}
|
|
671
|
+
return v3;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Every thumbnail the store references, by the `identifier` it references them under: each
|
|
676
|
+
* manifest's claim thumbnail and each ingredient's, whichever manifest carries them.
|
|
677
|
+
*
|
|
678
|
+
* One parse for the whole set, where `resource` pays one per call, so a chain view asks once
|
|
679
|
+
* instead of once per tile. Render each one as the `format` beside its identifier. A reference
|
|
680
|
+
* the store cannot produce is left out rather than failing the set.
|
|
681
|
+
*
|
|
682
|
+
* # Errors
|
|
683
|
+
*
|
|
684
|
+
* Throws `READER_INVALID` when the bytes are not a manifest store c2pa can parse.
|
|
685
|
+
* @param {Uint8Array} manifest
|
|
686
|
+
* @returns {Record<string, Uint8Array>}
|
|
687
|
+
*/
|
|
688
|
+
export function thumbnails(manifest) {
|
|
689
|
+
const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
|
|
690
|
+
const len0 = WASM_VECTOR_LEN;
|
|
691
|
+
const ret = wasm.thumbnails(ptr0, len0);
|
|
692
|
+
if (ret[2]) {
|
|
693
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
694
|
+
}
|
|
695
|
+
return takeFromExternrefTable0(ret[0]);
|
|
596
696
|
}
|
|
597
697
|
function __wbg_get_imports() {
|
|
598
698
|
const import0 = {
|
|
@@ -689,14 +789,6 @@ function __wbg_get_imports() {
|
|
|
689
789
|
__wbg_abort_eee9248a6d680839: function(arg0, arg1) {
|
|
690
790
|
arg0.abort(arg1);
|
|
691
791
|
},
|
|
692
|
-
__wbg_aborted_2b7b403d16663f24: function(arg0) {
|
|
693
|
-
const ret = arg0.aborted;
|
|
694
|
-
return ret;
|
|
695
|
-
},
|
|
696
|
-
__wbg_any_a57fdb241e47190d: function(arg0) {
|
|
697
|
-
const ret = AbortSignal.any(arg0);
|
|
698
|
-
return ret;
|
|
699
|
-
},
|
|
700
792
|
__wbg_append_01c74e5c6b58aa64: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
701
793
|
arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
702
794
|
}, arguments); },
|
|
@@ -1020,10 +1112,6 @@ function __wbg_get_imports() {
|
|
|
1020
1112
|
const ret = arg0.now();
|
|
1021
1113
|
return ret;
|
|
1022
1114
|
},
|
|
1023
|
-
__wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
|
|
1024
|
-
const ret = Array.of(arg0, arg1);
|
|
1025
|
-
return ret;
|
|
1026
|
-
},
|
|
1027
1115
|
__wbg_parse_1c0d8a8656d7e016: function() { return handleError(function (arg0, arg1) {
|
|
1028
1116
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
1029
1117
|
return ret;
|
|
@@ -1077,6 +1165,10 @@ function __wbg_get_imports() {
|
|
|
1077
1165
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
1078
1166
|
arg0[arg1] = arg2;
|
|
1079
1167
|
},
|
|
1168
|
+
__wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1169
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1170
|
+
return ret;
|
|
1171
|
+
}, arguments); },
|
|
1080
1172
|
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
1081
1173
|
arg0[arg1 >>> 0] = arg2;
|
|
1082
1174
|
},
|
|
@@ -1156,10 +1248,6 @@ function __wbg_get_imports() {
|
|
|
1156
1248
|
const ret = arg0.then(arg1);
|
|
1157
1249
|
return ret;
|
|
1158
1250
|
},
|
|
1159
|
-
__wbg_timeout_c971ded6d319fad2: function(arg0) {
|
|
1160
|
-
const ret = AbortSignal.timeout(arg0 >>> 0);
|
|
1161
|
-
return ret;
|
|
1162
|
-
},
|
|
1163
1251
|
__wbg_url_abdb8fb08377f8c0: function(arg0, arg1) {
|
|
1164
1252
|
const ret = arg1.url;
|
|
1165
1253
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -1171,27 +1259,23 @@ function __wbg_get_imports() {
|
|
|
1171
1259
|
const ret = arg0.value;
|
|
1172
1260
|
return ret;
|
|
1173
1261
|
},
|
|
1174
|
-
__wbg_verification_new: function(arg0) {
|
|
1175
|
-
const ret = Verification.__wrap(arg0);
|
|
1176
|
-
return ret;
|
|
1177
|
-
},
|
|
1178
1262
|
__wbg_view_21f1d4a4f175dfa9: function(arg0) {
|
|
1179
1263
|
const ret = arg0.view;
|
|
1180
1264
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1181
1265
|
},
|
|
1182
1266
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1183
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1267
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2054, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1184
1268
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1);
|
|
1185
1269
|
return ret;
|
|
1186
1270
|
},
|
|
1187
1271
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1188
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1272
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3951, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1189
1273
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
|
|
1190
1274
|
return ret;
|
|
1191
1275
|
},
|
|
1192
1276
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1193
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1194
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1277
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2728, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1278
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5);
|
|
1195
1279
|
return ret;
|
|
1196
1280
|
},
|
|
1197
1281
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -1219,20 +1303,6 @@ function __wbg_get_imports() {
|
|
|
1219
1303
|
const ret = BigInt.asUintN(64, arg0);
|
|
1220
1304
|
return ret;
|
|
1221
1305
|
},
|
|
1222
|
-
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
1223
|
-
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
1224
|
-
wasm.__wbindgen_free(arg0, arg1 * 4, 4);
|
|
1225
|
-
// Cast intrinsic for `Vector(NamedExternref("Block")) -> Externref`.
|
|
1226
|
-
const ret = v0;
|
|
1227
|
-
return ret;
|
|
1228
|
-
},
|
|
1229
|
-
__wbindgen_cast_000000000000000a: function(arg0, arg1) {
|
|
1230
|
-
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
1231
|
-
wasm.__wbindgen_free(arg0, arg1 * 1, 1);
|
|
1232
|
-
// Cast intrinsic for `Vector(U8) -> Externref`.
|
|
1233
|
-
const ret = v0;
|
|
1234
|
-
return ret;
|
|
1235
|
-
},
|
|
1236
1306
|
__wbindgen_init_externref_table: function() {
|
|
1237
1307
|
const table = wasm.__wbindgen_externrefs;
|
|
1238
1308
|
const offset = table.grow(4);
|
|
@@ -1249,8 +1319,8 @@ function __wbg_get_imports() {
|
|
|
1249
1319
|
};
|
|
1250
1320
|
}
|
|
1251
1321
|
|
|
1252
|
-
function
|
|
1253
|
-
wasm.
|
|
1322
|
+
function wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1) {
|
|
1323
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1);
|
|
1254
1324
|
}
|
|
1255
1325
|
|
|
1256
1326
|
function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
|
|
@@ -1285,6 +1355,12 @@ const AssetVerifierFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1285
1355
|
const BlobSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1286
1356
|
? { register: () => {}, unregister: () => {} }
|
|
1287
1357
|
: new FinalizationRegistry(ptr => wasm.__wbg_blobsource_free(ptr, 1));
|
|
1358
|
+
const BytesSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1359
|
+
? { register: () => {}, unregister: () => {} }
|
|
1360
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_bytessource_free(ptr, 1));
|
|
1361
|
+
const HeldBinderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1362
|
+
? { register: () => {}, unregister: () => {} }
|
|
1363
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_heldbinder_free(ptr, 1));
|
|
1288
1364
|
const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1289
1365
|
? { register: () => {}, unregister: () => {} }
|
|
1290
1366
|
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr, 1));
|
|
@@ -1294,6 +1370,9 @@ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefin
|
|
|
1294
1370
|
const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1295
1371
|
? { register: () => {}, unregister: () => {} }
|
|
1296
1372
|
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr, 1));
|
|
1373
|
+
const IsccBinderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1374
|
+
? { register: () => {}, unregister: () => {} }
|
|
1375
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_isccbinder_free(ptr, 1));
|
|
1297
1376
|
const MemorySourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1298
1377
|
? { register: () => {}, unregister: () => {} }
|
|
1299
1378
|
: new FinalizationRegistry(ptr => wasm.__wbg_memorysource_free(ptr, 1));
|
|
@@ -1303,9 +1382,6 @@ const StreamSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1303
1382
|
const StreamVerifierFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1304
1383
|
? { register: () => {}, unregister: () => {} }
|
|
1305
1384
|
: new FinalizationRegistry(ptr => wasm.__wbg_streamverifier_free(ptr, 1));
|
|
1306
|
-
const VerificationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1307
|
-
? { register: () => {}, unregister: () => {} }
|
|
1308
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_verification_free(ptr, 1));
|
|
1309
1385
|
|
|
1310
1386
|
function addToExternrefTable0(obj) {
|
|
1311
1387
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -1382,17 +1458,6 @@ function debugString(val) {
|
|
|
1382
1458
|
return className;
|
|
1383
1459
|
}
|
|
1384
1460
|
|
|
1385
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
1386
|
-
ptr = ptr >>> 0;
|
|
1387
|
-
const mem = getDataViewMemory0();
|
|
1388
|
-
const result = [];
|
|
1389
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1390
|
-
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
1391
|
-
}
|
|
1392
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
1393
|
-
return result;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
1461
|
function getArrayU8FromWasm0(ptr, len) {
|
|
1397
1462
|
ptr = ptr >>> 0;
|
|
1398
1463
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|