@trylimbo/sdk-verifier-wasm 0.2.10 → 0.2.11-canary.13
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 +87 -44
- package/gen/wasm/trylimbo_sdk_verifier.js +59 -23
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm +0 -0
- package/gen/wasm/trylimbo_sdk_verifier_bg.wasm.d.ts +21 -19
- package/gen/wasm/worker-thread.js +55 -22
- package/gen/wasm/worker.d.ts +93 -34
- package/package.json +3 -2
|
@@ -81,6 +81,11 @@ export interface SessionKeySummary {
|
|
|
81
81
|
publicKey: Uint8Array;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* A single C2PA Soft Binding Resolution API lookup.
|
|
86
|
+
*/
|
|
87
|
+
export type RecoveryQuery = { byBinding: { binderIndex: number } } | { byContent: { algorithm: ContentAlgorithm; hintBinderIndex?: number } };
|
|
88
|
+
|
|
84
89
|
/**
|
|
85
90
|
* A status with no structured detail (`kind: \"status\"`).
|
|
86
91
|
*/
|
|
@@ -159,12 +164,9 @@ export interface StreamVerifierOptions {
|
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
/**
|
|
162
|
-
* How
|
|
163
|
-
*
|
|
164
|
-
* Separate from [`RecoveryPolicy`], which decides *when* a recovery runs: one names the trigger
|
|
165
|
-
* and the other the reach, and crossing them is what the two enums exist to keep legible.
|
|
167
|
+
* How a `byContent` query selects the registry\'s detector algorithms.
|
|
166
168
|
*/
|
|
167
|
-
export type
|
|
169
|
+
export type ContentAlgorithm = "fingerprint" | "watermark" | "all" | { named: { algorithm: string } };
|
|
168
170
|
|
|
169
171
|
/**
|
|
170
172
|
* One C2PA validation status entry (spec §15.3).
|
|
@@ -187,8 +189,8 @@ export interface FieldViolation {
|
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
/**
|
|
190
|
-
* One `verify` credential: the c2pa `ManifestStore`, where it came from,
|
|
191
|
-
*
|
|
192
|
+
* One `verify` credential: the c2pa `ManifestStore`, where it came from, whether the asset\'s
|
|
193
|
+
* own fingerprint backs it up, and whether its hard binding holds over the bytes read.
|
|
192
194
|
*/
|
|
193
195
|
export interface FoundCredential {
|
|
194
196
|
/**
|
|
@@ -206,6 +208,28 @@ export interface FoundCredential {
|
|
|
206
208
|
* Whether the asset\'s own fingerprint backs up a mark that led here (C2PA 2.4 1.2.2.3).
|
|
207
209
|
*/
|
|
208
210
|
fingerprintCheck: FingerprintCheck;
|
|
211
|
+
/**
|
|
212
|
+
* Whether the manifest\'s hard binding holds over the bytes this verify read.
|
|
213
|
+
*/
|
|
214
|
+
hardBinding: HardBinding;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* One ordered group of registry queries.
|
|
219
|
+
*/
|
|
220
|
+
export interface RecoveryStage {
|
|
221
|
+
/**
|
|
222
|
+
* Queries in declaration order. Their order is also the deterministic result priority.
|
|
223
|
+
*/
|
|
224
|
+
queries: RecoveryQuery[];
|
|
225
|
+
/**
|
|
226
|
+
* Whether queries start one at a time or together.
|
|
227
|
+
*/
|
|
228
|
+
execution: RecoveryExecution;
|
|
229
|
+
/**
|
|
230
|
+
* Whether this stage stops at its first successful query or retains every result.
|
|
231
|
+
*/
|
|
232
|
+
completion: RecoveryCompletion;
|
|
209
233
|
}
|
|
210
234
|
|
|
211
235
|
/**
|
|
@@ -234,6 +258,16 @@ export interface InitValidation {
|
|
|
234
258
|
*/
|
|
235
259
|
export type SegmentValidation = ({ kind: "init" } & InitValidation) | ({ kind: "media" } & MediaValidation) | { kind: "unknown" };
|
|
236
260
|
|
|
261
|
+
/**
|
|
262
|
+
* Scheduling within a recovery stage.
|
|
263
|
+
*/
|
|
264
|
+
export type RecoveryExecution = "sequential" | "parallel";
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* The condition that completes a recovery stage.
|
|
268
|
+
*/
|
|
269
|
+
export type RecoveryCompletion = "firstResult" | "allResults";
|
|
270
|
+
|
|
237
271
|
/**
|
|
238
272
|
* The error every SDK call throws: a decoded `google.rpc.Status`, discriminated
|
|
239
273
|
* by `kind`. A consumer switches on `err.kind` (`\"reason\" | \"invalid\" | \"status\"`)
|
|
@@ -242,6 +276,11 @@ export type SegmentValidation = ({ kind: "init" } & InitValidation) | ({ kind: "
|
|
|
242
276
|
*/
|
|
243
277
|
export type SdkError = ({ kind: "status" } & StatusError) | ({ kind: "reason" } & ReasonError) | ({ kind: "invalid" } & InvalidError);
|
|
244
278
|
|
|
279
|
+
/**
|
|
280
|
+
* The registry work a verification call is allowed to perform.
|
|
281
|
+
*/
|
|
282
|
+
export type RecoveryPlan = { custom: { stages: RecoveryStage[] } };
|
|
283
|
+
|
|
245
284
|
/**
|
|
246
285
|
* Timing facts carried by a media segment\'s container.
|
|
247
286
|
*/
|
|
@@ -266,8 +305,7 @@ export interface SegmentTiming {
|
|
|
266
305
|
export type RecoveryPolicy = "whenMissing" | "always";
|
|
267
306
|
|
|
268
307
|
/**
|
|
269
|
-
* Where the registry is
|
|
270
|
-
* loose flags, so a policy cannot be configured on a verifier that has nowhere to apply it.
|
|
308
|
+
* Where the registry is and when to query it. Query reach and scheduling are selected per verify.
|
|
271
309
|
*/
|
|
272
310
|
export interface RegistryOptions {
|
|
273
311
|
/**
|
|
@@ -278,10 +316,6 @@ export interface RegistryOptions {
|
|
|
278
316
|
* Defaults to [`RecoveryPolicy::WhenMissing`].
|
|
279
317
|
*/
|
|
280
318
|
recovery?: RecoveryPolicy;
|
|
281
|
-
/**
|
|
282
|
-
* Defaults to [`RegistryQueries::DerivedThenContent`].
|
|
283
|
-
*/
|
|
284
|
-
queries?: RegistryQueries;
|
|
285
319
|
}
|
|
286
320
|
|
|
287
321
|
/**
|
|
@@ -294,7 +328,7 @@ export type ValidationCodeKind = "success" | "informational" | "failure";
|
|
|
294
328
|
* credential carries different evidence. Lane-local for the same reason [`FingerprintCheck`] is: a
|
|
295
329
|
* tag layout is what `#[binding(wasm)]` declines to express.
|
|
296
330
|
*/
|
|
297
|
-
export type CredentialOrigin = { kind: "embedded" } | { kind: "
|
|
331
|
+
export type CredentialOrigin = { kind: "embedded" } | { kind: "recovered"; discoveries: RecoveryDiscovery[] };
|
|
298
332
|
|
|
299
333
|
/**
|
|
300
334
|
* [`crate::asset::FingerprintCheck`] as JS sees it: a tagged union, since `compared` carries a
|
|
@@ -303,19 +337,17 @@ export type CredentialOrigin = { kind: "embedded" } | { kind: "recoveredByFinger
|
|
|
303
337
|
*/
|
|
304
338
|
export type FingerprintCheck = { kind: "notNeeded" } | { kind: "nothingToCompare" } | { kind: "unsupported"; algorithm: string } | { kind: "indeterminate" } | { kind: "compared"; score: number };
|
|
305
339
|
|
|
340
|
+
/**
|
|
341
|
+
* [`crate::asset::HardBinding`] as JS sees it.
|
|
342
|
+
*/
|
|
343
|
+
export type HardBinding = "holds" | "mismatch";
|
|
344
|
+
|
|
306
345
|
export interface AssetVerification {
|
|
307
346
|
credentials: FoundCredential[];
|
|
308
347
|
recovery: RecoverySummary;
|
|
309
348
|
goldenComparison: GoldenComparison;
|
|
310
349
|
}
|
|
311
350
|
|
|
312
|
-
export interface ContentBindingEvidence {
|
|
313
|
-
algorithm: string;
|
|
314
|
-
class: ContentBindingClass;
|
|
315
|
-
hint: SoftBinding | undefined;
|
|
316
|
-
registryScore: number | undefined;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
351
|
export interface RecoveryIssue {
|
|
320
352
|
kind: RecoveryIssueKind;
|
|
321
353
|
manifestId: string | undefined;
|
|
@@ -332,6 +364,8 @@ export type ContentBindingClass = "fingerprint" | "watermark";
|
|
|
332
364
|
|
|
333
365
|
export type GoldenComparison = { kind: "notRequested" } | { kind: "noEmbeddedManifest" } | { kind: "noRecoveredManifest" } | { kind: "matches"; recoveredIndex: number } | { kind: "differs"; recoveredIndex: number } | { kind: "indeterminate"; recoveredIndex: number | undefined };
|
|
334
366
|
|
|
367
|
+
export type RecoveryDiscovery = { method: "byBinding"; class: ContentBindingClass; binding: SoftBinding; binderIndex: number; registryScore: number | undefined } | { method: "byContent"; hint: SoftBinding | undefined; class: ContentBindingClass; algorithm: string; registryScore: number | undefined };
|
|
368
|
+
|
|
335
369
|
export type RecoveryIssueKind = "binder" | "bindingQuery" | "queryRefused" | "contentQuery" | "capabilities" | "contentTooLarge" | "candidateFetch" | "candidateValidation" | "resourceLimit";
|
|
336
370
|
|
|
337
371
|
export type RecoveryStatus = "notRequested" | "notFound" | "recovered" | "incomplete";
|
|
@@ -348,9 +382,7 @@ export class AssetVerifier {
|
|
|
348
382
|
*/
|
|
349
383
|
static create(options: AssetVerifierOptions): AssetVerifier;
|
|
350
384
|
/**
|
|
351
|
-
* Verify an asset against the configured trust anchors
|
|
352
|
-
* soft-binding recovery after the embedded pass, tried in order,
|
|
353
|
-
* first hit wins; pass `[]` to proceed directly to registry `byContent` recovery.
|
|
385
|
+
* Verify an asset against the configured trust anchors and per-call recovery plan.
|
|
354
386
|
*
|
|
355
387
|
* Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
|
|
356
388
|
* are native, so a master is verified through the native SDK.
|
|
@@ -360,7 +392,7 @@ export class AssetVerifier {
|
|
|
360
392
|
* Throws on a malformed `input`, a registry (or binder) failure, or a validation
|
|
361
393
|
* failure.
|
|
362
394
|
*/
|
|
363
|
-
verify(input: RangeSource,
|
|
395
|
+
verify(input: RangeSource, options: VerifyOptions): Promise<AssetVerification>;
|
|
364
396
|
}
|
|
365
397
|
|
|
366
398
|
/**
|
|
@@ -568,6 +600,15 @@ export class StreamVerifier {
|
|
|
568
600
|
resume(stream_id: string, state: Uint8Array): StreamValidation;
|
|
569
601
|
}
|
|
570
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Per-call soft-binding inputs. A plan is required when the verifier has a registry.
|
|
605
|
+
*/
|
|
606
|
+
export class VerifyOptions {
|
|
607
|
+
free(): void;
|
|
608
|
+
[Symbol.dispose](): void;
|
|
609
|
+
constructor(binders: Binder[], recovery_plan?: RecoveryPlan | null);
|
|
610
|
+
}
|
|
611
|
+
|
|
571
612
|
export function init_panic_hook(): void;
|
|
572
613
|
|
|
573
614
|
/**
|
|
@@ -620,27 +661,16 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
620
661
|
|
|
621
662
|
export interface InitOutput {
|
|
622
663
|
readonly memory: WebAssembly.Memory;
|
|
623
|
-
readonly __wbg_streamvalidation_free: (a: number, b: number) => void;
|
|
624
|
-
readonly __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
625
|
-
readonly parse: (a: number, b: number) => [number, number, number];
|
|
626
|
-
readonly resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
627
|
-
readonly streamvalidation_export: (a: number) => [number, number, number, number];
|
|
628
|
-
readonly streamvalidation_validate: (a: number, b: any) => any;
|
|
629
|
-
readonly streamverifier_create: (a: any) => [number, number, number];
|
|
630
|
-
readonly streamverifier_open: (a: number, b: number, c: number) => number;
|
|
631
|
-
readonly streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
632
|
-
readonly thumbnails: (a: number, b: number) => [number, number, number];
|
|
633
|
-
readonly C2PA_TRUST_LIST: () => [number, number];
|
|
634
|
-
readonly C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
635
|
-
readonly DEV_CA: () => [number, number];
|
|
636
|
-
readonly init_panic_hook: () => void;
|
|
637
664
|
readonly __wbg_assetverifier_free: (a: number, b: number) => void;
|
|
638
665
|
readonly __wbg_binder_free: (a: number, b: number) => void;
|
|
639
666
|
readonly __wbg_blobsource_free: (a: number, b: number) => void;
|
|
640
667
|
readonly __wbg_bytessource_free: (a: number, b: number) => void;
|
|
641
668
|
readonly __wbg_memorysource_free: (a: number, b: number) => void;
|
|
669
|
+
readonly __wbg_streamvalidation_free: (a: number, b: number) => void;
|
|
670
|
+
readonly __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
671
|
+
readonly __wbg_verifyoptions_free: (a: number, b: number) => void;
|
|
642
672
|
readonly assetverifier_create: (a: any) => [number, number, number];
|
|
643
|
-
readonly assetverifier_verify: (a: number, b: any, c: number
|
|
673
|
+
readonly assetverifier_verify: (a: number, b: any, c: number) => any;
|
|
644
674
|
readonly binder_derive: (a: number, b: any, c: number, d: number) => any;
|
|
645
675
|
readonly binder_held: (a: any) => [number, number, number];
|
|
646
676
|
readonly binder_iscc: () => number;
|
|
@@ -653,6 +683,19 @@ export interface InitOutput {
|
|
|
653
683
|
readonly memorysource_length: (a: number) => number;
|
|
654
684
|
readonly memorysource_new: (a: number, b: number) => number;
|
|
655
685
|
readonly memorysource_readAt: (a: number, b: number, c: number) => any;
|
|
686
|
+
readonly streamvalidation_export: (a: number) => [number, number, number, number];
|
|
687
|
+
readonly streamvalidation_validate: (a: number, b: any) => any;
|
|
688
|
+
readonly streamverifier_create: (a: any) => [number, number, number];
|
|
689
|
+
readonly streamverifier_open: (a: number, b: number, c: number) => number;
|
|
690
|
+
readonly streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
691
|
+
readonly verifyoptions_new: (a: number, b: number, c: number) => number;
|
|
692
|
+
readonly C2PA_TRUST_LIST: () => [number, number];
|
|
693
|
+
readonly C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
694
|
+
readonly DEV_CA: () => [number, number];
|
|
695
|
+
readonly init_panic_hook: () => void;
|
|
696
|
+
readonly parse: (a: number, b: number) => [number, number, number];
|
|
697
|
+
readonly resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
698
|
+
readonly thumbnails: (a: number, b: number) => [number, number, number];
|
|
656
699
|
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
657
700
|
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
658
701
|
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
@@ -666,10 +709,10 @@ export interface InitOutput {
|
|
|
666
709
|
readonly intounderlyingsink_abort: (a: number, b: any) => any;
|
|
667
710
|
readonly intounderlyingsink_close: (a: number) => any;
|
|
668
711
|
readonly intounderlyingsink_write: (a: number, b: any) => any;
|
|
669
|
-
readonly
|
|
670
|
-
readonly
|
|
671
|
-
readonly
|
|
672
|
-
readonly
|
|
712
|
+
readonly wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1: (a: number, b: number, c: any) => [number, number];
|
|
713
|
+
readonly wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf: (a: number, b: number, c: any, d: any) => void;
|
|
714
|
+
readonly wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3: (a: number, b: number, c: any) => void;
|
|
715
|
+
readonly wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5: (a: number, b: number) => void;
|
|
673
716
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
674
717
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
675
718
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
@@ -32,9 +32,7 @@ export class AssetVerifier {
|
|
|
32
32
|
return AssetVerifier.__wrap(ret[0]);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Verify an asset against the configured trust anchors
|
|
36
|
-
* soft-binding recovery after the embedded pass, tried in order,
|
|
37
|
-
* first hit wins; pass `[]` to proceed directly to registry `byContent` recovery.
|
|
35
|
+
* Verify an asset against the configured trust anchors and per-call recovery plan.
|
|
38
36
|
*
|
|
39
37
|
* Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
|
|
40
38
|
* are native, so a master is verified through the native SDK.
|
|
@@ -44,13 +42,13 @@ export class AssetVerifier {
|
|
|
44
42
|
* Throws on a malformed `input`, a registry (or binder) failure, or a validation
|
|
45
43
|
* failure.
|
|
46
44
|
* @param {RangeSource} input
|
|
47
|
-
* @param {
|
|
45
|
+
* @param {VerifyOptions} options
|
|
48
46
|
* @returns {Promise<AssetVerification>}
|
|
49
47
|
*/
|
|
50
|
-
verify(input,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const ret = wasm.assetverifier_verify(this.__wbg_ptr, input, ptr0
|
|
48
|
+
verify(input, options) {
|
|
49
|
+
_assertClass(options, VerifyOptions);
|
|
50
|
+
var ptr0 = options.__destroy_into_raw();
|
|
51
|
+
const ret = wasm.assetverifier_verify(this.__wbg_ptr, input, ptr0);
|
|
54
52
|
return ret;
|
|
55
53
|
}
|
|
56
54
|
}
|
|
@@ -591,6 +589,35 @@ export class StreamVerifier {
|
|
|
591
589
|
}
|
|
592
590
|
if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
|
|
593
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Per-call soft-binding inputs. A plan is required when the verifier has a registry.
|
|
594
|
+
*/
|
|
595
|
+
export class VerifyOptions {
|
|
596
|
+
__destroy_into_raw() {
|
|
597
|
+
const ptr = this.__wbg_ptr;
|
|
598
|
+
this.__wbg_ptr = 0;
|
|
599
|
+
VerifyOptionsFinalization.unregister(this);
|
|
600
|
+
return ptr;
|
|
601
|
+
}
|
|
602
|
+
free() {
|
|
603
|
+
const ptr = this.__destroy_into_raw();
|
|
604
|
+
wasm.__wbg_verifyoptions_free(ptr, 0);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* @param {Binder[]} binders
|
|
608
|
+
* @param {RecoveryPlan | null} [recovery_plan]
|
|
609
|
+
*/
|
|
610
|
+
constructor(binders, recovery_plan) {
|
|
611
|
+
const ptr0 = passArrayJsValueToWasm0(binders, wasm.__wbindgen_malloc);
|
|
612
|
+
const len0 = WASM_VECTOR_LEN;
|
|
613
|
+
const ret = wasm.verifyoptions_new(ptr0, len0, isLikeNone(recovery_plan) ? 0 : addToExternrefTable0(recovery_plan));
|
|
614
|
+
this.__wbg_ptr = ret;
|
|
615
|
+
VerifyOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
616
|
+
return this;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
if (Symbol.dispose) VerifyOptions.prototype[Symbol.dispose] = VerifyOptions.prototype.free;
|
|
620
|
+
|
|
594
621
|
export function init_panic_hook() {
|
|
595
622
|
wasm.init_panic_hook();
|
|
596
623
|
}
|
|
@@ -1051,7 +1078,7 @@ function __wbg_get_imports() {
|
|
|
1051
1078
|
const a = state0.a;
|
|
1052
1079
|
state0.a = 0;
|
|
1053
1080
|
try {
|
|
1054
|
-
return
|
|
1081
|
+
return wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf(a, state0.b, arg0, arg1);
|
|
1055
1082
|
} finally {
|
|
1056
1083
|
state0.a = a;
|
|
1057
1084
|
}
|
|
@@ -1242,18 +1269,18 @@ function __wbg_get_imports() {
|
|
|
1242
1269
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1243
1270
|
},
|
|
1244
1271
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1245
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1246
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1272
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2054, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1273
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1);
|
|
1247
1274
|
return ret;
|
|
1248
1275
|
},
|
|
1249
1276
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1250
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1251
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1277
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3958, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1278
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
|
|
1252
1279
|
return ret;
|
|
1253
1280
|
},
|
|
1254
1281
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1255
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1256
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1282
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2728, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1283
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5);
|
|
1257
1284
|
return ret;
|
|
1258
1285
|
},
|
|
1259
1286
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -1297,23 +1324,23 @@ function __wbg_get_imports() {
|
|
|
1297
1324
|
};
|
|
1298
1325
|
}
|
|
1299
1326
|
|
|
1300
|
-
function
|
|
1301
|
-
wasm.
|
|
1327
|
+
function wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1) {
|
|
1328
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1);
|
|
1302
1329
|
}
|
|
1303
1330
|
|
|
1304
|
-
function
|
|
1305
|
-
wasm.
|
|
1331
|
+
function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
|
|
1332
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2);
|
|
1306
1333
|
}
|
|
1307
1334
|
|
|
1308
|
-
function
|
|
1309
|
-
const ret = wasm.
|
|
1335
|
+
function wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2) {
|
|
1336
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2);
|
|
1310
1337
|
if (ret[1]) {
|
|
1311
1338
|
throw takeFromExternrefTable0(ret[0]);
|
|
1312
1339
|
}
|
|
1313
1340
|
}
|
|
1314
1341
|
|
|
1315
|
-
function
|
|
1316
|
-
wasm.
|
|
1342
|
+
function wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf(arg0, arg1, arg2, arg3) {
|
|
1343
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf(arg0, arg1, arg2, arg3);
|
|
1317
1344
|
}
|
|
1318
1345
|
|
|
1319
1346
|
|
|
@@ -1357,6 +1384,9 @@ const StreamValidationFinalization = (typeof FinalizationRegistry === 'undefined
|
|
|
1357
1384
|
const StreamVerifierFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1358
1385
|
? { register: () => {}, unregister: () => {} }
|
|
1359
1386
|
: new FinalizationRegistry(ptr => wasm.__wbg_streamverifier_free(ptr, 1));
|
|
1387
|
+
const VerifyOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1388
|
+
? { register: () => {}, unregister: () => {} }
|
|
1389
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_verifyoptions_free(ptr, 1));
|
|
1360
1390
|
|
|
1361
1391
|
function addToExternrefTable0(obj) {
|
|
1362
1392
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -1364,6 +1394,12 @@ function addToExternrefTable0(obj) {
|
|
|
1364
1394
|
return idx;
|
|
1365
1395
|
}
|
|
1366
1396
|
|
|
1397
|
+
function _assertClass(instance, klass) {
|
|
1398
|
+
if (!(instance instanceof klass)) {
|
|
1399
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1367
1403
|
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1368
1404
|
? { register: () => {}, unregister: () => {} }
|
|
1369
1405
|
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
Binary file
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_streamvalidation_free: (a: number, b: number) => void;
|
|
5
|
-
export const __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
6
|
-
export const parse: (a: number, b: number) => [number, number, number];
|
|
7
|
-
export const resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
8
|
-
export const streamvalidation_export: (a: number) => [number, number, number, number];
|
|
9
|
-
export const streamvalidation_validate: (a: number, b: any) => any;
|
|
10
|
-
export const streamverifier_create: (a: any) => [number, number, number];
|
|
11
|
-
export const streamverifier_open: (a: number, b: number, c: number) => number;
|
|
12
|
-
export const streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
13
|
-
export const thumbnails: (a: number, b: number) => [number, number, number];
|
|
14
|
-
export const C2PA_TRUST_LIST: () => [number, number];
|
|
15
|
-
export const C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
16
|
-
export const DEV_CA: () => [number, number];
|
|
17
|
-
export const init_panic_hook: () => void;
|
|
18
4
|
export const __wbg_assetverifier_free: (a: number, b: number) => void;
|
|
19
5
|
export const __wbg_binder_free: (a: number, b: number) => void;
|
|
20
6
|
export const __wbg_blobsource_free: (a: number, b: number) => void;
|
|
21
7
|
export const __wbg_bytessource_free: (a: number, b: number) => void;
|
|
22
8
|
export const __wbg_memorysource_free: (a: number, b: number) => void;
|
|
9
|
+
export const __wbg_streamvalidation_free: (a: number, b: number) => void;
|
|
10
|
+
export const __wbg_streamverifier_free: (a: number, b: number) => void;
|
|
11
|
+
export const __wbg_verifyoptions_free: (a: number, b: number) => void;
|
|
23
12
|
export const assetverifier_create: (a: any) => [number, number, number];
|
|
24
|
-
export const assetverifier_verify: (a: number, b: any, c: number
|
|
13
|
+
export const assetverifier_verify: (a: number, b: any, c: number) => any;
|
|
25
14
|
export const binder_derive: (a: number, b: any, c: number, d: number) => any;
|
|
26
15
|
export const binder_held: (a: any) => [number, number, number];
|
|
27
16
|
export const binder_iscc: () => number;
|
|
@@ -34,6 +23,19 @@ export const bytessource_readAt: (a: number, b: number, c: number) => any;
|
|
|
34
23
|
export const memorysource_length: (a: number) => number;
|
|
35
24
|
export const memorysource_new: (a: number, b: number) => number;
|
|
36
25
|
export const memorysource_readAt: (a: number, b: number, c: number) => any;
|
|
26
|
+
export const streamvalidation_export: (a: number) => [number, number, number, number];
|
|
27
|
+
export const streamvalidation_validate: (a: number, b: any) => any;
|
|
28
|
+
export const streamverifier_create: (a: any) => [number, number, number];
|
|
29
|
+
export const streamverifier_open: (a: number, b: number, c: number) => number;
|
|
30
|
+
export const streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
31
|
+
export const verifyoptions_new: (a: number, b: number, c: number) => number;
|
|
32
|
+
export const C2PA_TRUST_LIST: () => [number, number];
|
|
33
|
+
export const C2PA_TSA_TRUST_LIST: () => [number, number];
|
|
34
|
+
export const DEV_CA: () => [number, number];
|
|
35
|
+
export const init_panic_hook: () => void;
|
|
36
|
+
export const parse: (a: number, b: number) => [number, number, number];
|
|
37
|
+
export const resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
38
|
+
export const thumbnails: (a: number, b: number) => [number, number, number];
|
|
37
39
|
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
38
40
|
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
39
41
|
export const intounderlyingbytesource_cancel: (a: number) => void;
|
|
@@ -47,10 +49,10 @@ export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
|
47
49
|
export const intounderlyingsink_abort: (a: number, b: any) => any;
|
|
48
50
|
export const intounderlyingsink_close: (a: number) => any;
|
|
49
51
|
export const intounderlyingsink_write: (a: number, b: any) => any;
|
|
50
|
-
export const
|
|
51
|
-
export const
|
|
52
|
-
export const
|
|
53
|
-
export const
|
|
52
|
+
export const wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1: (a: number, b: number, c: any) => [number, number];
|
|
53
|
+
export const wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf: (a: number, b: number, c: any, d: any) => void;
|
|
54
|
+
export const wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3: (a: number, b: number, c: any) => void;
|
|
55
|
+
export const wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5: (a: number, b: number) => void;
|
|
54
56
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
55
57
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
56
58
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
@@ -30,9 +30,7 @@ var AssetVerifier = class AssetVerifier {
|
|
|
30
30
|
return AssetVerifier.__wrap(ret[0]);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Verify an asset against the configured trust anchors
|
|
34
|
-
* soft-binding recovery after the embedded pass, tried in order,
|
|
35
|
-
* first hit wins; pass `[]` to proceed directly to registry `byContent` recovery.
|
|
33
|
+
* Verify an asset against the configured trust anchors and per-call recovery plan.
|
|
36
34
|
*
|
|
37
35
|
* Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
|
|
38
36
|
* are native, so a master is verified through the native SDK.
|
|
@@ -42,13 +40,13 @@ var AssetVerifier = class AssetVerifier {
|
|
|
42
40
|
* Throws on a malformed `input`, a registry (or binder) failure, or a validation
|
|
43
41
|
* failure.
|
|
44
42
|
* @param {RangeSource} input
|
|
45
|
-
* @param {
|
|
43
|
+
* @param {VerifyOptions} options
|
|
46
44
|
* @returns {Promise<AssetVerification>}
|
|
47
45
|
*/
|
|
48
|
-
verify(input,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return wasm.assetverifier_verify(this.__wbg_ptr, input, ptr0
|
|
46
|
+
verify(input, options) {
|
|
47
|
+
_assertClass(options, VerifyOptions);
|
|
48
|
+
var ptr0 = options.__destroy_into_raw();
|
|
49
|
+
return wasm.assetverifier_verify(this.__wbg_ptr, input, ptr0);
|
|
52
50
|
}
|
|
53
51
|
};
|
|
54
52
|
if (Symbol.dispose) AssetVerifier.prototype[Symbol.dispose] = AssetVerifier.prototype.free;
|
|
@@ -549,6 +547,34 @@ var StreamVerifier = class StreamVerifier {
|
|
|
549
547
|
};
|
|
550
548
|
if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
|
|
551
549
|
/**
|
|
550
|
+
* Per-call soft-binding inputs. A plan is required when the verifier has a registry.
|
|
551
|
+
*/
|
|
552
|
+
var VerifyOptions = class {
|
|
553
|
+
__destroy_into_raw() {
|
|
554
|
+
const ptr = this.__wbg_ptr;
|
|
555
|
+
this.__wbg_ptr = 0;
|
|
556
|
+
VerifyOptionsFinalization.unregister(this);
|
|
557
|
+
return ptr;
|
|
558
|
+
}
|
|
559
|
+
free() {
|
|
560
|
+
const ptr = this.__destroy_into_raw();
|
|
561
|
+
wasm.__wbg_verifyoptions_free(ptr, 0);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* @param {Binder[]} binders
|
|
565
|
+
* @param {RecoveryPlan | null} [recovery_plan]
|
|
566
|
+
*/
|
|
567
|
+
constructor(binders, recovery_plan) {
|
|
568
|
+
const ptr0 = passArrayJsValueToWasm0(binders, wasm.__wbindgen_malloc);
|
|
569
|
+
const len0 = WASM_VECTOR_LEN;
|
|
570
|
+
const ret = wasm.verifyoptions_new(ptr0, len0, isLikeNone(recovery_plan) ? 0 : addToExternrefTable0(recovery_plan));
|
|
571
|
+
this.__wbg_ptr = ret;
|
|
572
|
+
VerifyOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
573
|
+
return this;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
if (Symbol.dispose) VerifyOptions.prototype[Symbol.dispose] = VerifyOptions.prototype.free;
|
|
577
|
+
/**
|
|
552
578
|
* Parse a detached C2PA manifest store: a `.c2pa` sidecar, or the bytes a registry serves for a
|
|
553
579
|
* manifest id.
|
|
554
580
|
*
|
|
@@ -974,7 +1000,7 @@ function __wbg_get_imports() {
|
|
|
974
1000
|
const a = state0.a;
|
|
975
1001
|
state0.a = 0;
|
|
976
1002
|
try {
|
|
977
|
-
return
|
|
1003
|
+
return wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf(a, state0.b, arg0, arg1);
|
|
978
1004
|
} finally {
|
|
979
1005
|
state0.a = a;
|
|
980
1006
|
}
|
|
@@ -1157,13 +1183,13 @@ function __wbg_get_imports() {
|
|
|
1157
1183
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1158
1184
|
},
|
|
1159
1185
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1160
|
-
return makeMutClosure(arg0, arg1,
|
|
1186
|
+
return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1);
|
|
1161
1187
|
},
|
|
1162
1188
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1163
|
-
return makeMutClosure(arg0, arg1,
|
|
1189
|
+
return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
|
|
1164
1190
|
},
|
|
1165
1191
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1166
|
-
return makeMutClosure(arg0, arg1,
|
|
1192
|
+
return makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5);
|
|
1167
1193
|
},
|
|
1168
1194
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
1169
1195
|
return arg0;
|
|
@@ -1192,18 +1218,18 @@ function __wbg_get_imports() {
|
|
|
1192
1218
|
}
|
|
1193
1219
|
};
|
|
1194
1220
|
}
|
|
1195
|
-
function
|
|
1196
|
-
wasm.
|
|
1221
|
+
function wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1) {
|
|
1222
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hcc9f2329e90526d5(arg0, arg1);
|
|
1197
1223
|
}
|
|
1198
|
-
function
|
|
1199
|
-
wasm.
|
|
1224
|
+
function wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2) {
|
|
1225
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3(arg0, arg1, arg2);
|
|
1200
1226
|
}
|
|
1201
|
-
function
|
|
1202
|
-
const ret = wasm.
|
|
1227
|
+
function wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2) {
|
|
1228
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfa954cb356c7e7e1(arg0, arg1, arg2);
|
|
1203
1229
|
if (ret[1]) throw takeFromExternrefTable0(ret[0]);
|
|
1204
1230
|
}
|
|
1205
|
-
function
|
|
1206
|
-
wasm.
|
|
1231
|
+
function wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf(arg0, arg1, arg2, arg3) {
|
|
1232
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h32a4f2e7671466cf(arg0, arg1, arg2, arg3);
|
|
1207
1233
|
}
|
|
1208
1234
|
const __wbindgen_enum_ReadableStreamType = ["bytes"];
|
|
1209
1235
|
const __wbindgen_enum_RequestCache = [
|
|
@@ -1265,11 +1291,18 @@ const StreamVerifierFinalization = typeof FinalizationRegistry === "undefined" ?
|
|
|
1265
1291
|
register: () => {},
|
|
1266
1292
|
unregister: () => {}
|
|
1267
1293
|
} : new FinalizationRegistry((ptr) => wasm.__wbg_streamverifier_free(ptr, 1));
|
|
1294
|
+
const VerifyOptionsFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
1295
|
+
register: () => {},
|
|
1296
|
+
unregister: () => {}
|
|
1297
|
+
} : new FinalizationRegistry((ptr) => wasm.__wbg_verifyoptions_free(ptr, 1));
|
|
1268
1298
|
function addToExternrefTable0(obj) {
|
|
1269
1299
|
const idx = wasm.__externref_table_alloc();
|
|
1270
1300
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1271
1301
|
return idx;
|
|
1272
1302
|
}
|
|
1303
|
+
function _assertClass(instance, klass) {
|
|
1304
|
+
if (!(instance instanceof klass)) throw new Error(`expected instance of ${klass.name}`);
|
|
1305
|
+
}
|
|
1273
1306
|
const CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? {
|
|
1274
1307
|
register: () => {},
|
|
1275
1308
|
unregister: () => {}
|
|
@@ -1533,8 +1566,8 @@ var Handle = class {
|
|
|
1533
1566
|
}
|
|
1534
1567
|
};
|
|
1535
1568
|
var AssetVerifierHandle = class extends Handle {
|
|
1536
|
-
verify(asset,
|
|
1537
|
-
return this.inner.verify(source(asset), binders.map(binder));
|
|
1569
|
+
verify(asset, options = {}) {
|
|
1570
|
+
return this.inner.verify(source(asset), new VerifyOptions((options.binders ?? []).map(binder), options.recoveryPlan));
|
|
1538
1571
|
}
|
|
1539
1572
|
};
|
|
1540
1573
|
/** One stream being validated. Dropping the handle releases the session it accumulated. */
|
package/gen/wasm/worker.d.ts
CHANGED
|
@@ -194,6 +194,19 @@ interface SessionKeySummary {
|
|
|
194
194
|
*/
|
|
195
195
|
publicKey: Uint8Array;
|
|
196
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* A single C2PA Soft Binding Resolution API lookup.
|
|
199
|
+
*/
|
|
200
|
+
type RecoveryQuery = {
|
|
201
|
+
byBinding: {
|
|
202
|
+
binderIndex: number;
|
|
203
|
+
};
|
|
204
|
+
} | {
|
|
205
|
+
byContent: {
|
|
206
|
+
algorithm: ContentAlgorithm;
|
|
207
|
+
hintBinderIndex?: number;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
197
210
|
/**
|
|
198
211
|
* C2PA validation state of a manifest (spec §14.3).
|
|
199
212
|
*/
|
|
@@ -261,12 +274,13 @@ interface StreamVerifierOptions {
|
|
|
261
274
|
segmentSkewToleranceSecs?: number;
|
|
262
275
|
}
|
|
263
276
|
/**
|
|
264
|
-
* How
|
|
265
|
-
*
|
|
266
|
-
* Separate from [`RecoveryPolicy`], which decides *when* a recovery runs: one names the trigger
|
|
267
|
-
* and the other the reach, and crossing them is what the two enums exist to keep legible.
|
|
277
|
+
* How a `byContent` query selects the registry\'s detector algorithms.
|
|
268
278
|
*/
|
|
269
|
-
type
|
|
279
|
+
type ContentAlgorithm = "fingerprint" | "watermark" | "all" | {
|
|
280
|
+
named: {
|
|
281
|
+
algorithm: string;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
270
284
|
/**
|
|
271
285
|
* One C2PA validation status entry (spec §15.3).
|
|
272
286
|
*/
|
|
@@ -278,8 +292,8 @@ interface ValidationCode {
|
|
|
278
292
|
kind: ValidationCodeKind;
|
|
279
293
|
}
|
|
280
294
|
/**
|
|
281
|
-
* One `verify` credential: the c2pa `ManifestStore`, where it came from,
|
|
282
|
-
*
|
|
295
|
+
* One `verify` credential: the c2pa `ManifestStore`, where it came from, whether the asset\'s
|
|
296
|
+
* own fingerprint backs it up, and whether its hard binding holds over the bytes read.
|
|
283
297
|
*/
|
|
284
298
|
interface FoundCredential {
|
|
285
299
|
/**
|
|
@@ -297,6 +311,27 @@ interface FoundCredential {
|
|
|
297
311
|
* Whether the asset\'s own fingerprint backs up a mark that led here (C2PA 2.4 1.2.2.3).
|
|
298
312
|
*/
|
|
299
313
|
fingerprintCheck: FingerprintCheck;
|
|
314
|
+
/**
|
|
315
|
+
* Whether the manifest\'s hard binding holds over the bytes this verify read.
|
|
316
|
+
*/
|
|
317
|
+
hardBinding: HardBinding;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* One ordered group of registry queries.
|
|
321
|
+
*/
|
|
322
|
+
interface RecoveryStage {
|
|
323
|
+
/**
|
|
324
|
+
* Queries in declaration order. Their order is also the deterministic result priority.
|
|
325
|
+
*/
|
|
326
|
+
queries: RecoveryQuery[];
|
|
327
|
+
/**
|
|
328
|
+
* Whether queries start one at a time or together.
|
|
329
|
+
*/
|
|
330
|
+
execution: RecoveryExecution;
|
|
331
|
+
/**
|
|
332
|
+
* Whether this stage stops at its first successful query or retains every result.
|
|
333
|
+
*/
|
|
334
|
+
completion: RecoveryCompletion;
|
|
300
335
|
}
|
|
301
336
|
/**
|
|
302
337
|
* Outcome of validating a media segment against its stream\'s init.
|
|
@@ -327,6 +362,22 @@ type SegmentValidation = ({
|
|
|
327
362
|
} & MediaValidation) | {
|
|
328
363
|
kind: "unknown";
|
|
329
364
|
};
|
|
365
|
+
/**
|
|
366
|
+
* Scheduling within a recovery stage.
|
|
367
|
+
*/
|
|
368
|
+
type RecoveryExecution = "sequential" | "parallel";
|
|
369
|
+
/**
|
|
370
|
+
* The condition that completes a recovery stage.
|
|
371
|
+
*/
|
|
372
|
+
type RecoveryCompletion = "firstResult" | "allResults";
|
|
373
|
+
/**
|
|
374
|
+
* The registry work a verification call is allowed to perform.
|
|
375
|
+
*/
|
|
376
|
+
type RecoveryPlan = {
|
|
377
|
+
custom: {
|
|
378
|
+
stages: RecoveryStage[];
|
|
379
|
+
};
|
|
380
|
+
};
|
|
330
381
|
/**
|
|
331
382
|
* Timing facts carried by a media segment\'s container.
|
|
332
383
|
*/
|
|
@@ -349,8 +400,7 @@ interface SegmentTiming {
|
|
|
349
400
|
*/
|
|
350
401
|
type RecoveryPolicy = "whenMissing" | "always";
|
|
351
402
|
/**
|
|
352
|
-
* Where the registry is
|
|
353
|
-
* loose flags, so a policy cannot be configured on a verifier that has nowhere to apply it.
|
|
403
|
+
* Where the registry is and when to query it. Query reach and scheduling are selected per verify.
|
|
354
404
|
*/
|
|
355
405
|
interface RegistryOptions {
|
|
356
406
|
/**
|
|
@@ -361,10 +411,6 @@ interface RegistryOptions {
|
|
|
361
411
|
* Defaults to [`RecoveryPolicy::WhenMissing`].
|
|
362
412
|
*/
|
|
363
413
|
recovery?: RecoveryPolicy;
|
|
364
|
-
/**
|
|
365
|
-
* Defaults to [`RegistryQueries::DerivedThenContent`].
|
|
366
|
-
*/
|
|
367
|
-
queries?: RegistryQueries;
|
|
368
414
|
}
|
|
369
415
|
/**
|
|
370
416
|
* Whether a code is a success, an informational note, or a failure.
|
|
@@ -378,16 +424,8 @@ type ValidationCodeKind = "success" | "informational" | "failure";
|
|
|
378
424
|
type CredentialOrigin = {
|
|
379
425
|
kind: "embedded";
|
|
380
426
|
} | {
|
|
381
|
-
kind: "
|
|
382
|
-
|
|
383
|
-
registryScore: number | undefined;
|
|
384
|
-
} | {
|
|
385
|
-
kind: "recoveredByWatermark";
|
|
386
|
-
binding: SoftBinding;
|
|
387
|
-
registryScore: number | undefined;
|
|
388
|
-
} | {
|
|
389
|
-
kind: "recoveredByContent";
|
|
390
|
-
discoveries: ContentBindingEvidence[];
|
|
427
|
+
kind: "recovered";
|
|
428
|
+
discoveries: RecoveryDiscovery[];
|
|
391
429
|
};
|
|
392
430
|
/**
|
|
393
431
|
* [`crate::asset::FingerprintCheck`] as JS sees it: a tagged union, since `compared` carries a
|
|
@@ -407,17 +445,15 @@ type FingerprintCheck = {
|
|
|
407
445
|
kind: "compared";
|
|
408
446
|
score: number;
|
|
409
447
|
};
|
|
448
|
+
/**
|
|
449
|
+
* [`crate::asset::HardBinding`] as JS sees it.
|
|
450
|
+
*/
|
|
451
|
+
type HardBinding = "holds" | "mismatch";
|
|
410
452
|
interface AssetVerification {
|
|
411
453
|
credentials: FoundCredential[];
|
|
412
454
|
recovery: RecoverySummary;
|
|
413
455
|
goldenComparison: GoldenComparison;
|
|
414
456
|
}
|
|
415
|
-
interface ContentBindingEvidence {
|
|
416
|
-
algorithm: string;
|
|
417
|
-
class: ContentBindingClass;
|
|
418
|
-
hint: SoftBinding | undefined;
|
|
419
|
-
registryScore: number | undefined;
|
|
420
|
-
}
|
|
421
457
|
interface RecoveryIssue {
|
|
422
458
|
kind: RecoveryIssueKind;
|
|
423
459
|
manifestId: string | undefined;
|
|
@@ -445,6 +481,19 @@ type GoldenComparison = {
|
|
|
445
481
|
kind: "indeterminate";
|
|
446
482
|
recoveredIndex: number | undefined;
|
|
447
483
|
};
|
|
484
|
+
type RecoveryDiscovery = {
|
|
485
|
+
method: "byBinding";
|
|
486
|
+
class: ContentBindingClass;
|
|
487
|
+
binding: SoftBinding;
|
|
488
|
+
binderIndex: number;
|
|
489
|
+
registryScore: number | undefined;
|
|
490
|
+
} | {
|
|
491
|
+
method: "byContent";
|
|
492
|
+
hint: SoftBinding | undefined;
|
|
493
|
+
class: ContentBindingClass;
|
|
494
|
+
algorithm: string;
|
|
495
|
+
registryScore: number | undefined;
|
|
496
|
+
};
|
|
448
497
|
type RecoveryIssueKind = "binder" | "bindingQuery" | "queryRefused" | "contentQuery" | "capabilities" | "contentTooLarge" | "candidateFetch" | "candidateValidation" | "resourceLimit";
|
|
449
498
|
type RecoveryStatus = "notRequested" | "notFound" | "recovered" | "incomplete";
|
|
450
499
|
declare class AssetVerifier {
|
|
@@ -458,9 +507,7 @@ declare class AssetVerifier {
|
|
|
458
507
|
*/
|
|
459
508
|
static create(options: AssetVerifierOptions): AssetVerifier;
|
|
460
509
|
/**
|
|
461
|
-
* Verify an asset against the configured trust anchors
|
|
462
|
-
* soft-binding recovery after the embedded pass, tried in order,
|
|
463
|
-
* first hit wins; pass `[]` to proceed directly to registry `byContent` recovery.
|
|
510
|
+
* Verify an asset against the configured trust anchors and per-call recovery plan.
|
|
464
511
|
*
|
|
465
512
|
* Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
|
|
466
513
|
* are native, so a master is verified through the native SDK.
|
|
@@ -470,7 +517,7 @@ declare class AssetVerifier {
|
|
|
470
517
|
* Throws on a malformed `input`, a registry (or binder) failure, or a validation
|
|
471
518
|
* failure.
|
|
472
519
|
*/
|
|
473
|
-
verify(input: RangeSource,
|
|
520
|
+
verify(input: RangeSource, options: VerifyOptions): Promise<AssetVerification>;
|
|
474
521
|
}
|
|
475
522
|
/**
|
|
476
523
|
* A soft-binding binder a client runs itself. Build with `Binder.iscc()` or
|
|
@@ -569,6 +616,14 @@ declare class StreamVerifier {
|
|
|
569
616
|
*/
|
|
570
617
|
resume(stream_id: string, state: Uint8Array): StreamValidation;
|
|
571
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* Per-call soft-binding inputs. A plan is required when the verifier has a registry.
|
|
621
|
+
*/
|
|
622
|
+
declare class VerifyOptions {
|
|
623
|
+
free(): void;
|
|
624
|
+
[Symbol.dispose](): void;
|
|
625
|
+
constructor(binders: Binder[], recovery_plan?: RecoveryPlan | null);
|
|
626
|
+
}
|
|
572
627
|
//#endregion
|
|
573
628
|
//#region src/worker-thread.d.ts
|
|
574
629
|
/**
|
|
@@ -587,6 +642,10 @@ type BinderSpec = {
|
|
|
587
642
|
readonly kind: "held";
|
|
588
643
|
readonly binding: SoftBinding;
|
|
589
644
|
};
|
|
645
|
+
interface AssetVerifyOptions {
|
|
646
|
+
readonly binders?: readonly BinderSpec[];
|
|
647
|
+
readonly recoveryPlan?: RecoveryPlan;
|
|
648
|
+
}
|
|
590
649
|
/**
|
|
591
650
|
* A wasm object held in this thread on the caller's behalf.
|
|
592
651
|
*
|
|
@@ -606,7 +665,7 @@ declare abstract class Handle<T extends {
|
|
|
606
665
|
[finalizer](): void;
|
|
607
666
|
}
|
|
608
667
|
declare class AssetVerifierHandle extends Handle<AssetVerifier> {
|
|
609
|
-
verify(asset: Asset,
|
|
668
|
+
verify(asset: Asset, options?: AssetVerifyOptions): Promise<AssetVerification>;
|
|
610
669
|
}
|
|
611
670
|
/** One stream being validated. Dropping the handle releases the session it accumulated. */
|
|
612
671
|
declare class StreamValidationHandle extends Handle<StreamValidation> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trylimbo/sdk-verifier-wasm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11-canary.13",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,5 +40,6 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"comlink": "4.4.2",
|
|
42
42
|
"typescript": "^7.0.2"
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
|
+
"stableVersion": "0.2.10"
|
|
44
45
|
}
|