@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
|
@@ -37,23 +37,24 @@ var AssetVerifier = class AssetVerifier {
|
|
|
37
37
|
*
|
|
38
38
|
* # Errors
|
|
39
39
|
*
|
|
40
|
-
* Throws on a malformed `
|
|
40
|
+
* Throws on a malformed `input`, a repository (or binder) failure, or a validation
|
|
41
41
|
* failure.
|
|
42
|
-
* @param {RangeSource}
|
|
42
|
+
* @param {RangeSource} input
|
|
43
43
|
* @param {Recovery | null} [recovery]
|
|
44
|
-
* @returns {Promise<
|
|
44
|
+
* @returns {Promise<AssetVerification>}
|
|
45
45
|
*/
|
|
46
|
-
verify(
|
|
47
|
-
return wasm.assetverifier_verify(this.__wbg_ptr,
|
|
46
|
+
verify(input, recovery) {
|
|
47
|
+
return wasm.assetverifier_verify(this.__wbg_ptr, input, 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` over a `Blob`: a `File` off an `<input>`, a
|
|
52
|
+
* A [`RangeSource`](crate::wasm::RangeInput) over a `Blob`: a `File` off an `<input>`, a
|
|
53
53
|
* `Response.blob()`, a handle from the file system access API.
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
* memory verifies at the disk's speed rather than the heap's
|
|
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.
|
|
57
58
|
*
|
|
58
59
|
* # Worker only
|
|
59
60
|
*
|
|
@@ -112,6 +113,138 @@ var BlobSource = class {
|
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
115
|
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;
|
|
115
248
|
var IntoUnderlyingByteSource = class {
|
|
116
249
|
__destroy_into_raw() {
|
|
117
250
|
const ptr = this.__wbg_ptr;
|
|
@@ -215,9 +348,55 @@ var IntoUnderlyingSource = class {
|
|
|
215
348
|
};
|
|
216
349
|
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
|
|
217
350
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
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.
|
|
221
400
|
*/
|
|
222
401
|
var MemorySource = class {
|
|
223
402
|
__destroy_into_raw() {
|
|
@@ -240,7 +419,9 @@ var MemorySource = class {
|
|
|
240
419
|
* @param {Uint8Array} data
|
|
241
420
|
*/
|
|
242
421
|
constructor(data) {
|
|
243
|
-
const
|
|
422
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
423
|
+
const len0 = WASM_VECTOR_LEN;
|
|
424
|
+
const ret = wasm.memorysource_new(ptr0, len0);
|
|
244
425
|
this.__wbg_ptr = ret;
|
|
245
426
|
MemorySourceFinalization.register(this, this.__wbg_ptr, this);
|
|
246
427
|
return this;
|
|
@@ -277,8 +458,8 @@ var StreamSession = class StreamSession {
|
|
|
277
458
|
wasm.__wbg_streamsession_free(ptr, 0);
|
|
278
459
|
}
|
|
279
460
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
461
|
+
* Everything this stream's init segments have registered, as CBOR for another node to
|
|
462
|
+
* `StreamVerifier.resume` from.
|
|
282
463
|
*
|
|
283
464
|
* The one piece of stream state that leaves the SDK, and only because a clustered
|
|
284
465
|
* verifier needs it: the init URL is overwritten on rotation, so a node joining during
|
|
@@ -305,11 +486,11 @@ var StreamSession = class StreamSession {
|
|
|
305
486
|
*
|
|
306
487
|
* Throws an `SdkError` on parse or signature failure, or when a media segment arrives
|
|
307
488
|
* before any init was processed for the stream.
|
|
308
|
-
* @param {RangeSource}
|
|
489
|
+
* @param {RangeSource} data
|
|
309
490
|
* @returns {Promise<SegmentValidation>}
|
|
310
491
|
*/
|
|
311
|
-
validate(
|
|
312
|
-
return wasm.streamsession_validate(this.__wbg_ptr,
|
|
492
|
+
validate(data) {
|
|
493
|
+
return wasm.streamsession_validate(this.__wbg_ptr, data);
|
|
313
494
|
}
|
|
314
495
|
};
|
|
315
496
|
if (Symbol.dispose) StreamSession.prototype[Symbol.dispose] = StreamSession.prototype.free;
|
|
@@ -345,137 +526,45 @@ var StreamVerifier = class StreamVerifier {
|
|
|
345
526
|
return StreamVerifier.__wrap(ret[0]);
|
|
346
527
|
}
|
|
347
528
|
/**
|
|
348
|
-
* Open
|
|
529
|
+
* Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
|
|
349
530
|
*
|
|
350
531
|
* No I/O: the handle carries the id so it cannot be mistyped or confused with another
|
|
351
532
|
* stream's, and classification still happens per segment. Opening one id twice hands
|
|
352
533
|
* back the same live session, so a component that remounts keeps the state its earlier
|
|
353
534
|
* handle accumulated.
|
|
354
|
-
* @param {string}
|
|
535
|
+
* @param {string} stream_id
|
|
355
536
|
* @returns {StreamSession}
|
|
356
537
|
*/
|
|
357
|
-
open(
|
|
358
|
-
const ptr0 = passStringToWasm0(
|
|
538
|
+
open(stream_id) {
|
|
539
|
+
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
359
540
|
const len0 = WASM_VECTOR_LEN;
|
|
360
541
|
const ret = wasm.streamverifier_open(this.__wbg_ptr, ptr0, len0);
|
|
361
542
|
return StreamSession.__wrap(ret);
|
|
362
543
|
}
|
|
363
544
|
/**
|
|
364
|
-
* Open the
|
|
365
|
-
* for that
|
|
545
|
+
* Open `stream_id` on the state another node exported, merged into whatever this one
|
|
546
|
+
* holds for that id already.
|
|
366
547
|
*
|
|
367
548
|
* # Errors
|
|
368
549
|
*
|
|
369
|
-
* Throws an `SdkError`
|
|
370
|
-
* `StreamSession.export` produced
|
|
371
|
-
*
|
|
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
|
|
372
553
|
* @param {Uint8Array} state
|
|
373
554
|
* @returns {StreamSession}
|
|
374
555
|
*/
|
|
375
|
-
resume(state) {
|
|
376
|
-
const ptr0 =
|
|
556
|
+
resume(stream_id, state) {
|
|
557
|
+
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
377
558
|
const len0 = WASM_VECTOR_LEN;
|
|
378
|
-
const
|
|
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);
|
|
379
562
|
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
380
563
|
return StreamSession.__wrap(ret[0]);
|
|
381
564
|
}
|
|
382
565
|
};
|
|
383
566
|
if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
|
|
384
567
|
/**
|
|
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
|
-
/**
|
|
479
568
|
* Parse a detached C2PA manifest store: a `.c2pa` sidecar, or the bytes a repository serves for a
|
|
480
569
|
* manifest id.
|
|
481
570
|
*
|
|
@@ -493,11 +582,19 @@ function devCa() {
|
|
|
493
582
|
function parse(manifest) {
|
|
494
583
|
const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
|
|
495
584
|
const len0 = WASM_VECTOR_LEN;
|
|
496
|
-
|
|
585
|
+
const ret = wasm.parse(ptr0, len0);
|
|
586
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
587
|
+
return takeFromExternrefTable0(ret[0]);
|
|
497
588
|
}
|
|
498
589
|
/**
|
|
499
590
|
* The bytes of one resource in a detached manifest store, or `undefined` when it holds none
|
|
500
|
-
* under `uri
|
|
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.
|
|
501
598
|
*
|
|
502
599
|
* # Errors
|
|
503
600
|
*
|
|
@@ -505,14 +602,42 @@ function parse(manifest) {
|
|
|
505
602
|
* holds the resource but cannot produce it.
|
|
506
603
|
* @param {Uint8Array} manifest
|
|
507
604
|
* @param {string} uri
|
|
508
|
-
* @returns {
|
|
605
|
+
* @returns {Uint8Array | undefined}
|
|
509
606
|
*/
|
|
510
607
|
function resource(manifest, uri) {
|
|
511
608
|
const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
|
|
512
609
|
const len0 = WASM_VECTOR_LEN;
|
|
513
610
|
const ptr1 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
514
611
|
const len1 = WASM_VECTOR_LEN;
|
|
515
|
-
|
|
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]);
|
|
516
641
|
}
|
|
517
642
|
function __wbg_get_imports() {
|
|
518
643
|
return {
|
|
@@ -599,12 +724,6 @@ function __wbg_get_imports() {
|
|
|
599
724
|
__wbg_abort_eee9248a6d680839: function(arg0, arg1) {
|
|
600
725
|
arg0.abort(arg1);
|
|
601
726
|
},
|
|
602
|
-
__wbg_aborted_2b7b403d16663f24: function(arg0) {
|
|
603
|
-
return arg0.aborted;
|
|
604
|
-
},
|
|
605
|
-
__wbg_any_a57fdb241e47190d: function(arg0) {
|
|
606
|
-
return AbortSignal.any(arg0);
|
|
607
|
-
},
|
|
608
727
|
__wbg_append_01c74e5c6b58aa64: function() {
|
|
609
728
|
return handleError(function(arg0, arg1, arg2, arg3, arg4) {
|
|
610
729
|
arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
@@ -912,9 +1031,6 @@ function __wbg_get_imports() {
|
|
|
912
1031
|
__wbg_now_e7c6795a7f81e10f: function(arg0) {
|
|
913
1032
|
return arg0.now();
|
|
914
1033
|
},
|
|
915
|
-
__wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
|
|
916
|
-
return Array.of(arg0, arg1);
|
|
917
|
-
},
|
|
918
1034
|
__wbg_parse_1c0d8a8656d7e016: function() {
|
|
919
1035
|
return handleError(function(arg0, arg1) {
|
|
920
1036
|
return JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
@@ -968,6 +1084,11 @@ function __wbg_get_imports() {
|
|
|
968
1084
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
969
1085
|
arg0[arg1] = arg2;
|
|
970
1086
|
},
|
|
1087
|
+
__wbg_set_8535240470bf2500: function() {
|
|
1088
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
1089
|
+
return Reflect.set(arg0, arg1, arg2);
|
|
1090
|
+
}, arguments);
|
|
1091
|
+
},
|
|
971
1092
|
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
972
1093
|
arg0[arg1 >>> 0] = arg2;
|
|
973
1094
|
},
|
|
@@ -1043,9 +1164,6 @@ function __wbg_get_imports() {
|
|
|
1043
1164
|
__wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
|
|
1044
1165
|
return arg0.then(arg1);
|
|
1045
1166
|
},
|
|
1046
|
-
__wbg_timeout_c971ded6d319fad2: function(arg0) {
|
|
1047
|
-
return AbortSignal.timeout(arg0 >>> 0);
|
|
1048
|
-
},
|
|
1049
1167
|
__wbg_url_abdb8fb08377f8c0: function(arg0, arg1) {
|
|
1050
1168
|
const ret = arg1.url;
|
|
1051
1169
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -1056,9 +1174,6 @@ function __wbg_get_imports() {
|
|
|
1056
1174
|
__wbg_value_a5d5488a9589444a: function(arg0) {
|
|
1057
1175
|
return arg0.value;
|
|
1058
1176
|
},
|
|
1059
|
-
__wbg_verification_new: function(arg0) {
|
|
1060
|
-
return Verification.__wrap(arg0);
|
|
1061
|
-
},
|
|
1062
1177
|
__wbg_view_21f1d4a4f175dfa9: function(arg0) {
|
|
1063
1178
|
const ret = arg0.view;
|
|
1064
1179
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
@@ -1070,7 +1185,7 @@ function __wbg_get_imports() {
|
|
|
1070
1185
|
return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
|
|
1071
1186
|
},
|
|
1072
1187
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1073
|
-
return makeMutClosure(arg0, arg1,
|
|
1188
|
+
return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5);
|
|
1074
1189
|
},
|
|
1075
1190
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
1076
1191
|
return arg0;
|
|
@@ -1087,16 +1202,6 @@ function __wbg_get_imports() {
|
|
|
1087
1202
|
__wbindgen_cast_0000000000000008: function(arg0) {
|
|
1088
1203
|
return BigInt.asUintN(64, arg0);
|
|
1089
1204
|
},
|
|
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
|
-
},
|
|
1100
1205
|
__wbindgen_init_externref_table: function() {
|
|
1101
1206
|
const table = wasm.__wbindgen_externrefs;
|
|
1102
1207
|
const offset = table.grow(4);
|
|
@@ -1109,8 +1214,8 @@ function __wbg_get_imports() {
|
|
|
1109
1214
|
}
|
|
1110
1215
|
};
|
|
1111
1216
|
}
|
|
1112
|
-
function
|
|
1113
|
-
wasm.
|
|
1217
|
+
function wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1) {
|
|
1218
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1);
|
|
1114
1219
|
}
|
|
1115
1220
|
function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
|
|
1116
1221
|
wasm.wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2);
|
|
@@ -1150,6 +1255,14 @@ const BlobSourceFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
|
1150
1255
|
register: () => {},
|
|
1151
1256
|
unregister: () => {}
|
|
1152
1257
|
} : 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));
|
|
1153
1266
|
const IntoUnderlyingByteSourceFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
1154
1267
|
register: () => {},
|
|
1155
1268
|
unregister: () => {}
|
|
@@ -1162,6 +1275,10 @@ const IntoUnderlyingSourceFinalization = typeof FinalizationRegistry === "undefi
|
|
|
1162
1275
|
register: () => {},
|
|
1163
1276
|
unregister: () => {}
|
|
1164
1277
|
} : 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));
|
|
1165
1282
|
const MemorySourceFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
1166
1283
|
register: () => {},
|
|
1167
1284
|
unregister: () => {}
|
|
@@ -1174,10 +1291,6 @@ const StreamVerifierFinalization = typeof FinalizationRegistry === "undefined" ?
|
|
|
1174
1291
|
register: () => {},
|
|
1175
1292
|
unregister: () => {}
|
|
1176
1293
|
} : 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));
|
|
1181
1294
|
function addToExternrefTable0(obj) {
|
|
1182
1295
|
const idx = wasm.__externref_table_alloc();
|
|
1183
1296
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
@@ -1221,14 +1334,6 @@ function debugString(val) {
|
|
|
1221
1334
|
if (val instanceof Error) return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1222
1335
|
return className;
|
|
1223
1336
|
}
|
|
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
|
-
}
|
|
1232
1337
|
function getArrayU8FromWasm0(ptr, len) {
|
|
1233
1338
|
ptr = ptr >>> 0;
|
|
1234
1339
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -1407,7 +1512,7 @@ async function __wbg_init(module_or_path) {
|
|
|
1407
1512
|
* a slice and a local file. Choosing the store is all that is left here.
|
|
1408
1513
|
*/
|
|
1409
1514
|
function source(asset) {
|
|
1410
|
-
return asset instanceof Blob ? new BlobSource(asset) : new
|
|
1515
|
+
return asset instanceof Blob ? new BlobSource(asset) : new BytesSource(asset instanceof Uint8Array ? asset : new Uint8Array(asset));
|
|
1411
1516
|
}
|
|
1412
1517
|
/**
|
|
1413
1518
|
* The caller's asset as the bytes a manifest read takes. A `Blob` is read here rather than in the
|
|
@@ -1417,6 +1522,13 @@ async function bytes(asset) {
|
|
|
1417
1522
|
if (asset instanceof Blob) return new Uint8Array(await asset.arrayBuffer());
|
|
1418
1523
|
return asset instanceof Uint8Array ? asset : new Uint8Array(asset);
|
|
1419
1524
|
}
|
|
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
|
+
}
|
|
1420
1532
|
/**
|
|
1421
1533
|
* A wasm object held in this thread on the caller's behalf.
|
|
1422
1534
|
*
|
|
@@ -1437,23 +1549,10 @@ var Handle = class {
|
|
|
1437
1549
|
this.inner.free();
|
|
1438
1550
|
}
|
|
1439
1551
|
};
|
|
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
|
-
};
|
|
1453
1552
|
var AssetVerifierHandle = class extends Handle {
|
|
1454
1553
|
/** `recovery` is what this verify may do to recover a manifest, as the direct import takes it. */
|
|
1455
|
-
|
|
1456
|
-
return
|
|
1554
|
+
verify(asset, recovery) {
|
|
1555
|
+
return this.inner.verify(source(asset), recovery);
|
|
1457
1556
|
}
|
|
1458
1557
|
};
|
|
1459
1558
|
/** One stream being validated. Dropping the handle releases the session it accumulated. */
|
|
@@ -1466,11 +1565,11 @@ var StreamSessionHandle = class extends Handle {
|
|
|
1466
1565
|
}
|
|
1467
1566
|
};
|
|
1468
1567
|
var StreamVerifierHandle = class extends Handle {
|
|
1469
|
-
open(
|
|
1470
|
-
return proxy(new StreamSessionHandle(this.inner.open(
|
|
1568
|
+
open(streamId) {
|
|
1569
|
+
return proxy(new StreamSessionHandle(this.inner.open(streamId)));
|
|
1471
1570
|
}
|
|
1472
|
-
resume(state) {
|
|
1473
|
-
return proxy(new StreamSessionHandle(this.inner.resume(state)));
|
|
1571
|
+
resume(streamId, state) {
|
|
1572
|
+
return proxy(new StreamSessionHandle(this.inner.resume(streamId, state)));
|
|
1474
1573
|
}
|
|
1475
1574
|
};
|
|
1476
1575
|
let ready;
|
|
@@ -1486,13 +1585,12 @@ const sdk = {
|
|
|
1486
1585
|
},
|
|
1487
1586
|
AssetVerifier: proxy({ create: (options) => proxy(new AssetVerifierHandle(AssetVerifier.create(options))) }),
|
|
1488
1587
|
StreamVerifier: proxy({ create: (options) => proxy(new StreamVerifierHandle(StreamVerifier.create(options))) }),
|
|
1588
|
+
Binder: proxy({
|
|
1489
1589
|
/**
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
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.
|
|
1492
1592
|
*/
|
|
1493
|
-
|
|
1494
|
-
return computeSoftBinding(alg, source(asset), format);
|
|
1495
|
-
},
|
|
1593
|
+
derive: (spec, content, options) => binder(spec).derive(source(content), options) }),
|
|
1496
1594
|
/**
|
|
1497
1595
|
* Read a detached manifest store. Contents, not a verdict: with no asset there is no hard binding
|
|
1498
1596
|
* to check, so the store's validation fields state nothing this established.
|
|
@@ -1507,11 +1605,20 @@ const sdk = {
|
|
|
1507
1605
|
async resource(manifest, uri) {
|
|
1508
1606
|
return resource(await bytes(manifest), uri);
|
|
1509
1607
|
},
|
|
1510
|
-
|
|
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,
|
|
1511
1618
|
close() {
|
|
1512
1619
|
setTimeout(() => self.close(), 0);
|
|
1513
1620
|
}
|
|
1514
1621
|
};
|
|
1515
1622
|
expose(sdk);
|
|
1516
1623
|
//#endregion
|
|
1517
|
-
export { AssetVerifierHandle, Handle, StreamSessionHandle, StreamVerifierHandle
|
|
1624
|
+
export { AssetVerifierHandle, Handle, StreamSessionHandle, StreamVerifierHandle };
|