@trylimbo/sdk-verifier-wasm 0.2.12-canary.28 → 0.2.12
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 +42 -46
- package/gen/wasm/trylimbo_sdk_verifier.js +17 -17
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm +0 -0
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm.d.ts +14 -14
- package/gen/wasm/worker-thread.js +20 -20
- package/gen/wasm/worker.d.ts +34 -39
- package/package.json +1 -1
|
@@ -44,10 +44,11 @@ export type BinderSpec = { kind: "iscc" } | { kind: "held"; binding: SoftBinding
|
|
|
44
44
|
/**
|
|
45
45
|
* A canonical gRPC/Connect status code: the coarse, closed failure class.
|
|
46
46
|
*
|
|
47
|
-
* The wasm lane projects this as
|
|
48
|
-
* narrows on `err.code === \"
|
|
47
|
+
* The wasm lane projects this as a camelCase string like every other tagged value
|
|
48
|
+
* there, so a consumer narrows on `err.code === \"resourceExhausted\"`; the native lane
|
|
49
|
+
* projects an enum.
|
|
49
50
|
*/
|
|
50
|
-
export type Code = "canceled" | "unknown" | "
|
|
51
|
+
export type Code = "canceled" | "unknown" | "invalidArgument" | "deadlineExceeded" | "notFound" | "alreadyExists" | "permissionDenied" | "resourceExhausted" | "failedPrecondition" | "aborted" | "outOfRange" | "unimplemented" | "internal" | "unavailable" | "dataLoss" | "unauthenticated";
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* A request-validation fault, `google.rpc.BadRequest` (`kind: \"invalid\"`).
|
|
@@ -224,7 +225,7 @@ export interface FieldViolation {
|
|
|
224
225
|
* One `verify` credential: the c2pa `ManifestStore`, where it came from, whether the asset\'s
|
|
225
226
|
* own fingerprint backs it up, and whether its hard binding holds over the bytes read.
|
|
226
227
|
*/
|
|
227
|
-
export interface
|
|
228
|
+
export interface Credential {
|
|
228
229
|
/**
|
|
229
230
|
* The bytes behind every thumbnail the manifests reference, by that reference\'s
|
|
230
231
|
* `identifier`: each manifest\'s claim thumbnail and each ingredient\'s. The manifests state
|
|
@@ -268,7 +269,7 @@ export interface InitValidation {
|
|
|
268
269
|
}
|
|
269
270
|
|
|
270
271
|
/**
|
|
271
|
-
* Result of `
|
|
272
|
+
* Result of `StreamSession.validate`, discriminated by `kind`.
|
|
272
273
|
*/
|
|
273
274
|
export type SegmentValidation = ({ kind: "init" } & InitValidation) | ({ kind: "media" } & MediaValidation) | { kind: "unknown" };
|
|
274
275
|
|
|
@@ -304,7 +305,7 @@ export interface SegmentTiming {
|
|
|
304
305
|
* not to be called. It needs a configured repository and at least one query.
|
|
305
306
|
*/
|
|
306
307
|
export interface Recovery {
|
|
307
|
-
when:
|
|
308
|
+
when: RecoveryTrigger;
|
|
308
309
|
binders: BinderSpec[];
|
|
309
310
|
byContent?: ByContent;
|
|
310
311
|
byReference?: ByReference;
|
|
@@ -313,7 +314,7 @@ export interface Recovery {
|
|
|
313
314
|
/**
|
|
314
315
|
* When [`AssetVerifier::verify_asset`] queries the repository.
|
|
315
316
|
*/
|
|
316
|
-
export type
|
|
317
|
+
export type RecoveryTrigger = "manifestMissing" | "always";
|
|
317
318
|
|
|
318
319
|
/**
|
|
319
320
|
* Whether a code is a success, an informational note, or a failure.
|
|
@@ -325,6 +326,18 @@ export type ValidationCodeKind = "success" | "informational" | "failure";
|
|
|
325
326
|
*/
|
|
326
327
|
export type ContentTrigger = "byBindingMisses" | "always";
|
|
327
328
|
|
|
329
|
+
/**
|
|
330
|
+
* [`crate::asset::ByReference`] as JS states it: the region is the `Range` of
|
|
331
|
+
* `@contentauth/c2pa-types`, the shape a credential\'s actions carry.
|
|
332
|
+
*/
|
|
333
|
+
export interface ByReference {
|
|
334
|
+
after: ContentTrigger;
|
|
335
|
+
url: string;
|
|
336
|
+
length: number;
|
|
337
|
+
mediaType?: string;
|
|
338
|
+
region: import('@contentauth/c2pa-types').Range[];
|
|
339
|
+
}
|
|
340
|
+
|
|
328
341
|
/**
|
|
329
342
|
* [`crate::asset::CredentialOrigin`] as JS sees it: a tagged union, since each way of finding a
|
|
330
343
|
* credential carries different evidence. Lane-local for the same reason [`FingerprintCheck`] is: a
|
|
@@ -342,7 +355,7 @@ export type FingerprintCheck = { kind: "notNeeded" } | { kind: "nothingToCompare
|
|
|
342
355
|
/**
|
|
343
356
|
* [`crate::asset::HardBinding`] as JS sees it.
|
|
344
357
|
*/
|
|
345
|
-
export type HardBinding = "
|
|
358
|
+
export type HardBinding = "match" | "mismatch";
|
|
346
359
|
|
|
347
360
|
/**
|
|
348
361
|
* [`crate::asset::Lineage`] as JS sees it.
|
|
@@ -355,7 +368,7 @@ export interface Lineage {
|
|
|
355
368
|
/**
|
|
356
369
|
* [`crate::asset::RecoveryIssue`] as JS sees it: a tagged union, each kind with its own data.
|
|
357
370
|
*/
|
|
358
|
-
export type RecoveryIssue = { kind: "
|
|
371
|
+
export type RecoveryIssue = { kind: "binderFailed"; binderIndex: number; message: string } | { kind: "algorithmDeprecated"; algorithm: string } | { kind: "bindingUndeclared"; binderIndex: number; algorithm: string } | { kind: "bindingQueryFailed"; repository: string; binderIndex: number; algorithm: string; message: string } | { kind: "queryRefused"; repository: string; algorithm: string; message: string } | { kind: "contentFormUnsupported"; repository: string; message: string } | { kind: "contentQueryFailed"; repository: string; algorithm: string; message: string } | { kind: "capabilitiesUnavailable"; repository: string; message: string } | { kind: "contentTooLarge"; capBytes: number } | { kind: "candidateFetchFailed"; repository: string; manifestId: string; message: string } | { kind: "candidateInvalid"; manifestId: string; reason: string } | { kind: "endpointRefused"; repository: string; manifestId: string; endpoint: string } | { kind: "resourceLimitReached"; message: string };
|
|
359
372
|
|
|
360
373
|
/**
|
|
361
374
|
* [`crate::asset::VerdictRule`] as JS sees it.
|
|
@@ -375,25 +388,8 @@ export interface ByContent {
|
|
|
375
388
|
after: ContentTrigger;
|
|
376
389
|
}
|
|
377
390
|
|
|
378
|
-
/**
|
|
379
|
-
* `matches/byReference`: each repository downloads the asset from `url`, one request per
|
|
380
|
-
* algorithm it is declared for, so the client reads no bytes for it.
|
|
381
|
-
*/
|
|
382
|
-
export interface ByReference {
|
|
383
|
-
after: ContentTrigger;
|
|
384
|
-
/**
|
|
385
|
-
* A short-lived https URL without credentials.
|
|
386
|
-
*/
|
|
387
|
-
url: string;
|
|
388
|
-
/**
|
|
389
|
-
* The asset\'s size in bytes, which caps the repository\'s download.
|
|
390
|
-
*/
|
|
391
|
-
length: number;
|
|
392
|
-
mediaType?: string;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
391
|
export interface AssetVerification {
|
|
396
|
-
credentials:
|
|
392
|
+
credentials: Credential[];
|
|
397
393
|
recovery: RecoverySummary;
|
|
398
394
|
goldenComparison: GoldenComparison;
|
|
399
395
|
verdict: Verdict;
|
|
@@ -595,7 +591,7 @@ export class MemorySource {
|
|
|
595
591
|
* One stream being validated. It owns the session keys and manifest ids its init segments
|
|
596
592
|
* advertised, so releasing the stream is dropping this object.
|
|
597
593
|
*/
|
|
598
|
-
export class
|
|
594
|
+
export class StreamSession {
|
|
599
595
|
private constructor();
|
|
600
596
|
free(): void;
|
|
601
597
|
[Symbol.dispose](): void;
|
|
@@ -638,14 +634,14 @@ export class StreamVerifier {
|
|
|
638
634
|
*/
|
|
639
635
|
static create(options: StreamVerifierOptions): StreamVerifier;
|
|
640
636
|
/**
|
|
641
|
-
* Open `stream_id` for validation, handing back a `
|
|
637
|
+
* Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
|
|
642
638
|
*
|
|
643
639
|
* No I/O: the handle carries the id so it cannot be mistyped or confused with another
|
|
644
640
|
* stream's, and classification still happens per segment. Opening one id twice hands
|
|
645
641
|
* back the same live session, so a component that remounts keeps the state its earlier
|
|
646
642
|
* handle accumulated.
|
|
647
643
|
*/
|
|
648
|
-
open(stream_id: string):
|
|
644
|
+
open(stream_id: string): StreamSession;
|
|
649
645
|
/**
|
|
650
646
|
* Open `stream_id` on the state another node exported, merged into whatever this one
|
|
651
647
|
* holds for that id already.
|
|
@@ -653,9 +649,9 @@ export class StreamVerifier {
|
|
|
653
649
|
* # Errors
|
|
654
650
|
*
|
|
655
651
|
* Throws an `SdkError` (`STREAM_INVALID`) when `state` is not a value
|
|
656
|
-
* `
|
|
652
|
+
* `StreamSession.export` produced, or carries a version this SDK no longer reads.
|
|
657
653
|
*/
|
|
658
|
-
resume(stream_id: string, state: Uint8Array):
|
|
654
|
+
resume(stream_id: string, state: Uint8Array): StreamSession;
|
|
659
655
|
}
|
|
660
656
|
|
|
661
657
|
export function init_panic_hook(): void;
|
|
@@ -713,9 +709,9 @@ export interface InitOutput {
|
|
|
713
709
|
readonly __wbg_assetverifier_free: (a: number, b: number) => void;
|
|
714
710
|
readonly __wbg_blobsource_free: (a: number, b: number) => void;
|
|
715
711
|
readonly __wbg_bytessource_free: (a: number, b: number) => void;
|
|
716
|
-
readonly __wbg_heldbinder_free: (a: number, b: number) => void;
|
|
717
|
-
readonly __wbg_isccbinder_free: (a: number, b: number) => void;
|
|
718
712
|
readonly __wbg_memorysource_free: (a: number, b: number) => void;
|
|
713
|
+
readonly __wbg_streamsession_free: (a: number, b: number) => void;
|
|
714
|
+
readonly __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
719
715
|
readonly assetverifier_create: (a: any) => [number, number, number];
|
|
720
716
|
readonly assetverifier_verify: (a: number, b: any, c: number) => any;
|
|
721
717
|
readonly blobsource_length: (a: number) => number;
|
|
@@ -724,27 +720,27 @@ export interface InitOutput {
|
|
|
724
720
|
readonly bytessource_length: (a: number) => number;
|
|
725
721
|
readonly bytessource_new: (a: any) => number;
|
|
726
722
|
readonly bytessource_readAt: (a: number, b: number, c: number) => any;
|
|
727
|
-
readonly heldbinder_derive: (a: number, b: any, c: any) => any;
|
|
728
|
-
readonly heldbinder_new: (a: any) => [number, number, number];
|
|
729
|
-
readonly isccbinder_derive: (a: number, b: any, c: any) => any;
|
|
730
|
-
readonly isccbinder_new: () => number;
|
|
731
723
|
readonly memorysource_length: (a: number) => number;
|
|
732
724
|
readonly memorysource_new: (a: number, b: number) => number;
|
|
733
725
|
readonly memorysource_readAt: (a: number, b: number, c: number) => any;
|
|
734
|
-
readonly C2PA_TRUST_LIST: () => [number, number];
|
|
735
|
-
readonly C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
736
|
-
readonly DEV_CA: () => [number, number];
|
|
737
|
-
readonly init_panic_hook: () => void;
|
|
738
|
-
readonly __wbg_streamvalidation_free: (a: number, b: number) => void;
|
|
739
|
-
readonly __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
740
726
|
readonly parse: (a: number, b: number) => [number, number, number];
|
|
741
727
|
readonly resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
742
|
-
readonly
|
|
743
|
-
readonly
|
|
728
|
+
readonly streamsession_export: (a: number) => [number, number, number, number];
|
|
729
|
+
readonly streamsession_validate: (a: number, b: any) => any;
|
|
744
730
|
readonly streamverifier_create: (a: any) => [number, number, number];
|
|
745
731
|
readonly streamverifier_open: (a: number, b: number, c: number) => number;
|
|
746
732
|
readonly streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
747
733
|
readonly thumbnails: (a: number, b: number) => [number, number, number];
|
|
734
|
+
readonly C2PA_TRUST_LIST: () => [number, number];
|
|
735
|
+
readonly C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
736
|
+
readonly DEV_CA: () => [number, number];
|
|
737
|
+
readonly init_panic_hook: () => void;
|
|
738
|
+
readonly __wbg_heldbinder_free: (a: number, b: number) => void;
|
|
739
|
+
readonly __wbg_isccbinder_free: (a: number, b: number) => void;
|
|
740
|
+
readonly heldbinder_derive: (a: number, b: any, c: any) => any;
|
|
741
|
+
readonly heldbinder_new: (a: any) => [number, number, number];
|
|
742
|
+
readonly isccbinder_derive: (a: number, b: any, c: any) => any;
|
|
743
|
+
readonly isccbinder_new: () => number;
|
|
748
744
|
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
749
745
|
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
750
746
|
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
@@ -474,22 +474,22 @@ if (Symbol.dispose) MemorySource.prototype[Symbol.dispose] = MemorySource.protot
|
|
|
474
474
|
* One stream being validated. It owns the session keys and manifest ids its init segments
|
|
475
475
|
* advertised, so releasing the stream is dropping this object.
|
|
476
476
|
*/
|
|
477
|
-
export class
|
|
477
|
+
export class StreamSession {
|
|
478
478
|
static __wrap(ptr) {
|
|
479
|
-
const obj = Object.create(
|
|
479
|
+
const obj = Object.create(StreamSession.prototype);
|
|
480
480
|
obj.__wbg_ptr = ptr;
|
|
481
|
-
|
|
481
|
+
StreamSessionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
482
482
|
return obj;
|
|
483
483
|
}
|
|
484
484
|
__destroy_into_raw() {
|
|
485
485
|
const ptr = this.__wbg_ptr;
|
|
486
486
|
this.__wbg_ptr = 0;
|
|
487
|
-
|
|
487
|
+
StreamSessionFinalization.unregister(this);
|
|
488
488
|
return ptr;
|
|
489
489
|
}
|
|
490
490
|
free() {
|
|
491
491
|
const ptr = this.__destroy_into_raw();
|
|
492
|
-
wasm.
|
|
492
|
+
wasm.__wbg_streamsession_free(ptr, 0);
|
|
493
493
|
}
|
|
494
494
|
/**
|
|
495
495
|
* Everything this stream's init segments have registered, as CBOR for another node to
|
|
@@ -507,7 +507,7 @@ export class StreamValidation {
|
|
|
507
507
|
* @returns {Uint8Array}
|
|
508
508
|
*/
|
|
509
509
|
export() {
|
|
510
|
-
const ret = wasm.
|
|
510
|
+
const ret = wasm.streamsession_export(this.__wbg_ptr);
|
|
511
511
|
if (ret[3]) {
|
|
512
512
|
throw takeFromExternrefTable0(ret[2]);
|
|
513
513
|
}
|
|
@@ -526,11 +526,11 @@ export class StreamValidation {
|
|
|
526
526
|
* @returns {Promise<SegmentValidation>}
|
|
527
527
|
*/
|
|
528
528
|
validate(data) {
|
|
529
|
-
const ret = wasm.
|
|
529
|
+
const ret = wasm.streamsession_validate(this.__wbg_ptr, data);
|
|
530
530
|
return ret;
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
|
-
if (Symbol.dispose)
|
|
533
|
+
if (Symbol.dispose) StreamSession.prototype[Symbol.dispose] = StreamSession.prototype.free;
|
|
534
534
|
|
|
535
535
|
export class StreamVerifier {
|
|
536
536
|
static __wrap(ptr) {
|
|
@@ -566,20 +566,20 @@ export class StreamVerifier {
|
|
|
566
566
|
return StreamVerifier.__wrap(ret[0]);
|
|
567
567
|
}
|
|
568
568
|
/**
|
|
569
|
-
* Open `stream_id` for validation, handing back a `
|
|
569
|
+
* Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
|
|
570
570
|
*
|
|
571
571
|
* No I/O: the handle carries the id so it cannot be mistyped or confused with another
|
|
572
572
|
* stream's, and classification still happens per segment. Opening one id twice hands
|
|
573
573
|
* back the same live session, so a component that remounts keeps the state its earlier
|
|
574
574
|
* handle accumulated.
|
|
575
575
|
* @param {string} stream_id
|
|
576
|
-
* @returns {
|
|
576
|
+
* @returns {StreamSession}
|
|
577
577
|
*/
|
|
578
578
|
open(stream_id) {
|
|
579
579
|
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
580
580
|
const len0 = WASM_VECTOR_LEN;
|
|
581
581
|
const ret = wasm.streamverifier_open(this.__wbg_ptr, ptr0, len0);
|
|
582
|
-
return
|
|
582
|
+
return StreamSession.__wrap(ret);
|
|
583
583
|
}
|
|
584
584
|
/**
|
|
585
585
|
* Open `stream_id` on the state another node exported, merged into whatever this one
|
|
@@ -588,10 +588,10 @@ export class StreamVerifier {
|
|
|
588
588
|
* # Errors
|
|
589
589
|
*
|
|
590
590
|
* Throws an `SdkError` (`STREAM_INVALID`) when `state` is not a value
|
|
591
|
-
* `
|
|
591
|
+
* `StreamSession.export` produced, or carries a version this SDK no longer reads.
|
|
592
592
|
* @param {string} stream_id
|
|
593
593
|
* @param {Uint8Array} state
|
|
594
|
-
* @returns {
|
|
594
|
+
* @returns {StreamSession}
|
|
595
595
|
*/
|
|
596
596
|
resume(stream_id, state) {
|
|
597
597
|
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -602,7 +602,7 @@ export class StreamVerifier {
|
|
|
602
602
|
if (ret[2]) {
|
|
603
603
|
throw takeFromExternrefTable0(ret[1]);
|
|
604
604
|
}
|
|
605
|
-
return
|
|
605
|
+
return StreamSession.__wrap(ret[0]);
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
|
|
@@ -1269,7 +1269,7 @@ function __wbg_get_imports() {
|
|
|
1269
1269
|
return ret;
|
|
1270
1270
|
},
|
|
1271
1271
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1272
|
-
// 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`.
|
|
1273
1273
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
|
|
1274
1274
|
return ret;
|
|
1275
1275
|
},
|
|
@@ -1376,9 +1376,9 @@ const IsccBinderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1376
1376
|
const MemorySourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1377
1377
|
? { register: () => {}, unregister: () => {} }
|
|
1378
1378
|
: new FinalizationRegistry(ptr => wasm.__wbg_memorysource_free(ptr, 1));
|
|
1379
|
-
const
|
|
1379
|
+
const StreamSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1380
1380
|
? { register: () => {}, unregister: () => {} }
|
|
1381
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
1381
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_streamsession_free(ptr, 1));
|
|
1382
1382
|
const StreamVerifierFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1383
1383
|
? { register: () => {}, unregister: () => {} }
|
|
1384
1384
|
: new FinalizationRegistry(ptr => wasm.__wbg_streamverifier_free(ptr, 1));
|
|
Binary file
|
|
@@ -4,9 +4,9 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const __wbg_assetverifier_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_blobsource_free: (a: number, b: number) => void;
|
|
6
6
|
export const __wbg_bytessource_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_heldbinder_free: (a: number, b: number) => void;
|
|
8
|
-
export const __wbg_isccbinder_free: (a: number, b: number) => void;
|
|
9
7
|
export const __wbg_memorysource_free: (a: number, b: number) => void;
|
|
8
|
+
export const __wbg_streamsession_free: (a: number, b: number) => void;
|
|
9
|
+
export const __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
10
10
|
export const assetverifier_create: (a: any) => [number, number, number];
|
|
11
11
|
export const assetverifier_verify: (a: number, b: any, c: number) => any;
|
|
12
12
|
export const blobsource_length: (a: number) => number;
|
|
@@ -15,27 +15,27 @@ export const blobsource_readAt: (a: number, b: number, c: number) => [number, nu
|
|
|
15
15
|
export const bytessource_length: (a: number) => number;
|
|
16
16
|
export const bytessource_new: (a: any) => number;
|
|
17
17
|
export const bytessource_readAt: (a: number, b: number, c: number) => any;
|
|
18
|
-
export const heldbinder_derive: (a: number, b: any, c: any) => any;
|
|
19
|
-
export const heldbinder_new: (a: any) => [number, number, number];
|
|
20
|
-
export const isccbinder_derive: (a: number, b: any, c: any) => any;
|
|
21
|
-
export const isccbinder_new: () => number;
|
|
22
18
|
export const memorysource_length: (a: number) => number;
|
|
23
19
|
export const memorysource_new: (a: number, b: number) => number;
|
|
24
20
|
export const memorysource_readAt: (a: number, b: number, c: number) => any;
|
|
25
|
-
export const C2PA_TRUST_LIST: () => [number, number];
|
|
26
|
-
export const C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
27
|
-
export const DEV_CA: () => [number, number];
|
|
28
|
-
export const init_panic_hook: () => void;
|
|
29
|
-
export const __wbg_streamvalidation_free: (a: number, b: number) => void;
|
|
30
|
-
export const __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
31
21
|
export const parse: (a: number, b: number) => [number, number, number];
|
|
32
22
|
export const resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
23
|
+
export const streamsession_export: (a: number) => [number, number, number, number];
|
|
24
|
+
export const streamsession_validate: (a: number, b: any) => any;
|
|
35
25
|
export const streamverifier_create: (a: any) => [number, number, number];
|
|
36
26
|
export const streamverifier_open: (a: number, b: number, c: number) => number;
|
|
37
27
|
export const streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
38
28
|
export const thumbnails: (a: number, b: number) => [number, number, number];
|
|
29
|
+
export const C2PA_TRUST_LIST: () => [number, number];
|
|
30
|
+
export const C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
31
|
+
export const DEV_CA: () => [number, number];
|
|
32
|
+
export const init_panic_hook: () => void;
|
|
33
|
+
export const __wbg_heldbinder_free: (a: number, b: number) => void;
|
|
34
|
+
export const __wbg_isccbinder_free: (a: number, b: number) => void;
|
|
35
|
+
export const heldbinder_derive: (a: number, b: any, c: any) => any;
|
|
36
|
+
export const heldbinder_new: (a: any) => [number, number, number];
|
|
37
|
+
export const isccbinder_derive: (a: number, b: any, c: any) => any;
|
|
38
|
+
export const isccbinder_new: () => number;
|
|
39
39
|
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
40
40
|
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
41
41
|
export const intounderlyingbytesource_cancel: (a: number) => void;
|
|
@@ -440,22 +440,22 @@ if (Symbol.dispose) MemorySource.prototype[Symbol.dispose] = MemorySource.protot
|
|
|
440
440
|
* One stream being validated. It owns the session keys and manifest ids its init segments
|
|
441
441
|
* advertised, so releasing the stream is dropping this object.
|
|
442
442
|
*/
|
|
443
|
-
var
|
|
443
|
+
var StreamSession = class StreamSession {
|
|
444
444
|
static __wrap(ptr) {
|
|
445
|
-
const obj = Object.create(
|
|
445
|
+
const obj = Object.create(StreamSession.prototype);
|
|
446
446
|
obj.__wbg_ptr = ptr;
|
|
447
|
-
|
|
447
|
+
StreamSessionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
448
448
|
return obj;
|
|
449
449
|
}
|
|
450
450
|
__destroy_into_raw() {
|
|
451
451
|
const ptr = this.__wbg_ptr;
|
|
452
452
|
this.__wbg_ptr = 0;
|
|
453
|
-
|
|
453
|
+
StreamSessionFinalization.unregister(this);
|
|
454
454
|
return ptr;
|
|
455
455
|
}
|
|
456
456
|
free() {
|
|
457
457
|
const ptr = this.__destroy_into_raw();
|
|
458
|
-
wasm.
|
|
458
|
+
wasm.__wbg_streamsession_free(ptr, 0);
|
|
459
459
|
}
|
|
460
460
|
/**
|
|
461
461
|
* Everything this stream's init segments have registered, as CBOR for another node to
|
|
@@ -473,7 +473,7 @@ var StreamValidation = class StreamValidation {
|
|
|
473
473
|
* @returns {Uint8Array}
|
|
474
474
|
*/
|
|
475
475
|
export() {
|
|
476
|
-
const ret = wasm.
|
|
476
|
+
const ret = wasm.streamsession_export(this.__wbg_ptr);
|
|
477
477
|
if (ret[3]) throw takeFromExternrefTable0(ret[2]);
|
|
478
478
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
479
479
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
@@ -490,10 +490,10 @@ var StreamValidation = class StreamValidation {
|
|
|
490
490
|
* @returns {Promise<SegmentValidation>}
|
|
491
491
|
*/
|
|
492
492
|
validate(data) {
|
|
493
|
-
return wasm.
|
|
493
|
+
return wasm.streamsession_validate(this.__wbg_ptr, data);
|
|
494
494
|
}
|
|
495
495
|
};
|
|
496
|
-
if (Symbol.dispose)
|
|
496
|
+
if (Symbol.dispose) StreamSession.prototype[Symbol.dispose] = StreamSession.prototype.free;
|
|
497
497
|
var StreamVerifier = class StreamVerifier {
|
|
498
498
|
static __wrap(ptr) {
|
|
499
499
|
const obj = Object.create(StreamVerifier.prototype);
|
|
@@ -526,20 +526,20 @@ var StreamVerifier = class StreamVerifier {
|
|
|
526
526
|
return StreamVerifier.__wrap(ret[0]);
|
|
527
527
|
}
|
|
528
528
|
/**
|
|
529
|
-
* Open `stream_id` for validation, handing back a `
|
|
529
|
+
* Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
|
|
530
530
|
*
|
|
531
531
|
* No I/O: the handle carries the id so it cannot be mistyped or confused with another
|
|
532
532
|
* stream's, and classification still happens per segment. Opening one id twice hands
|
|
533
533
|
* back the same live session, so a component that remounts keeps the state its earlier
|
|
534
534
|
* handle accumulated.
|
|
535
535
|
* @param {string} stream_id
|
|
536
|
-
* @returns {
|
|
536
|
+
* @returns {StreamSession}
|
|
537
537
|
*/
|
|
538
538
|
open(stream_id) {
|
|
539
539
|
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
540
540
|
const len0 = WASM_VECTOR_LEN;
|
|
541
541
|
const ret = wasm.streamverifier_open(this.__wbg_ptr, ptr0, len0);
|
|
542
|
-
return
|
|
542
|
+
return StreamSession.__wrap(ret);
|
|
543
543
|
}
|
|
544
544
|
/**
|
|
545
545
|
* Open `stream_id` on the state another node exported, merged into whatever this one
|
|
@@ -548,10 +548,10 @@ var StreamVerifier = class StreamVerifier {
|
|
|
548
548
|
* # Errors
|
|
549
549
|
*
|
|
550
550
|
* Throws an `SdkError` (`STREAM_INVALID`) when `state` is not a value
|
|
551
|
-
* `
|
|
551
|
+
* `StreamSession.export` produced, or carries a version this SDK no longer reads.
|
|
552
552
|
* @param {string} stream_id
|
|
553
553
|
* @param {Uint8Array} state
|
|
554
|
-
* @returns {
|
|
554
|
+
* @returns {StreamSession}
|
|
555
555
|
*/
|
|
556
556
|
resume(stream_id, state) {
|
|
557
557
|
const ptr0 = passStringToWasm0(stream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -560,7 +560,7 @@ var StreamVerifier = class StreamVerifier {
|
|
|
560
560
|
const len1 = WASM_VECTOR_LEN;
|
|
561
561
|
const ret = wasm.streamverifier_resume(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
562
562
|
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
563
|
-
return
|
|
563
|
+
return StreamSession.__wrap(ret[0]);
|
|
564
564
|
}
|
|
565
565
|
};
|
|
566
566
|
if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
|
|
@@ -1283,10 +1283,10 @@ const MemorySourceFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
|
1283
1283
|
register: () => {},
|
|
1284
1284
|
unregister: () => {}
|
|
1285
1285
|
} : new FinalizationRegistry((ptr) => wasm.__wbg_memorysource_free(ptr, 1));
|
|
1286
|
-
const
|
|
1286
|
+
const StreamSessionFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
1287
1287
|
register: () => {},
|
|
1288
1288
|
unregister: () => {}
|
|
1289
|
-
} : new FinalizationRegistry((ptr) => wasm.
|
|
1289
|
+
} : new FinalizationRegistry((ptr) => wasm.__wbg_streamsession_free(ptr, 1));
|
|
1290
1290
|
const StreamVerifierFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
1291
1291
|
register: () => {},
|
|
1292
1292
|
unregister: () => {}
|
|
@@ -1556,7 +1556,7 @@ var AssetVerifierHandle = class extends Handle {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
};
|
|
1558
1558
|
/** One stream being validated. Dropping the handle releases the session it accumulated. */
|
|
1559
|
-
var
|
|
1559
|
+
var StreamSessionHandle = class extends Handle {
|
|
1560
1560
|
validate(segment) {
|
|
1561
1561
|
return this.inner.validate(source(segment));
|
|
1562
1562
|
}
|
|
@@ -1566,10 +1566,10 @@ var StreamValidationHandle = class extends Handle {
|
|
|
1566
1566
|
};
|
|
1567
1567
|
var StreamVerifierHandle = class extends Handle {
|
|
1568
1568
|
open(streamId) {
|
|
1569
|
-
return proxy(new
|
|
1569
|
+
return proxy(new StreamSessionHandle(this.inner.open(streamId)));
|
|
1570
1570
|
}
|
|
1571
1571
|
resume(streamId, state) {
|
|
1572
|
-
return proxy(new
|
|
1572
|
+
return proxy(new StreamSessionHandle(this.inner.resume(streamId, state)));
|
|
1573
1573
|
}
|
|
1574
1574
|
};
|
|
1575
1575
|
let ready;
|
|
@@ -1621,4 +1621,4 @@ derive: (spec, content, options) => binder(spec).derive(source(content), options
|
|
|
1621
1621
|
};
|
|
1622
1622
|
expose(sdk);
|
|
1623
1623
|
//#endregion
|
|
1624
|
-
export { AssetVerifierHandle, Handle,
|
|
1624
|
+
export { AssetVerifierHandle, Handle, StreamSessionHandle, StreamVerifierHandle };
|
package/gen/wasm/worker.d.ts
CHANGED
|
@@ -329,7 +329,7 @@ interface ValidationCode {
|
|
|
329
329
|
* One `verify` credential: the c2pa `ManifestStore`, where it came from, whether the asset\'s
|
|
330
330
|
* own fingerprint backs it up, and whether its hard binding holds over the bytes read.
|
|
331
331
|
*/
|
|
332
|
-
interface
|
|
332
|
+
interface Credential {
|
|
333
333
|
/**
|
|
334
334
|
* The bytes behind every thumbnail the manifests reference, by that reference\'s
|
|
335
335
|
* `identifier`: each manifest\'s claim thumbnail and each ingredient\'s. The manifests state
|
|
@@ -370,7 +370,7 @@ interface InitValidation {
|
|
|
370
370
|
sessionKeys: SessionKeySummary[];
|
|
371
371
|
}
|
|
372
372
|
/**
|
|
373
|
-
* Result of `
|
|
373
|
+
* Result of `StreamSession.validate`, discriminated by `kind`.
|
|
374
374
|
*/
|
|
375
375
|
type SegmentValidation = ({
|
|
376
376
|
kind: "init";
|
|
@@ -402,7 +402,7 @@ interface SegmentTiming {
|
|
|
402
402
|
* not to be called. It needs a configured repository and at least one query.
|
|
403
403
|
*/
|
|
404
404
|
interface Recovery {
|
|
405
|
-
when:
|
|
405
|
+
when: RecoveryTrigger;
|
|
406
406
|
binders: BinderSpec[];
|
|
407
407
|
byContent?: ByContent;
|
|
408
408
|
byReference?: ByReference;
|
|
@@ -410,7 +410,7 @@ interface Recovery {
|
|
|
410
410
|
/**
|
|
411
411
|
* When [`AssetVerifier::verify_asset`] queries the repository.
|
|
412
412
|
*/
|
|
413
|
-
type
|
|
413
|
+
type RecoveryTrigger = "manifestMissing" | "always";
|
|
414
414
|
/**
|
|
415
415
|
* Whether a code is a success, an informational note, or a failure.
|
|
416
416
|
*/
|
|
@@ -419,6 +419,17 @@ type ValidationCodeKind = "success" | "informational" | "failure";
|
|
|
419
419
|
* Whether a content form runs on this verify. Judged against the byBinding results alone.
|
|
420
420
|
*/
|
|
421
421
|
type ContentTrigger = "byBindingMisses" | "always";
|
|
422
|
+
/**
|
|
423
|
+
* [`crate::asset::ByReference`] as JS states it: the region is the `Range` of
|
|
424
|
+
* `@contentauth/c2pa-types`, the shape a credential\'s actions carry.
|
|
425
|
+
*/
|
|
426
|
+
interface ByReference {
|
|
427
|
+
after: ContentTrigger;
|
|
428
|
+
url: string;
|
|
429
|
+
length: number;
|
|
430
|
+
mediaType?: string;
|
|
431
|
+
region: import('@contentauth/c2pa-types').Range[];
|
|
432
|
+
}
|
|
422
433
|
/**
|
|
423
434
|
* [`crate::asset::CredentialOrigin`] as JS sees it: a tagged union, since each way of finding a
|
|
424
435
|
* credential carries different evidence. Lane-local for the same reason [`FingerprintCheck`] is: a
|
|
@@ -452,7 +463,7 @@ type FingerprintCheck = {
|
|
|
452
463
|
/**
|
|
453
464
|
* [`crate::asset::HardBinding`] as JS sees it.
|
|
454
465
|
*/
|
|
455
|
-
type HardBinding = "
|
|
466
|
+
type HardBinding = "match" | "mismatch";
|
|
456
467
|
/**
|
|
457
468
|
* [`crate::asset::Lineage`] as JS sees it.
|
|
458
469
|
*/
|
|
@@ -464,18 +475,18 @@ interface Lineage {
|
|
|
464
475
|
* [`crate::asset::RecoveryIssue`] as JS sees it: a tagged union, each kind with its own data.
|
|
465
476
|
*/
|
|
466
477
|
type RecoveryIssue = {
|
|
467
|
-
kind: "
|
|
478
|
+
kind: "binderFailed";
|
|
468
479
|
binderIndex: number;
|
|
469
480
|
message: string;
|
|
470
481
|
} | {
|
|
471
|
-
kind: "
|
|
482
|
+
kind: "algorithmDeprecated";
|
|
472
483
|
algorithm: string;
|
|
473
484
|
} | {
|
|
474
485
|
kind: "bindingUndeclared";
|
|
475
486
|
binderIndex: number;
|
|
476
487
|
algorithm: string;
|
|
477
488
|
} | {
|
|
478
|
-
kind: "
|
|
489
|
+
kind: "bindingQueryFailed";
|
|
479
490
|
repository: string;
|
|
480
491
|
binderIndex: number;
|
|
481
492
|
algorithm: string;
|
|
@@ -486,28 +497,28 @@ type RecoveryIssue = {
|
|
|
486
497
|
algorithm: string;
|
|
487
498
|
message: string;
|
|
488
499
|
} | {
|
|
489
|
-
kind: "
|
|
500
|
+
kind: "contentFormUnsupported";
|
|
490
501
|
repository: string;
|
|
491
502
|
message: string;
|
|
492
503
|
} | {
|
|
493
|
-
kind: "
|
|
504
|
+
kind: "contentQueryFailed";
|
|
494
505
|
repository: string;
|
|
495
506
|
algorithm: string;
|
|
496
507
|
message: string;
|
|
497
508
|
} | {
|
|
498
|
-
kind: "
|
|
509
|
+
kind: "capabilitiesUnavailable";
|
|
499
510
|
repository: string;
|
|
500
511
|
message: string;
|
|
501
512
|
} | {
|
|
502
513
|
kind: "contentTooLarge";
|
|
503
514
|
capBytes: number;
|
|
504
515
|
} | {
|
|
505
|
-
kind: "
|
|
516
|
+
kind: "candidateFetchFailed";
|
|
506
517
|
repository: string;
|
|
507
518
|
manifestId: string;
|
|
508
519
|
message: string;
|
|
509
520
|
} | {
|
|
510
|
-
kind: "
|
|
521
|
+
kind: "candidateInvalid";
|
|
511
522
|
manifestId: string;
|
|
512
523
|
reason: string;
|
|
513
524
|
} | {
|
|
@@ -516,7 +527,7 @@ type RecoveryIssue = {
|
|
|
516
527
|
manifestId: string;
|
|
517
528
|
endpoint: string;
|
|
518
529
|
} | {
|
|
519
|
-
kind: "
|
|
530
|
+
kind: "resourceLimitReached";
|
|
520
531
|
message: string;
|
|
521
532
|
};
|
|
522
533
|
/**
|
|
@@ -551,24 +562,8 @@ type Verdict = {
|
|
|
551
562
|
interface ByContent {
|
|
552
563
|
after: ContentTrigger;
|
|
553
564
|
}
|
|
554
|
-
/**
|
|
555
|
-
* `matches/byReference`: each repository downloads the asset from `url`, one request per
|
|
556
|
-
* algorithm it is declared for, so the client reads no bytes for it.
|
|
557
|
-
*/
|
|
558
|
-
interface ByReference {
|
|
559
|
-
after: ContentTrigger;
|
|
560
|
-
/**
|
|
561
|
-
* A short-lived https URL without credentials.
|
|
562
|
-
*/
|
|
563
|
-
url: string;
|
|
564
|
-
/**
|
|
565
|
-
* The asset\'s size in bytes, which caps the repository\'s download.
|
|
566
|
-
*/
|
|
567
|
-
length: number;
|
|
568
|
-
mediaType?: string;
|
|
569
|
-
}
|
|
570
565
|
interface AssetVerification {
|
|
571
|
-
credentials:
|
|
566
|
+
credentials: Credential[];
|
|
572
567
|
recovery: RecoverySummary;
|
|
573
568
|
goldenComparison: GoldenComparison;
|
|
574
569
|
verdict: Verdict;
|
|
@@ -655,7 +650,7 @@ declare function DEV_CA(): string;
|
|
|
655
650
|
* One stream being validated. It owns the session keys and manifest ids its init segments
|
|
656
651
|
* advertised, so releasing the stream is dropping this object.
|
|
657
652
|
*/
|
|
658
|
-
declare class
|
|
653
|
+
declare class StreamSession {
|
|
659
654
|
private constructor();
|
|
660
655
|
free(): void;
|
|
661
656
|
[Symbol.dispose](): void;
|
|
@@ -697,14 +692,14 @@ declare class StreamVerifier {
|
|
|
697
692
|
*/
|
|
698
693
|
static create(options: StreamVerifierOptions): StreamVerifier;
|
|
699
694
|
/**
|
|
700
|
-
* Open `stream_id` for validation, handing back a `
|
|
695
|
+
* Open `stream_id` for validation, handing back a `StreamSession` to feed segments to.
|
|
701
696
|
*
|
|
702
697
|
* No I/O: the handle carries the id so it cannot be mistyped or confused with another
|
|
703
698
|
* stream's, and classification still happens per segment. Opening one id twice hands
|
|
704
699
|
* back the same live session, so a component that remounts keeps the state its earlier
|
|
705
700
|
* handle accumulated.
|
|
706
701
|
*/
|
|
707
|
-
open(stream_id: string):
|
|
702
|
+
open(stream_id: string): StreamSession;
|
|
708
703
|
/**
|
|
709
704
|
* Open `stream_id` on the state another node exported, merged into whatever this one
|
|
710
705
|
* holds for that id already.
|
|
@@ -712,9 +707,9 @@ declare class StreamVerifier {
|
|
|
712
707
|
* # Errors
|
|
713
708
|
*
|
|
714
709
|
* Throws an `SdkError` (`STREAM_INVALID`) when `state` is not a value
|
|
715
|
-
* `
|
|
710
|
+
* `StreamSession.export` produced, or carries a version this SDK no longer reads.
|
|
716
711
|
*/
|
|
717
|
-
resume(stream_id: string, state: Uint8Array):
|
|
712
|
+
resume(stream_id: string, state: Uint8Array): StreamSession;
|
|
718
713
|
}
|
|
719
714
|
//#endregion
|
|
720
715
|
//#region src/worker-thread.d.ts
|
|
@@ -747,13 +742,13 @@ declare class AssetVerifierHandle extends Handle<AssetVerifier> {
|
|
|
747
742
|
verify(asset: Asset, recovery: Recovery | undefined): Promise<AssetVerification>;
|
|
748
743
|
}
|
|
749
744
|
/** One stream being validated. Dropping the handle releases the session it accumulated. */
|
|
750
|
-
declare class
|
|
745
|
+
declare class StreamSessionHandle extends Handle<StreamSession> {
|
|
751
746
|
validate(segment: Asset): Promise<SegmentValidation>;
|
|
752
747
|
export(): Uint8Array;
|
|
753
748
|
}
|
|
754
749
|
declare class StreamVerifierHandle extends Handle<StreamVerifier> {
|
|
755
|
-
open(streamId: string):
|
|
756
|
-
resume(streamId: string, state: Uint8Array):
|
|
750
|
+
open(streamId: string): StreamSessionHandle & ProxyMarked;
|
|
751
|
+
resume(streamId: string, state: Uint8Array): StreamSessionHandle & ProxyMarked;
|
|
757
752
|
}
|
|
758
753
|
/** The module's own surface, name for name with the direct import. */
|
|
759
754
|
declare const sdk: {
|