@trylimbo/sdk-verifier-wasm 0.2.11-canary.16 → 0.2.11-canary.19

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.
@@ -81,11 +81,6 @@ 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
-
89
84
  /**
90
85
  * A status with no structured detail (`kind: \"status\"`).
91
86
  */
@@ -163,11 +158,6 @@ export interface StreamVerifierOptions {
163
158
  segmentSkewToleranceSecs?: number;
164
159
  }
165
160
 
166
- /**
167
- * How a `byContent` query selects the registry\'s detector algorithms.
168
- */
169
- export type ContentAlgorithm = "fingerprint" | "watermark" | "all" | { named: { algorithm: string } };
170
-
171
161
  /**
172
162
  * One C2PA validation status entry (spec §15.3).
173
163
  */
@@ -188,6 +178,32 @@ export interface FieldViolation {
188
178
  reason: string;
189
179
  }
190
180
 
181
+ /**
182
+ * One `matches/byContent` upload per selected detector.
183
+ */
184
+ export interface ByContent {
185
+ after: ContentTrigger;
186
+ detectors: Detectors;
187
+ }
188
+
189
+ /**
190
+ * One `matches/byReference` query per selected detector. The registry downloads the asset
191
+ * from `url`, so the client reads no bytes for it.
192
+ */
193
+ export interface ByReference {
194
+ after: ContentTrigger;
195
+ detectors: Detectors;
196
+ /**
197
+ * A short-lived https URL without credentials.
198
+ */
199
+ url: string;
200
+ /**
201
+ * The asset\'s size in bytes, which caps the registry\'s download.
202
+ */
203
+ length: number;
204
+ mediaType?: string;
205
+ }
206
+
191
207
  /**
192
208
  * One `verify` credential: the c2pa `ManifestStore`, where it came from, whether the asset\'s
193
209
  * own fingerprint backs it up, and whether its hard binding holds over the bytes read.
@@ -212,24 +228,10 @@ export interface FoundCredential {
212
228
  * Whether the manifest\'s hard binding holds over the bytes this verify read.
213
229
  */
214
230
  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
231
  /**
230
- * Whether this stage stops at its first successful query or retains every result.
232
+ * Where this credential sits among the others returned. See [`crate::asset::Lineage`].
231
233
  */
232
- completion: RecoveryCompletion;
234
+ lineage: Lineage;
233
235
  }
234
236
 
235
237
  /**
@@ -258,16 +260,6 @@ export interface InitValidation {
258
260
  */
259
261
  export type SegmentValidation = ({ kind: "init" } & InitValidation) | ({ kind: "media" } & MediaValidation) | { kind: "unknown" };
260
262
 
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
-
271
263
  /**
272
264
  * The error every SDK call throws: a decoded `google.rpc.Status`, discriminated
273
265
  * by `kind`. A consumer switches on `err.kind` (`\"reason\" | \"invalid\" | \"status\"`)
@@ -276,11 +268,6 @@ export type RecoveryCompletion = "firstResult" | "allResults";
276
268
  */
277
269
  export type SdkError = ({ kind: "status" } & StatusError) | ({ kind: "reason" } & ReasonError) | ({ kind: "invalid" } & InvalidError);
278
270
 
279
- /**
280
- * The registry work a verification call is allowed to perform.
281
- */
282
- export type RecoveryPlan = { custom: { stages: RecoveryStage[] } };
283
-
284
271
  /**
285
272
  * Timing facts carried by a media segment\'s container.
286
273
  */
@@ -299,13 +286,38 @@ export interface SegmentTiming {
299
286
  eventDurationSecs?: number;
300
287
  }
301
288
 
289
+ /**
290
+ * What one verify may do with the registry. Required whenever a registry is configured.
291
+ *
292
+ * One field per Soft Binding Resolution API operation, and an absent one is not called.
293
+ * `matches/byBinding` is decided by the binders handed to the verify: each is derived and looked
294
+ * up, all together, and every result is kept. The content forms run after that, each for the
295
+ * detectors it names, hinted with the first fingerprint the binders derived. Results merge by
296
+ * manifest; nothing is ranked or dropped.
297
+ */
298
+ export interface Recovery {
299
+ /**
300
+ * When the registry is consulted at all.
301
+ */
302
+ when: RecoveryPolicy;
303
+ /**
304
+ * `matches/byContent`: the bounded asset bytes travel in the request.
305
+ */
306
+ byContent?: ByContent;
307
+ /**
308
+ * `matches/byReference`: the registry fetches the asset from the caller\'s URL instead, for
309
+ * an asset above the upload cap.
310
+ */
311
+ byReference?: ByReference;
312
+ }
313
+
302
314
  /**
303
315
  * When [`AssetVerifier::verify_asset`] queries the registry.
304
316
  */
305
317
  export type RecoveryPolicy = "whenMissing" | "always";
306
318
 
307
319
  /**
308
- * Where the registry is and when to query it. Query reach and scheduling are selected per verify.
320
+ * Where the registry is. What a verify may do with it is per call, in [`Recovery`].
309
321
  */
310
322
  export interface RegistryOptions {
311
323
  /**
@@ -313,9 +325,12 @@ export interface RegistryOptions {
313
325
  */
314
326
  url: string;
315
327
  /**
316
- * Defaults to [`RecoveryPolicy::WhenMissing`].
328
+ * Federated resolution APIs a match may name as holding its manifest, beside the ones the
329
+ * C2PA algorithm list publishes, which are always allowed. C2PA 2.4 lets a match carry an
330
+ * `endpoint`; one allowed is fetched from, any other is reported as refused. Checked like
331
+ * `url`: https, or http on loopback only.
317
332
  */
318
- recovery?: RecoveryPolicy;
333
+ endpoints?: string[];
319
334
  }
320
335
 
321
336
  /**
@@ -323,6 +338,17 @@ export interface RegistryOptions {
323
338
  */
324
339
  export type ValidationCodeKind = "success" | "informational" | "failure";
325
340
 
341
+ /**
342
+ * Whether a content form runs on this verify. Judged against the byBinding results alone.
343
+ */
344
+ export type ContentTrigger = "byBindingMisses" | "always";
345
+
346
+ /**
347
+ * Which advertised server-side detectors a content form runs. Every selected detector runs,
348
+ * including one a local binder already queried by binding.
349
+ */
350
+ export type Detectors = { kind: "fingerprint" } | { kind: "watermark" } | { kind: "all" } | { kind: "named"; algorithms: string[] };
351
+
326
352
  /**
327
353
  * [`crate::asset::CredentialOrigin`] as JS sees it: a tagged union, since each way of finding a
328
354
  * credential carries different evidence. Lane-local for the same reason [`FingerprintCheck`] is: a
@@ -342,31 +368,46 @@ export type FingerprintCheck = { kind: "notNeeded" } | { kind: "nothingToCompare
342
368
  */
343
369
  export type HardBinding = "holds" | "mismatch";
344
370
 
371
+ /**
372
+ * [`crate::asset::Lineage`] as JS sees it.
373
+ */
374
+ export interface Lineage {
375
+ supersedes: string[];
376
+ supersededBy: string[];
377
+ }
378
+
379
+ /**
380
+ * [`crate::asset::RecoveryIssue`] as JS sees it: a tagged union, each kind with its own data.
381
+ */
382
+ export type RecoveryIssue = { kind: "binder"; binderIndex: number; message: string } | { kind: "deprecatedAlgorithm"; algorithm: string } | { kind: "bindingQuery"; binderIndex: number; algorithm: string; message: string } | { kind: "queryRefused"; algorithm: string; message: string } | { kind: "contentForm"; message: string } | { kind: "contentQuery"; algorithm: string; message: string } | { kind: "capabilities"; message: string } | { kind: "contentTooLarge"; capBytes: number } | { kind: "candidateFetch"; manifestId: string; message: string } | { kind: "candidateValidation"; manifestId: string; reason: string } | { kind: "endpointRefused"; manifestId: string; endpoint: string } | { kind: "resourceLimit"; message: string };
383
+
384
+ /**
385
+ * [`crate::asset::VerdictRule`] as JS sees it.
386
+ */
387
+ export type VerdictRule = "onlyCandidate" | "notSuperseded" | "hardBinding";
388
+
389
+ /**
390
+ * [`crate::asset::Verdict`] as JS sees it.
391
+ */
392
+ export type Verdict = { kind: "unsigned" } | { kind: "inconclusive" } | { kind: "embedded" } | { kind: "recovered"; index: number; decidedBy: VerdictRule } | { kind: "recoveredDerivative"; index: number; decidedBy: VerdictRule } | { kind: "ambiguous"; candidates: number[] };
393
+
345
394
  export interface AssetVerification {
346
395
  credentials: FoundCredential[];
347
396
  recovery: RecoverySummary;
348
397
  goldenComparison: GoldenComparison;
349
- }
350
-
351
- export interface RecoveryIssue {
352
- kind: RecoveryIssueKind;
353
- manifestId: string | undefined;
354
- message: string;
398
+ verdict: Verdict;
355
399
  }
356
400
 
357
401
  export interface RecoverySummary {
358
402
  status: RecoveryStatus;
359
- bestCredentialIndex: number | undefined;
360
403
  issues: RecoveryIssue[];
361
404
  }
362
405
 
363
406
  export type ContentBindingClass = "fingerprint" | "watermark";
364
407
 
365
- export type GoldenComparison = { kind: "notRequested" } | { kind: "noEmbeddedManifest" } | { kind: "noRecoveredManifest" } | { kind: "matches"; recoveredIndex: number } | { kind: "differs"; recoveredIndex: number } | { kind: "indeterminate"; recoveredIndex: number | undefined };
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 };
408
+ export type GoldenComparison = { kind: "notRequested" } | { kind: "noEmbeddedManifest" } | { kind: "noRecoveredManifest" } | { kind: "recoveryIncomplete" } | { kind: "matches"; recoveredIndex: number } | { kind: "differs"; recoveredIndex: number } | { kind: "noneMatches"; candidates: number[] } | { kind: "unreadable"; recoveredIndex: number };
368
409
 
369
- export type RecoveryIssueKind = "binder" | "bindingQuery" | "queryRefused" | "contentQuery" | "capabilities" | "contentTooLarge" | "candidateFetch" | "candidateValidation" | "resourceLimit";
410
+ export type RecoveryDiscovery = { method: "byBinding"; class: ContentBindingClass; binding: SoftBinding; binderIndex: number; registryScore: number | undefined; endpoint: string | undefined } | { method: "byContent"; hint: SoftBinding | undefined; class: ContentBindingClass; algorithm: string; registryScore: number | undefined; endpoint: string | undefined } | { method: "byReference"; hint: SoftBinding | undefined; class: ContentBindingClass; algorithm: string; registryScore: number | undefined; endpoint: string | undefined };
370
411
 
371
412
  export type RecoveryStatus = "notRequested" | "notFound" | "recovered" | "incomplete";
372
413
 
@@ -382,7 +423,7 @@ export class AssetVerifier {
382
423
  */
383
424
  static create(options: AssetVerifierOptions): AssetVerifier;
384
425
  /**
385
- * Verify an asset against the configured trust anchors and per-call recovery plan.
426
+ * Verify an asset against the configured trust anchors and per-call recovery options.
386
427
  *
387
428
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
388
429
  * are native, so a master is verified through the native SDK.
@@ -601,12 +642,12 @@ export class StreamVerifier {
601
642
  }
602
643
 
603
644
  /**
604
- * Per-call soft-binding inputs. A plan is required when the verifier has a registry.
645
+ * Per-call soft-binding inputs. `recovery` is required when the verifier has a registry.
605
646
  */
606
647
  export class VerifyOptions {
607
648
  free(): void;
608
649
  [Symbol.dispose](): void;
609
- constructor(binders: Binder[], recovery_plan?: RecoveryPlan | null);
650
+ constructor(binders: Binder[], recovery?: Recovery | null);
610
651
  }
611
652
 
612
653
  export function init_panic_hook(): void;
@@ -662,18 +703,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
662
703
  export interface InitOutput {
663
704
  readonly memory: WebAssembly.Memory;
664
705
  readonly __wbg_assetverifier_free: (a: number, b: number) => void;
665
- readonly __wbg_binder_free: (a: number, b: number) => void;
666
706
  readonly __wbg_blobsource_free: (a: number, b: number) => void;
667
707
  readonly __wbg_bytessource_free: (a: number, b: number) => void;
668
708
  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
709
  readonly __wbg_verifyoptions_free: (a: number, b: number) => void;
672
710
  readonly assetverifier_create: (a: any) => [number, number, number];
673
711
  readonly assetverifier_verify: (a: number, b: any, c: number) => any;
674
- readonly binder_derive: (a: number, b: any, c: number, d: number) => any;
675
- readonly binder_held: (a: any) => [number, number, number];
676
- readonly binder_iscc: () => number;
677
712
  readonly blobsource_length: (a: number) => number;
678
713
  readonly blobsource_new: (a: any) => [number, number, number];
679
714
  readonly blobsource_readAt: (a: number, b: number, c: number) => [number, number, number];
@@ -683,19 +718,25 @@ export interface InitOutput {
683
718
  readonly memorysource_length: (a: number) => number;
684
719
  readonly memorysource_new: (a: number, b: number) => number;
685
720
  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];
721
+ readonly parse: (a: number, b: number) => [number, number, number];
722
+ readonly resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
723
+ readonly thumbnails: (a: number, b: number) => [number, number, number];
691
724
  readonly verifyoptions_new: (a: number, b: number, c: number) => number;
725
+ readonly __wbg_binder_free: (a: number, b: number) => void;
726
+ readonly binder_derive: (a: number, b: any, c: number, d: number) => any;
727
+ readonly binder_held: (a: any) => [number, number, number];
728
+ readonly binder_iscc: () => number;
692
729
  readonly C2PA_TRUST_LIST: () => [number, number];
693
730
  readonly C2PA_TSA_TRUST_LIST: () => [number, number];
694
731
  readonly DEV_CA: () => [number, number];
695
732
  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];
733
+ readonly __wbg_streamvalidation_free: (a: number, b: number) => void;
734
+ readonly __wbg_streamverifier_free: (a: number, b: number) => void;
735
+ readonly streamvalidation_export: (a: number) => [number, number, number, number];
736
+ readonly streamvalidation_validate: (a: number, b: any) => any;
737
+ readonly streamverifier_create: (a: any) => [number, number, number];
738
+ readonly streamverifier_open: (a: number, b: number, c: number) => number;
739
+ readonly streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
699
740
  readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
700
741
  readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
701
742
  readonly intounderlyingbytesource_cancel: (a: number) => void;
@@ -32,7 +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 and per-call recovery plan.
35
+ * Verify an asset against the configured trust anchors and per-call recovery options.
36
36
  *
37
37
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
38
38
  * are native, so a master is verified through the native SDK.
@@ -590,7 +590,7 @@ export class StreamVerifier {
590
590
  if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
591
591
 
592
592
  /**
593
- * Per-call soft-binding inputs. A plan is required when the verifier has a registry.
593
+ * Per-call soft-binding inputs. `recovery` is required when the verifier has a registry.
594
594
  */
595
595
  export class VerifyOptions {
596
596
  __destroy_into_raw() {
@@ -605,12 +605,12 @@ export class VerifyOptions {
605
605
  }
606
606
  /**
607
607
  * @param {Binder[]} binders
608
- * @param {RecoveryPlan | null} [recovery_plan]
608
+ * @param {Recovery | null} [recovery]
609
609
  */
610
- constructor(binders, recovery_plan) {
610
+ constructor(binders, recovery) {
611
611
  const ptr0 = passArrayJsValueToWasm0(binders, wasm.__wbindgen_malloc);
612
612
  const len0 = WASM_VECTOR_LEN;
613
- const ret = wasm.verifyoptions_new(ptr0, len0, isLikeNone(recovery_plan) ? 0 : addToExternrefTable0(recovery_plan));
613
+ const ret = wasm.verifyoptions_new(ptr0, len0, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery));
614
614
  this.__wbg_ptr = ret;
615
615
  VerifyOptionsFinalization.register(this, this.__wbg_ptr, this);
616
616
  return this;
@@ -967,6 +967,16 @@ function __wbg_get_imports() {
967
967
  const ret = result;
968
968
  return ret;
969
969
  },
970
+ __wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
971
+ let result;
972
+ try {
973
+ result = arg0 instanceof Map;
974
+ } catch (_) {
975
+ result = false;
976
+ }
977
+ const ret = result;
978
+ return ret;
979
+ },
970
980
  __wbg_instanceof_Promise_4cb210c0b8f8c959: function(arg0) {
971
981
  let result;
972
982
  try {
@@ -1274,7 +1284,7 @@ function __wbg_get_imports() {
1274
1284
  return ret;
1275
1285
  },
1276
1286
  __wbindgen_cast_0000000000000002: function(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`.
1287
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3946, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1278
1288
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hedf60f9cb8ab20c3);
1279
1289
  return ret;
1280
1290
  },
@@ -2,18 +2,12 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_assetverifier_free: (a: number, b: number) => void;
5
- export const __wbg_binder_free: (a: number, b: number) => void;
6
5
  export const __wbg_blobsource_free: (a: number, b: number) => void;
7
6
  export const __wbg_bytessource_free: (a: number, b: number) => void;
8
7
  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
8
  export const __wbg_verifyoptions_free: (a: number, b: number) => void;
12
9
  export const assetverifier_create: (a: any) => [number, number, number];
13
10
  export const assetverifier_verify: (a: number, b: any, c: number) => any;
14
- export const binder_derive: (a: number, b: any, c: number, d: number) => any;
15
- export const binder_held: (a: any) => [number, number, number];
16
- export const binder_iscc: () => number;
17
11
  export const blobsource_length: (a: number) => number;
18
12
  export const blobsource_new: (a: any) => [number, number, number];
19
13
  export const blobsource_readAt: (a: number, b: number, c: number) => [number, number, number];
@@ -23,19 +17,25 @@ export const bytessource_readAt: (a: number, b: number, c: number) => any;
23
17
  export const memorysource_length: (a: number) => number;
24
18
  export const memorysource_new: (a: number, b: number) => number;
25
19
  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];
20
+ export const parse: (a: number, b: number) => [number, number, number];
21
+ export const resource: (a: number, b: number, c: number, d: number) => [number, number, number, number];
22
+ export const thumbnails: (a: number, b: number) => [number, number, number];
31
23
  export const verifyoptions_new: (a: number, b: number, c: number) => number;
24
+ export const __wbg_binder_free: (a: number, b: number) => void;
25
+ export const binder_derive: (a: number, b: any, c: number, d: number) => any;
26
+ export const binder_held: (a: any) => [number, number, number];
27
+ export const binder_iscc: () => number;
32
28
  export const C2PA_TRUST_LIST: () => [number, number];
33
29
  export const C2PA_TSA_TRUST_LIST: () => [number, number];
34
30
  export const DEV_CA: () => [number, number];
35
31
  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];
32
+ export const __wbg_streamvalidation_free: (a: number, b: number) => void;
33
+ export const __wbg_streamverifier_free: (a: number, b: number) => void;
34
+ export const streamvalidation_export: (a: number) => [number, number, number, number];
35
+ export const streamvalidation_validate: (a: number, b: any) => any;
36
+ export const streamverifier_create: (a: any) => [number, number, number];
37
+ export const streamverifier_open: (a: number, b: number, c: number) => number;
38
+ export const streamverifier_resume: (a: number, b: number, c: number, d: number, e: number) => [number, number, 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;
@@ -30,7 +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 and per-call recovery plan.
33
+ * Verify an asset against the configured trust anchors and per-call recovery options.
34
34
  *
35
35
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
36
36
  * are native, so a master is verified through the native SDK.
@@ -547,7 +547,7 @@ var StreamVerifier = class StreamVerifier {
547
547
  };
548
548
  if (Symbol.dispose) StreamVerifier.prototype[Symbol.dispose] = StreamVerifier.prototype.free;
549
549
  /**
550
- * Per-call soft-binding inputs. A plan is required when the verifier has a registry.
550
+ * Per-call soft-binding inputs. `recovery` is required when the verifier has a registry.
551
551
  */
552
552
  var VerifyOptions = class {
553
553
  __destroy_into_raw() {
@@ -562,12 +562,12 @@ var VerifyOptions = class {
562
562
  }
563
563
  /**
564
564
  * @param {Binder[]} binders
565
- * @param {RecoveryPlan | null} [recovery_plan]
565
+ * @param {Recovery | null} [recovery]
566
566
  */
567
- constructor(binders, recovery_plan) {
567
+ constructor(binders, recovery) {
568
568
  const ptr0 = passArrayJsValueToWasm0(binders, wasm.__wbindgen_malloc);
569
569
  const len0 = WASM_VECTOR_LEN;
570
- const ret = wasm.verifyoptions_new(ptr0, len0, isLikeNone(recovery_plan) ? 0 : addToExternrefTable0(recovery_plan));
570
+ const ret = wasm.verifyoptions_new(ptr0, len0, isLikeNone(recovery) ? 0 : addToExternrefTable0(recovery));
571
571
  this.__wbg_ptr = ret;
572
572
  VerifyOptionsFinalization.register(this, this.__wbg_ptr, this);
573
573
  return this;
@@ -900,6 +900,15 @@ function __wbg_get_imports() {
900
900
  }
901
901
  return result;
902
902
  },
903
+ __wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
904
+ let result;
905
+ try {
906
+ result = arg0 instanceof Map;
907
+ } catch (_) {
908
+ result = false;
909
+ }
910
+ return result;
911
+ },
903
912
  __wbg_instanceof_Promise_4cb210c0b8f8c959: function(arg0) {
904
913
  let result;
905
914
  try {
@@ -1567,7 +1576,7 @@ var Handle = class {
1567
1576
  };
1568
1577
  var AssetVerifierHandle = class extends Handle {
1569
1578
  verify(asset, options = {}) {
1570
- return this.inner.verify(source(asset), new VerifyOptions((options.binders ?? []).map(binder), options.recoveryPlan));
1579
+ return this.inner.verify(source(asset), new VerifyOptions((options.binders ?? []).map(binder), options.recovery));
1571
1580
  }
1572
1581
  };
1573
1582
  /** One stream being validated. Dropping the handle releases the session it accumulated. */
@@ -194,19 +194,6 @@ 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
- };
210
197
  /**
211
198
  * C2PA validation state of a manifest (spec §14.3).
212
199
  */
@@ -273,14 +260,6 @@ interface StreamVerifierOptions {
273
260
  */
274
261
  segmentSkewToleranceSecs?: number;
275
262
  }
276
- /**
277
- * How a `byContent` query selects the registry\'s detector algorithms.
278
- */
279
- type ContentAlgorithm = "fingerprint" | "watermark" | "all" | {
280
- named: {
281
- algorithm: string;
282
- };
283
- };
284
263
  /**
285
264
  * One C2PA validation status entry (spec §15.3).
286
265
  */
@@ -291,6 +270,30 @@ interface ValidationCode {
291
270
  code: string;
292
271
  kind: ValidationCodeKind;
293
272
  }
273
+ /**
274
+ * One `matches/byContent` upload per selected detector.
275
+ */
276
+ interface ByContent {
277
+ after: ContentTrigger;
278
+ detectors: Detectors;
279
+ }
280
+ /**
281
+ * One `matches/byReference` query per selected detector. The registry downloads the asset
282
+ * from `url`, so the client reads no bytes for it.
283
+ */
284
+ interface ByReference {
285
+ after: ContentTrigger;
286
+ detectors: Detectors;
287
+ /**
288
+ * A short-lived https URL without credentials.
289
+ */
290
+ url: string;
291
+ /**
292
+ * The asset\'s size in bytes, which caps the registry\'s download.
293
+ */
294
+ length: number;
295
+ mediaType?: string;
296
+ }
294
297
  /**
295
298
  * One `verify` credential: the c2pa `ManifestStore`, where it came from, whether the asset\'s
296
299
  * own fingerprint backs it up, and whether its hard binding holds over the bytes read.
@@ -315,23 +318,10 @@ interface FoundCredential {
315
318
  * Whether the manifest\'s hard binding holds over the bytes this verify read.
316
319
  */
317
320
  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
321
  /**
328
- * Whether queries start one at a time or together.
322
+ * Where this credential sits among the others returned. See [`crate::asset::Lineage`].
329
323
  */
330
- execution: RecoveryExecution;
331
- /**
332
- * Whether this stage stops at its first successful query or retains every result.
333
- */
334
- completion: RecoveryCompletion;
324
+ lineage: Lineage;
335
325
  }
336
326
  /**
337
327
  * Outcome of validating a media segment against its stream\'s init.
@@ -362,22 +352,6 @@ type SegmentValidation = ({
362
352
  } & MediaValidation) | {
363
353
  kind: "unknown";
364
354
  };
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
- };
381
355
  /**
382
356
  * Timing facts carried by a media segment\'s container.
383
357
  */
@@ -395,12 +369,36 @@ interface SegmentTiming {
395
369
  */
396
370
  eventDurationSecs?: number;
397
371
  }
372
+ /**
373
+ * What one verify may do with the registry. Required whenever a registry is configured.
374
+ *
375
+ * One field per Soft Binding Resolution API operation, and an absent one is not called.
376
+ * `matches/byBinding` is decided by the binders handed to the verify: each is derived and looked
377
+ * up, all together, and every result is kept. The content forms run after that, each for the
378
+ * detectors it names, hinted with the first fingerprint the binders derived. Results merge by
379
+ * manifest; nothing is ranked or dropped.
380
+ */
381
+ interface Recovery {
382
+ /**
383
+ * When the registry is consulted at all.
384
+ */
385
+ when: RecoveryPolicy;
386
+ /**
387
+ * `matches/byContent`: the bounded asset bytes travel in the request.
388
+ */
389
+ byContent?: ByContent;
390
+ /**
391
+ * `matches/byReference`: the registry fetches the asset from the caller\'s URL instead, for
392
+ * an asset above the upload cap.
393
+ */
394
+ byReference?: ByReference;
395
+ }
398
396
  /**
399
397
  * When [`AssetVerifier::verify_asset`] queries the registry.
400
398
  */
401
399
  type RecoveryPolicy = "whenMissing" | "always";
402
400
  /**
403
- * Where the registry is and when to query it. Query reach and scheduling are selected per verify.
401
+ * Where the registry is. What a verify may do with it is per call, in [`Recovery`].
404
402
  */
405
403
  interface RegistryOptions {
406
404
  /**
@@ -408,14 +406,35 @@ interface RegistryOptions {
408
406
  */
409
407
  url: string;
410
408
  /**
411
- * Defaults to [`RecoveryPolicy::WhenMissing`].
409
+ * Federated resolution APIs a match may name as holding its manifest, beside the ones the
410
+ * C2PA algorithm list publishes, which are always allowed. C2PA 2.4 lets a match carry an
411
+ * `endpoint`; one allowed is fetched from, any other is reported as refused. Checked like
412
+ * `url`: https, or http on loopback only.
412
413
  */
413
- recovery?: RecoveryPolicy;
414
+ endpoints?: string[];
414
415
  }
415
416
  /**
416
417
  * Whether a code is a success, an informational note, or a failure.
417
418
  */
418
419
  type ValidationCodeKind = "success" | "informational" | "failure";
420
+ /**
421
+ * Whether a content form runs on this verify. Judged against the byBinding results alone.
422
+ */
423
+ type ContentTrigger = "byBindingMisses" | "always";
424
+ /**
425
+ * Which advertised server-side detectors a content form runs. Every selected detector runs,
426
+ * including one a local binder already queried by binding.
427
+ */
428
+ type Detectors = {
429
+ kind: "fingerprint";
430
+ } | {
431
+ kind: "watermark";
432
+ } | {
433
+ kind: "all";
434
+ } | {
435
+ kind: "named";
436
+ algorithms: string[];
437
+ };
419
438
  /**
420
439
  * [`crate::asset::CredentialOrigin`] as JS sees it: a tagged union, since each way of finding a
421
440
  * credential carries different evidence. Lane-local for the same reason [`FingerprintCheck`] is: a
@@ -449,19 +468,94 @@ type FingerprintCheck = {
449
468
  * [`crate::asset::HardBinding`] as JS sees it.
450
469
  */
451
470
  type HardBinding = "holds" | "mismatch";
471
+ /**
472
+ * [`crate::asset::Lineage`] as JS sees it.
473
+ */
474
+ interface Lineage {
475
+ supersedes: string[];
476
+ supersededBy: string[];
477
+ }
478
+ /**
479
+ * [`crate::asset::RecoveryIssue`] as JS sees it: a tagged union, each kind with its own data.
480
+ */
481
+ type RecoveryIssue = {
482
+ kind: "binder";
483
+ binderIndex: number;
484
+ message: string;
485
+ } | {
486
+ kind: "deprecatedAlgorithm";
487
+ algorithm: string;
488
+ } | {
489
+ kind: "bindingQuery";
490
+ binderIndex: number;
491
+ algorithm: string;
492
+ message: string;
493
+ } | {
494
+ kind: "queryRefused";
495
+ algorithm: string;
496
+ message: string;
497
+ } | {
498
+ kind: "contentForm";
499
+ message: string;
500
+ } | {
501
+ kind: "contentQuery";
502
+ algorithm: string;
503
+ message: string;
504
+ } | {
505
+ kind: "capabilities";
506
+ message: string;
507
+ } | {
508
+ kind: "contentTooLarge";
509
+ capBytes: number;
510
+ } | {
511
+ kind: "candidateFetch";
512
+ manifestId: string;
513
+ message: string;
514
+ } | {
515
+ kind: "candidateValidation";
516
+ manifestId: string;
517
+ reason: string;
518
+ } | {
519
+ kind: "endpointRefused";
520
+ manifestId: string;
521
+ endpoint: string;
522
+ } | {
523
+ kind: "resourceLimit";
524
+ message: string;
525
+ };
526
+ /**
527
+ * [`crate::asset::VerdictRule`] as JS sees it.
528
+ */
529
+ type VerdictRule = "onlyCandidate" | "notSuperseded" | "hardBinding";
530
+ /**
531
+ * [`crate::asset::Verdict`] as JS sees it.
532
+ */
533
+ type Verdict = {
534
+ kind: "unsigned";
535
+ } | {
536
+ kind: "inconclusive";
537
+ } | {
538
+ kind: "embedded";
539
+ } | {
540
+ kind: "recovered";
541
+ index: number;
542
+ decidedBy: VerdictRule;
543
+ } | {
544
+ kind: "recoveredDerivative";
545
+ index: number;
546
+ decidedBy: VerdictRule;
547
+ } | {
548
+ kind: "ambiguous";
549
+ candidates: number[];
550
+ };
452
551
  interface AssetVerification {
453
552
  credentials: FoundCredential[];
454
553
  recovery: RecoverySummary;
455
554
  goldenComparison: GoldenComparison;
456
- }
457
- interface RecoveryIssue {
458
- kind: RecoveryIssueKind;
459
- manifestId: string | undefined;
460
- message: string;
555
+ verdict: Verdict;
461
556
  }
462
557
  interface RecoverySummary {
463
558
  status: RecoveryStatus;
464
- bestCredentialIndex: number | undefined;
465
559
  issues: RecoveryIssue[];
466
560
  }
467
561
  type ContentBindingClass = "fingerprint" | "watermark";
@@ -471,6 +565,8 @@ type GoldenComparison = {
471
565
  kind: "noEmbeddedManifest";
472
566
  } | {
473
567
  kind: "noRecoveredManifest";
568
+ } | {
569
+ kind: "recoveryIncomplete";
474
570
  } | {
475
571
  kind: "matches";
476
572
  recoveredIndex: number;
@@ -478,8 +574,11 @@ type GoldenComparison = {
478
574
  kind: "differs";
479
575
  recoveredIndex: number;
480
576
  } | {
481
- kind: "indeterminate";
482
- recoveredIndex: number | undefined;
577
+ kind: "noneMatches";
578
+ candidates: number[];
579
+ } | {
580
+ kind: "unreadable";
581
+ recoveredIndex: number;
483
582
  };
484
583
  type RecoveryDiscovery = {
485
584
  method: "byBinding";
@@ -487,14 +586,22 @@ type RecoveryDiscovery = {
487
586
  binding: SoftBinding;
488
587
  binderIndex: number;
489
588
  registryScore: number | undefined;
589
+ endpoint: string | undefined;
490
590
  } | {
491
591
  method: "byContent";
492
592
  hint: SoftBinding | undefined;
493
593
  class: ContentBindingClass;
494
594
  algorithm: string;
495
595
  registryScore: number | undefined;
596
+ endpoint: string | undefined;
597
+ } | {
598
+ method: "byReference";
599
+ hint: SoftBinding | undefined;
600
+ class: ContentBindingClass;
601
+ algorithm: string;
602
+ registryScore: number | undefined;
603
+ endpoint: string | undefined;
496
604
  };
497
- type RecoveryIssueKind = "binder" | "bindingQuery" | "queryRefused" | "contentQuery" | "capabilities" | "contentTooLarge" | "candidateFetch" | "candidateValidation" | "resourceLimit";
498
605
  type RecoveryStatus = "notRequested" | "notFound" | "recovered" | "incomplete";
499
606
  declare class AssetVerifier {
500
607
  private constructor();
@@ -507,7 +614,7 @@ declare class AssetVerifier {
507
614
  */
508
615
  static create(options: AssetVerifierOptions): AssetVerifier;
509
616
  /**
510
- * Verify an asset against the configured trust anchors and per-call recovery plan.
617
+ * Verify an asset against the configured trust anchors and per-call recovery options.
511
618
  *
512
619
  * Reads the C2PA-native formats. A container format (MXF) is plugin-backed, and plugins
513
620
  * are native, so a master is verified through the native SDK.
@@ -617,12 +724,12 @@ declare class StreamVerifier {
617
724
  resume(stream_id: string, state: Uint8Array): StreamValidation;
618
725
  }
619
726
  /**
620
- * Per-call soft-binding inputs. A plan is required when the verifier has a registry.
727
+ * Per-call soft-binding inputs. `recovery` is required when the verifier has a registry.
621
728
  */
622
729
  declare class VerifyOptions {
623
730
  free(): void;
624
731
  [Symbol.dispose](): void;
625
- constructor(binders: Binder[], recovery_plan?: RecoveryPlan | null);
732
+ constructor(binders: Binder[], recovery?: Recovery | null);
626
733
  }
627
734
  //#endregion
628
735
  //#region src/worker-thread.d.ts
@@ -644,7 +751,8 @@ type BinderSpec = {
644
751
  };
645
752
  interface AssetVerifyOptions {
646
753
  readonly binders?: readonly BinderSpec[];
647
- readonly recoveryPlan?: RecoveryPlan;
754
+ /** Required when the verifier has a registry: what this verify may do with it. */
755
+ readonly recovery?: Recovery;
648
756
  }
649
757
  /**
650
758
  * A wasm object held in this thread on the caller's behalf.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trylimbo/sdk-verifier-wasm",
3
- "version": "0.2.11-canary.16",
3
+ "version": "0.2.11-canary.19",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",