@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.
- package/gen/wasm/trylimbo_sdk_verifier.d.ts +284 -317
- package/gen/wasm/trylimbo_sdk_verifier.js +223 -288
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm +0 -0
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm.d.ts +13 -19
- package/gen/wasm/worker-thread.js +194 -301
- package/gen/wasm/worker.d.ts +309 -306
- package/package.json +1 -1
|
@@ -39,26 +39,25 @@ export class AssetVerifier {
|
|
|
39
39
|
*
|
|
40
40
|
* # Errors
|
|
41
41
|
*
|
|
42
|
-
* Throws on a malformed `
|
|
42
|
+
* Throws on a malformed `source`, a repository (or engine) failure, or a validation
|
|
43
43
|
* failure.
|
|
44
|
-
* @param {RangeSource}
|
|
44
|
+
* @param {RangeSource} source
|
|
45
45
|
* @param {Recovery | null} [recovery]
|
|
46
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<Verification>}
|
|
47
47
|
*/
|
|
48
|
-
verify(
|
|
49
|
-
const ret = wasm.assetverifier_verify(this.__wbg_ptr,
|
|
48
|
+
verify(source, recovery) {
|
|
49
|
+
const ret = wasm.assetverifier_verify(this.__wbg_ptr, source, 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
|
|
56
|
+
* A `RangeSource` 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
|
-
*
|
|
61
|
-
* 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.
|
|
62
61
|
*
|
|
63
62
|
* # Worker only
|
|
64
63
|
*
|
|
@@ -123,148 +122,6 @@ export class BlobSource {
|
|
|
123
122
|
}
|
|
124
123
|
if (Symbol.dispose) BlobSource.prototype[Symbol.dispose] = BlobSource.prototype.free;
|
|
125
124
|
|
|
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
|
-
|
|
268
125
|
export class IntoUnderlyingByteSource {
|
|
269
126
|
__destroy_into_raw() {
|
|
270
127
|
const ptr = this.__wbg_ptr;
|
|
@@ -377,57 +234,9 @@ export class IntoUnderlyingSource {
|
|
|
377
234
|
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
|
|
378
235
|
|
|
379
236
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
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.
|
|
237
|
+
* A `RangeSource` over bytes the caller already holds, read in place: the array stays on the JS
|
|
238
|
+
* side and only the window the SDK asks for crosses, so nothing is resident here and linear
|
|
239
|
+
* memory's 4 GiB ceiling never applies to the asset.
|
|
431
240
|
*/
|
|
432
241
|
export class MemorySource {
|
|
433
242
|
__destroy_into_raw() {
|
|
@@ -451,9 +260,7 @@ export class MemorySource {
|
|
|
451
260
|
* @param {Uint8Array} data
|
|
452
261
|
*/
|
|
453
262
|
constructor(data) {
|
|
454
|
-
const
|
|
455
|
-
const len0 = WASM_VECTOR_LEN;
|
|
456
|
-
const ret = wasm.memorysource_new(ptr0, len0);
|
|
263
|
+
const ret = wasm.memorysource_new(data);
|
|
457
264
|
this.__wbg_ptr = ret;
|
|
458
265
|
MemorySourceFinalization.register(this, this.__wbg_ptr, this);
|
|
459
266
|
return this;
|
|
@@ -492,8 +299,8 @@ export class StreamSession {
|
|
|
492
299
|
wasm.__wbg_streamsession_free(ptr, 0);
|
|
493
300
|
}
|
|
494
301
|
/**
|
|
495
|
-
*
|
|
496
|
-
* `StreamVerifier.resume` from.
|
|
302
|
+
* This stream's id and everything its init segments have registered, as CBOR for another
|
|
303
|
+
* node to `StreamVerifier.resume` from.
|
|
497
304
|
*
|
|
498
305
|
* The one piece of stream state that leaves the SDK, and only because a clustered
|
|
499
306
|
* verifier needs it: the init URL is overwritten on rotation, so a node joining during
|
|
@@ -522,11 +329,11 @@ export class StreamSession {
|
|
|
522
329
|
*
|
|
523
330
|
* Throws an `SdkError` on parse or signature failure, or when a media segment arrives
|
|
524
331
|
* before any init was processed for the stream.
|
|
525
|
-
* @param {RangeSource}
|
|
332
|
+
* @param {RangeSource} source
|
|
526
333
|
* @returns {Promise<SegmentValidation>}
|
|
527
334
|
*/
|
|
528
|
-
validate(
|
|
529
|
-
const ret = wasm.streamsession_validate(this.__wbg_ptr,
|
|
335
|
+
validate(source) {
|
|
336
|
+
const ret = wasm.streamsession_validate(this.__wbg_ptr, source);
|
|
530
337
|
return ret;
|
|
531
338
|
}
|
|
532
339
|
}
|
|
@@ -566,39 +373,37 @@ export class StreamVerifier {
|
|
|
566
373
|
return StreamVerifier.__wrap(ret[0]);
|
|
567
374
|
}
|
|
568
375
|
/**
|
|
569
|
-
* Open `
|
|
376
|
+
* Open the stream `id` for validation, handing back a `StreamSession` to feed segments to.
|
|
570
377
|
*
|
|
571
378
|
* No I/O: the handle carries the id so it cannot be mistyped or confused with another
|
|
572
379
|
* stream's, and classification still happens per segment. Opening one id twice hands
|
|
573
380
|
* back the same live session, so a component that remounts keeps the state its earlier
|
|
574
381
|
* handle accumulated.
|
|
575
|
-
* @param {string}
|
|
382
|
+
* @param {string} id
|
|
576
383
|
* @returns {StreamSession}
|
|
577
384
|
*/
|
|
578
|
-
open(
|
|
579
|
-
const ptr0 = passStringToWasm0(
|
|
385
|
+
open(id) {
|
|
386
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
580
387
|
const len0 = WASM_VECTOR_LEN;
|
|
581
388
|
const ret = wasm.streamverifier_open(this.__wbg_ptr, ptr0, len0);
|
|
582
389
|
return StreamSession.__wrap(ret);
|
|
583
390
|
}
|
|
584
391
|
/**
|
|
585
|
-
* Open
|
|
586
|
-
*
|
|
392
|
+
* Open the stream another node exported, its state merged into whatever this one holds
|
|
393
|
+
* for that stream already.
|
|
587
394
|
*
|
|
588
395
|
* # Errors
|
|
589
396
|
*
|
|
590
|
-
* Throws an `SdkError`
|
|
591
|
-
* `StreamSession.export` produced, or
|
|
592
|
-
*
|
|
397
|
+
* Throws an `SdkError` with a field violation at `state` when it is not a value
|
|
398
|
+
* `StreamSession.export` produced (`state.malformed`), or one of another export version
|
|
399
|
+
* (`state.version`).
|
|
593
400
|
* @param {Uint8Array} state
|
|
594
401
|
* @returns {StreamSession}
|
|
595
402
|
*/
|
|
596
|
-
resume(
|
|
597
|
-
const ptr0 =
|
|
403
|
+
resume(state) {
|
|
404
|
+
const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
|
|
598
405
|
const len0 = WASM_VECTOR_LEN;
|
|
599
|
-
const
|
|
600
|
-
const len1 = WASM_VECTOR_LEN;
|
|
601
|
-
const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
406
|
+
const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0);
|
|
602
407
|
if (ret[2]) {
|
|
603
408
|
throw takeFromExternrefTable0(ret[1]);
|
|
604
409
|
}
|
|
@@ -607,6 +412,142 @@ export class StreamVerifier {
|
|
|
607
412
|
}
|
|
608
413
|
if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
|
|
609
414
|
|
|
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
|
+
|
|
610
551
|
export function init_panic_hook() {
|
|
611
552
|
wasm.init_panic_hook();
|
|
612
553
|
}
|
|
@@ -630,21 +571,12 @@ export function parse(manifest) {
|
|
|
630
571
|
const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
|
|
631
572
|
const len0 = WASM_VECTOR_LEN;
|
|
632
573
|
const ret = wasm.parse(ptr0, len0);
|
|
633
|
-
|
|
634
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
635
|
-
}
|
|
636
|
-
return takeFromExternrefTable0(ret[0]);
|
|
574
|
+
return ret;
|
|
637
575
|
}
|
|
638
576
|
|
|
639
577
|
/**
|
|
640
578
|
* The bytes of one resource in a detached manifest store, or `undefined` when it holds none
|
|
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.
|
|
579
|
+
* under `uri`: the `identifier` on a resource reference the parsed store carries.
|
|
648
580
|
*
|
|
649
581
|
* # Errors
|
|
650
582
|
*
|
|
@@ -652,7 +584,7 @@ export function parse(manifest) {
|
|
|
652
584
|
* holds the resource but cannot produce it.
|
|
653
585
|
* @param {Uint8Array} manifest
|
|
654
586
|
* @param {string} uri
|
|
655
|
-
* @returns {Uint8Array | undefined}
|
|
587
|
+
* @returns {Promise<Uint8Array | undefined>}
|
|
656
588
|
*/
|
|
657
589
|
export function resource(manifest, uri) {
|
|
658
590
|
const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
|
|
@@ -660,39 +592,7 @@ export function resource(manifest, uri) {
|
|
|
660
592
|
const ptr1 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
661
593
|
const len1 = WASM_VECTOR_LEN;
|
|
662
594
|
const ret = wasm.resource(ptr0, len0, ptr1, len1);
|
|
663
|
-
|
|
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]);
|
|
595
|
+
return ret;
|
|
696
596
|
}
|
|
697
597
|
function __wbg_get_imports() {
|
|
698
598
|
const import0 = {
|
|
@@ -789,6 +689,14 @@ function __wbg_get_imports() {
|
|
|
789
689
|
__wbg_abort_eee9248a6d680839: function(arg0, arg1) {
|
|
790
690
|
arg0.abort(arg1);
|
|
791
691
|
},
|
|
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
|
+
},
|
|
792
700
|
__wbg_append_01c74e5c6b58aa64: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
793
701
|
arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
794
702
|
}, arguments); },
|
|
@@ -1112,6 +1020,10 @@ function __wbg_get_imports() {
|
|
|
1112
1020
|
const ret = arg0.now();
|
|
1113
1021
|
return ret;
|
|
1114
1022
|
},
|
|
1023
|
+
__wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
|
|
1024
|
+
const ret = Array.of(arg0, arg1);
|
|
1025
|
+
return ret;
|
|
1026
|
+
},
|
|
1115
1027
|
__wbg_parse_1c0d8a8656d7e016: function() { return handleError(function (arg0, arg1) {
|
|
1116
1028
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
1117
1029
|
return ret;
|
|
@@ -1165,10 +1077,6 @@ function __wbg_get_imports() {
|
|
|
1165
1077
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
1166
1078
|
arg0[arg1] = arg2;
|
|
1167
1079
|
},
|
|
1168
|
-
__wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1169
|
-
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1170
|
-
return ret;
|
|
1171
|
-
}, arguments); },
|
|
1172
1080
|
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
1173
1081
|
arg0[arg1 >>> 0] = arg2;
|
|
1174
1082
|
},
|
|
@@ -1248,6 +1156,10 @@ function __wbg_get_imports() {
|
|
|
1248
1156
|
const ret = arg0.then(arg1);
|
|
1249
1157
|
return ret;
|
|
1250
1158
|
},
|
|
1159
|
+
__wbg_timeout_c971ded6d319fad2: function(arg0) {
|
|
1160
|
+
const ret = AbortSignal.timeout(arg0 >>> 0);
|
|
1161
|
+
return ret;
|
|
1162
|
+
},
|
|
1251
1163
|
__wbg_url_abdb8fb08377f8c0: function(arg0, arg1) {
|
|
1252
1164
|
const ret = arg1.url;
|
|
1253
1165
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -1259,23 +1171,27 @@ function __wbg_get_imports() {
|
|
|
1259
1171
|
const ret = arg0.value;
|
|
1260
1172
|
return ret;
|
|
1261
1173
|
},
|
|
1174
|
+
__wbg_verification_new: function(arg0) {
|
|
1175
|
+
const ret = Verification.__wrap(arg0);
|
|
1176
|
+
return ret;
|
|
1177
|
+
},
|
|
1262
1178
|
__wbg_view_21f1d4a4f175dfa9: function(arg0) {
|
|
1263
1179
|
const ret = arg0.view;
|
|
1264
1180
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1265
1181
|
},
|
|
1266
1182
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1267
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1183
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2185, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1268
1184
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1);
|
|
1269
1185
|
return ret;
|
|
1270
1186
|
},
|
|
1271
1187
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1272
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1188
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 5888, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1273
1189
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
|
|
1274
1190
|
return ret;
|
|
1275
1191
|
},
|
|
1276
1192
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1277
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1278
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1193
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3433, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1194
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846);
|
|
1279
1195
|
return ret;
|
|
1280
1196
|
},
|
|
1281
1197
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -1303,6 +1219,20 @@ function __wbg_get_imports() {
|
|
|
1303
1219
|
const ret = BigInt.asUintN(64, arg0);
|
|
1304
1220
|
return ret;
|
|
1305
1221
|
},
|
|
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
|
+
},
|
|
1306
1236
|
__wbindgen_init_externref_table: function() {
|
|
1307
1237
|
const table = wasm.__wbindgen_externrefs;
|
|
1308
1238
|
const offset = table.grow(4);
|
|
@@ -1319,8 +1249,8 @@ function __wbg_get_imports() {
|
|
|
1319
1249
|
};
|
|
1320
1250
|
}
|
|
1321
1251
|
|
|
1322
|
-
function
|
|
1323
|
-
wasm.
|
|
1252
|
+
function wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1) {
|
|
1253
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hbf782ef36cea6846(arg0, arg1);
|
|
1324
1254
|
}
|
|
1325
1255
|
|
|
1326
1256
|
function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
|
|
@@ -1355,12 +1285,6 @@ const AssetVerifierFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1355
1285
|
const BlobSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1356
1286
|
? { register: () => {}, unregister: () => {} }
|
|
1357
1287
|
: 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));
|
|
1364
1288
|
const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1365
1289
|
? { register: () => {}, unregister: () => {} }
|
|
1366
1290
|
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr, 1));
|
|
@@ -1370,9 +1294,6 @@ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefin
|
|
|
1370
1294
|
const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1371
1295
|
? { register: () => {}, unregister: () => {} }
|
|
1372
1296
|
: 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));
|
|
1376
1297
|
const MemorySourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1377
1298
|
? { register: () => {}, unregister: () => {} }
|
|
1378
1299
|
: new FinalizationRegistry(ptr => wasm.__wbg_memorysource_free(ptr, 1));
|
|
@@ -1382,6 +1303,9 @@ const StreamSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1382
1303
|
const StreamVerifierFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1383
1304
|
? { register: () => {}, unregister: () => {} }
|
|
1384
1305
|
: 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));
|
|
1385
1309
|
|
|
1386
1310
|
function addToExternrefTable0(obj) {
|
|
1387
1311
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -1458,6 +1382,17 @@ function debugString(val) {
|
|
|
1458
1382
|
return className;
|
|
1459
1383
|
}
|
|
1460
1384
|
|
|
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
|
+
|
|
1461
1396
|
function getArrayU8FromWasm0(ptr, len) {
|
|
1462
1397
|
ptr = ptr >>> 0;
|
|
1463
1398
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|