@contentauth/c2pa-web 0.14.5 → 0.15.0

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.
@@ -1,38 +1,43 @@
1
- import { WorkerManager } from './worker/workerManager.js';
2
1
  import { Signer } from './signer.js';
3
2
  import { Action, BuilderIntent, C2paReason, Ingredient, ManifestDefinition } from '@contentauth/c2pa-types';
4
- import { Settings } from '@contentauth/c2pa-utilities';
3
+ import { Context, Settings } from '@contentauth/c2pa-utilities';
4
+ import { C2pa } from './c2pa.js';
5
+ export interface ManifestAndAssetBytes {
6
+ manifest: Uint8Array<ArrayBuffer>;
7
+ asset: Uint8Array<ArrayBuffer>;
8
+ }
5
9
  /**
6
- * Functions that permit the creation of Builder objects.
10
+ * The `Builder` class supports building C2PA manifests and signing assets.
7
11
  */
8
- export interface BuilderFactory {
12
+ export declare class Builder {
13
+ #private;
14
+ private constructor();
9
15
  /**
10
16
  * Create a {@link Builder} with a minimal manifest definition as its initial state.
11
- * @param settings Optional context settings for the builder. Will override any values inherited by the top-level settings passed to createC2pa.
17
+ *
18
+ * @param c2pa The `C2pa` instance (from {@link createC2pa}) to create this builder on.
19
+ * @param context Optional `Context` configuring this builder's behavior.
12
20
  * @returns A {@link Builder} object.
13
21
  */
14
- new: (settings?: Settings) => Promise<Builder>;
22
+ static new(c2pa: C2pa, context?: Context): Promise<Builder>;
15
23
  /**
16
24
  * Create a {@link Builder} from a {@link ManifestDefinition}.
17
25
  *
26
+ * @param c2pa The `C2pa` instance (from {@link createC2pa}) to create this builder on.
18
27
  * @param definition The {@link ManifestDefinition} to be used as the builder's initial state.
19
- * @param settings Optional context settings for the builder. Will override any values inherited by the top-level settings passed to createC2pa.
28
+ * @param context Optional `Context` configuring this builder's behavior.
20
29
  * @returns A {@link Builder} object.
21
30
  */
22
- fromDefinition: (definition: ManifestDefinition, settings?: Settings) => Promise<Builder>;
31
+ static fromDefinition(c2pa: C2pa, definition: ManifestDefinition, context?: Context): Promise<Builder>;
23
32
  /**
24
33
  * Create a {@link Builder} from a builder archive (created from {@link Builder.toArchive}).
25
34
  *
35
+ * @param c2pa The `C2pa` instance (from {@link createC2pa}) to create this builder on.
26
36
  * @param archive Builder archive as a blob.
27
- * @param settings Optional context settings for the builder. Will override any values inherited by the top-level settings passed to createC2pa.
37
+ * @param context Optional `Context` configuring this builder's behavior.
28
38
  * @returns A {@link Builder} object.
29
39
  */
30
- fromArchive: (archive: Blob, settings?: Settings) => Promise<Builder>;
31
- }
32
- /**
33
- * Exposes methods for building C2PA manifests and signing assets.
34
- */
35
- export interface Builder {
40
+ static fromArchive(c2pa: C2pa, archive: Blob, context?: Context): Promise<Builder>;
36
41
  /**
37
42
  * Sets the builder "intent."
38
43
  *
@@ -40,49 +45,50 @@ export interface Builder {
40
45
  *
41
46
  * @param intent
42
47
  */
43
- setIntent: (intent: BuilderIntent) => Promise<void>;
48
+ setIntent(intent: BuilderIntent): Promise<void>;
44
49
  /**
45
50
  * Add an action to the manifest's actions assertion.
46
51
  *
47
52
  * @param action Object representing the action to be added.
48
53
  */
49
- addAction: (action: Action) => Promise<void>;
54
+ addAction(action: Action): Promise<void>;
50
55
  /**
51
56
  * Add an assertion to the manifest under the given label.
52
57
  *
53
58
  * @param label The assertion label (reverse-domain format).
54
59
  * @param data The assertion data (any JSON-serializable value).
55
60
  */
56
- addAssertion: (label: string, data: unknown) => Promise<void>;
61
+ addAssertion(label: string, data: unknown): Promise<void>;
62
+ /**
63
+ * Redact an assertion from an ingredient manifest.
64
+ *
65
+ * Adds the URI to the builder's redaction list and appends a `c2pa.redacted` action
66
+ * with the given reason, as required by the C2PA spec.
67
+ *
68
+ * @param uri JUMBF URI of the assertion to redact.
69
+ * @param reason The {@link C2paReason} for the redaction.
70
+ */
71
+ addRedaction(uri: string, reason: C2paReason): Promise<void>;
57
72
  /**
58
73
  * Sets the remote URL for a remote manifest. The manifest is expected to be available at this location.
59
74
  *
60
75
  * @param url URL pointing to the location the remote manifest will be stored.
61
76
  */
62
- setRemoteUrl: (url: string) => Promise<void>;
77
+ setRemoteUrl(url: string): Promise<void>;
63
78
  /**
64
- * Sets the state of the no_embed flag. To skip embedding a manifest (e.g. for the remote-only case) set this to `true`.
79
+ * Sets the state of the no_embed flag.
80
+ * To skip embedding a manifest (e.g. for the remote-only case), set this to `true`.
65
81
  *
66
82
  * @param noEmbed Value to set the no_embed flag.
67
83
  */
68
- setNoEmbed: (noEmbed: boolean) => Promise<void>;
84
+ setNoEmbed(noEmbed: boolean): Promise<void>;
69
85
  /**
70
86
  * Set a thumbnail from a blob to be included in the manifest. The blob should represent the asset being signed.
71
87
  *
72
88
  * @param format Format of the thumbnail
73
89
  * @param blob Blob of the thumbnail bytes
74
90
  */
75
- setThumbnailFromBlob: (format: string, blob: Blob) => Promise<void>;
76
- /**
77
- * Redact an assertion from an ingredient manifest.
78
- *
79
- * Adds the URI to the builder's redaction list and appends a `c2pa.redacted` action
80
- * with the given reason, as required by the C2PA spec.
81
- *
82
- * @param uri JUMBF URI of the assertion to redact.
83
- * @param reason The {@link C2paReason} for the redaction.
84
- */
85
- addRedaction: (uri: string, reason: C2paReason) => Promise<void>;
91
+ setThumbnailFromBlob(format: string, blob: Blob): Promise<void>;
86
92
  /**
87
93
  * Experimental.
88
94
  * Retains only the actions for which `keep` returns true.
@@ -94,9 +100,15 @@ export interface Builder {
94
100
  * orphans, afterwards if you also want to drop ingredients now orphaned by the removed
95
101
  * actions.
96
102
  *
103
+ * Unlike the Node binding, Neon, which can invoke the JS predicate synchronously from Rust,
104
+ * the WASM builder lives in a Web Worker. A predicate closure can't be called across the
105
+ * worker boundary, so we evaluate it here on the main thread and send the resulting indices
106
+ * to the worker, where WASM applies the equivalent index-based filter. The action/ingredient
107
+ * ordering here must match what WASM iterates. See `filterActionsAt` and `filterIngredientsAt`.
108
+ *
97
109
  * @param keep The action is retained when the predicate returns true.
98
110
  */
99
- filterActions: (keep: (action: Action) => boolean) => Promise<void>;
111
+ filterActions(keep: (action: Action) => boolean): Promise<void>;
100
112
  /**
101
113
  * Experimental.
102
114
  * Retains ingredients, then rewrites positional ingredient references so linked actions
@@ -110,7 +122,7 @@ export interface Builder {
110
122
  *
111
123
  * @param rescue Can rescue an otherwise-orphaned ingredient by returning true.
112
124
  */
113
- filterIngredients: (rescue: (ingredient: Ingredient) => boolean) => Promise<void>;
125
+ filterIngredients(rescue: (ingredient: Ingredient) => boolean): Promise<void>;
114
126
  /**
115
127
  * Experimental.
116
128
  * Retains actions and ingredients together in one step.
@@ -122,7 +134,7 @@ export interface Builder {
122
134
  * @param rescueIngredient Can rescue an otherwise-orphaned ingredient (and the action
123
135
  * referencing it) by returning true.
124
136
  */
125
- filterActionsAndIngredients: (keepAction: (action: Action) => boolean, rescueIngredient: (ingredient: Ingredient) => boolean) => Promise<void>;
137
+ filterActionsAndIngredients(keepAction: (action: Action) => boolean, rescueIngredient: (ingredient: Ingredient) => boolean): Promise<void>;
126
138
  /**
127
139
  * Replaces the actions in the `c2pa.actions`/`c2pa.actions.v2` assertions.
128
140
  *
@@ -140,13 +152,13 @@ export interface Builder {
140
152
  *
141
153
  * @param transform Receives one assertion's actions and returns its full replacement list.
142
154
  */
143
- updateActions: (transform: (actions: Action[]) => Action[]) => Promise<void>;
155
+ updateActions(transform: (actions: Action[]) => Action[]): Promise<void>;
144
156
  /**
145
157
  * Add an ingredient to the builder from a definition only.
146
158
  *
147
159
  * @param ingredientDefinition {@link Ingredient} definition.
148
160
  */
149
- addIngredient: (ingredientDefinition: Ingredient) => Promise<void>;
161
+ addIngredient(ingredientDefinition: Ingredient): Promise<void>;
150
162
  /**
151
163
  * Add an ingredient to the builder from a definition, format, and blob.
152
164
  * Values specified in the ingredient definition will be merged with the ingredient, and these values take precendence.
@@ -155,52 +167,73 @@ export interface Builder {
155
167
  * @param format Format of the ingredient.
156
168
  * @param blob Blob of the ingredient's bytes.
157
169
  */
158
- addIngredientFromBlob: (ingredientDefinition: Ingredient, format: string, blob: Blob) => Promise<void>;
170
+ addIngredientFromBlob(ingredientDefinition: Ingredient, format: string, blob: Blob): Promise<void>;
159
171
  /**
160
172
  * Add a resource to the builder's resource store with an ID and blob of the resource's bytes.
161
173
  *
162
174
  * @param resourceId ID associated with the resource being added.
163
175
  * @param blob Blob of the resource's bytes.
164
176
  */
165
- addResourceFromBlob: (resourceId: string, blob: Blob) => Promise<void>;
177
+ addResourceFromBlob(resourceId: string, blob: Blob): Promise<void>;
166
178
  /**
167
179
  * Gets the current manifest definition held by the builder.
168
180
  *
169
181
  * @returns The {@link ManifestDefinition} held by the builder.
170
182
  */
171
- getDefinition: () => Promise<ManifestDefinition>;
183
+ getDefinition(): Promise<ManifestDefinition>;
172
184
  /**
173
185
  * Save the builder into .c2pa format.
174
186
  * This "archive" can be added to as an ingredient with {@link addIngredientFromBlob}
175
187
  *
176
188
  * @returns A builder archive in application/c2pa format.
177
189
  */
178
- toArchive: () => Promise<Uint8Array<ArrayBuffer>>;
190
+ toArchive(): Promise<Uint8Array<ArrayBuffer>>;
179
191
  /**
180
192
  * Sign an asset.
181
193
  *
182
194
  * @todo Docs coming soon
183
195
  */
184
- sign: (signer: Signer, format: string, blob: Blob) => Promise<Uint8Array<ArrayBuffer>>;
196
+ sign(signer: Signer, format: string, blob: Blob): Promise<Uint8Array<ArrayBuffer>>;
185
197
  /**
186
198
  * Sign an asset and get both the signed asset bytes and the manifest bytes.
187
199
  *
188
200
  * @todo Docs coming soon
189
201
  */
190
- signAndGetManifestBytes: (signer: Signer, format: string, blob: Blob) => Promise<ManifestAndAssetBytes>;
202
+ signAndGetManifestBytes(signer: Signer, format: string, blob: Blob): Promise<ManifestAndAssetBytes>;
191
203
  /**
192
204
  * Dispose of this Builder, freeing the memory it occupied and preventing further use. Call this whenever the Builder is no longer needed.
193
205
  */
194
- free: () => Promise<void>;
206
+ free(): Promise<void>;
195
207
  }
196
- export interface ManifestAndAssetBytes {
197
- manifest: Uint8Array<ArrayBuffer>;
198
- asset: Uint8Array<ArrayBuffer>;
208
+ /**
209
+ * @deprecated Use `Builder`'s static methods, passing a `Context`, instead.
210
+ */
211
+ export interface BuilderFactory {
212
+ /**
213
+ * @param settings Optional settings for this builder. Will override any values inherited
214
+ * from the top-level settings passed to {@link createC2pa}.
215
+ * @deprecated Use {@link Builder.new} with a `Context` instead.
216
+ */
217
+ new: (settings?: Settings) => Promise<Builder>;
218
+ /**
219
+ * @param settings Optional settings for this builder. Will override any values inherited
220
+ * from the top-level settings passed to {@link createC2pa}.
221
+ * @deprecated Use {@link Builder.fromDefinition} with a `Context` instead.
222
+ */
223
+ fromDefinition: (definition: ManifestDefinition, settings?: Settings) => Promise<Builder>;
224
+ /**
225
+ * @param settings Optional settings for this builder. Will override any values inherited
226
+ * from the top-level settings passed to {@link createC2pa}.
227
+ * @deprecated Use {@link Builder.fromArchive} with a `Context` instead.
228
+ */
229
+ fromArchive: (archive: Blob, settings?: Settings) => Promise<Builder>;
199
230
  }
200
231
  /**
201
- * @param worker - Worker (via WorkerManager) to be associated with this reader factory.
202
- * @param settings - Optional settings to be used for all builders.
232
+ * @deprecated Use `Builder.new`/`Builder.fromDefinition`/`Builder.fromArchive` with a `Context`
233
+ * instead.
234
+ * @param c2pa The `C2pa` instance to create builders on.
235
+ * @param baseSettings Optional settings inherited by every builder created from this factory.
203
236
  * @returns A {@link BuilderFactory} object containing builder creation methods.
204
237
  */
205
- export declare function createBuilderFactory(worker: WorkerManager, settings?: Settings): BuilderFactory;
238
+ export declare function createBuilderFactory(c2pa: C2pa, baseSettings?: Settings): BuilderFactory;
206
239
  //# sourceMappingURL=builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/lib/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAA0B,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EACV,MAAM,EAEN,aAAa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;OAIG;IACH,cAAc,EAAE,CACd,UAAU,EAAE,kBAAkB,EAC9B,QAAQ,CAAC,EAAE,QAAQ,KAChB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB;;;;OAIG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACvE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,IAAI,EACV,YAAY,GAAE,QAAa,GAC1B,cAAc,CAiBhB"}
@@ -1,5 +1,6 @@
1
- import { ReaderFactory } from './reader.js';
1
+ import { WorkerManager } from './worker/workerManager.js';
2
2
  import { Settings } from '@contentauth/c2pa-utilities';
3
+ import { ReaderFactory } from './reader.js';
3
4
  import { BuilderFactory } from './builder.js';
4
5
  export interface Config {
5
6
  /**
@@ -16,36 +17,48 @@ export interface Config {
16
17
  */
17
18
  workerSrc?: URL;
18
19
  /**
20
+ * @deprecated Use a `Context` to construct a `Reader`/`Builder` via their static methods instead.
19
21
  * Settings for the SDK. Will be inherited by created builders and readers.
20
22
  */
21
23
  settings?: Settings;
22
24
  }
23
- export interface C2paSdk {
25
+ export interface C2pa {
26
+ /**
27
+ * @internal Not part of the public API.
28
+ * Reader/Builder's static methods take this whole `C2pa` object and read the worker off
29
+ * of it themselves to know which web worker to use. There's no need to touch this directly.
30
+ */
31
+ worker: WorkerManager;
24
32
  /**
25
- * Contains methods for creating Reader objects.
33
+ * @deprecated Use `Reader`'s static methods instead, passing this `C2pa` object and a `Context`.
26
34
  */
27
35
  reader: ReaderFactory;
28
36
  /**
29
- * Contains methods for creating Builder objects.
37
+ * @deprecated Use `Builder`'s static methods instead, passing this `C2pa` object and a `Context`.
30
38
  */
31
39
  builder: BuilderFactory;
32
40
  /**
33
- * Terminates the SDK's underlying web worker.
41
+ * Terminates this instance's underlying web worker.
34
42
  */
35
43
  dispose: () => void;
36
44
  }
37
45
  /**
38
46
  * Creates a new instance of c2pa-web by setting up a web worker and preparing a WASM binary.
39
47
  *
48
+ * The returned handle carries no unique configuration of its own and is purely the worker runtime
49
+ * with the WASM binary loaded on it.
50
+ *
51
+ * Clients are free to create as many `Reader`s/`Builder`s from it, each with its own `Context`
52
+ * to configure their respective behaviors. They all share the same c2pa-web instance and worker.
53
+ *
40
54
  * @param config - SDK configuration object.
41
- * @returns An object providing access to factory methods for creating new reader objects.
55
+ * @returns A handle to the running worker, to be passed to `Reader`/`Builder`'s static methods.
42
56
  *
43
57
  * @example Creating a new SDK instance and reader:
44
58
  * ```
45
59
  * const c2pa = await createC2pa({ wasmSrc: 'url/hosting/wasm/binary' });
46
- *
47
- * const reader = await c2pa.reader.fromBlob(imageBlob.type, imageBlob);
60
+ * const reader = await Reader.fromBlob(c2pa, imageBlob.type, imageBlob);
48
61
  * ```
49
62
  */
50
- export declare function createC2pa(config: Config): Promise<C2paSdk>;
63
+ export declare function createC2pa(config: Config): Promise<C2pa>;
51
64
  //# sourceMappingURL=c2pa.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"c2pa.d.ts","sourceRoot":"","sources":["../../src/lib/c2pa.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAmB,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AAEpE,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAErC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC;IAExB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcjE"}
1
+ {"version":3,"file":"c2pa.d.ts","sourceRoot":"","sources":["../../src/lib/c2pa.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAuB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAwB,cAAc,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAErC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,IAAI;IACnB;;;;OAIG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC;IAExB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB9D"}
@@ -1,63 +1,64 @@
1
1
  import { Manifest, ManifestStore } from '@contentauth/c2pa-types';
2
- import { WorkerManager } from './worker/workerManager.js';
3
- import { Settings } from '@contentauth/c2pa-utilities';
2
+ import { C2pa } from './c2pa.js';
3
+ import { Context, Settings } from '@contentauth/c2pa-utilities';
4
4
  export declare const MAX_SIZE_IN_BYTES: number;
5
5
  /**
6
- * A collection of functions that permit the creation of Reader objects from various sources.
6
+ * The `Reader` class supports reading C2PA data out of an asset.
7
+ *
8
+ * @example Getting an asset's active manifest:
9
+ * ```
10
+ * const reader = await Reader.fromBlob(c2pa, blob.type, blob);
11
+ * const activeManifest = await reader.activeManifest();
12
+ * ```
7
13
  */
8
- export interface ReaderFactory {
14
+ export declare class Reader {
15
+ #private;
16
+ private constructor();
9
17
  /**
10
18
  * Create a {@link Reader} from an asset's format and a blob of its bytes.
11
19
  *
20
+ * @param c2pa The `C2pa` instance (from {@link createC2pa}) to create this reader on.
12
21
  * @param format Asset format.
13
22
  * @param blob Blob of asset bytes.
14
- * @param settings Optional context settings for the reader. Will override any values inherited by the top-level settings passed to createC2pa.
23
+ * @param context Optional `Context` configuring this reader's behavior.
15
24
  * @returns A {@link Reader} object or null if no C2PA metadata was found.
25
+ * @throws If the asset is too large.
16
26
  */
17
- fromBlob: (format: string, blob: Blob, settings?: Settings) => Promise<Reader | null>;
27
+ static fromBlob(c2pa: C2pa, format: string, blob: Blob, context?: Context): Promise<Reader | null>;
18
28
  /**
29
+ * Create a {@link Reader} from an initial fragment and a subsequent fragment.
19
30
  *
31
+ * @param c2pa The `C2pa` instance (from {@link createC2pa}) to create this reader on.
20
32
  * @param format Asset format.
21
33
  * @param init Blob of initial fragment bytes.
22
34
  * @param fragment Blob of fragment bytes.
23
- * @param settings Optional context settings for the reader. Will override any values inherited by the top-level settings passed to createC2pa.
35
+ * @param context Optional `Context` configuring this reader's behavior.
24
36
  * @returns A {@link Reader} object or null if no C2PA metadata was found.
37
+ * @throws If the asset is too large.
25
38
  */
26
- fromBlobFragment: (format: string, init: Blob, fragment: Blob, settings?: Settings) => Promise<Reader | null>;
27
- }
28
- /**
29
- * Exposes methods for reading C2PA data out of an asset.
30
- *
31
- * @example Getting an asset's active manifest:
32
- * ```
33
- * const reader = await c2pa.reader.fromBlob(blob.type, blob);
34
- *
35
- * const activeManifest = await reader.activeManfiest();
36
- * ```
37
- */
38
- export interface Reader {
39
+ static fromBlobFragment(c2pa: C2pa, format: string, init: Blob, fragment: Blob, context?: Context): Promise<Reader | null>;
39
40
  /**
40
41
  * @returns The label of the active manifest.
41
42
  */
42
- activeLabel: () => Promise<string | null>;
43
+ activeLabel(): Promise<string | null>;
43
44
  /**
44
45
  * @returns The asset's full {@link ManifestStore} containing all its manifests, validation statuses, and the URI of the active manifest.
45
46
  */
46
- manifestStore: () => Promise<ManifestStore>;
47
+ manifestStore(): Promise<ManifestStore>;
47
48
  /**
48
49
  * @returns The asset's active {@link Manifest}.
49
50
  */
50
- activeManifest: () => Promise<Manifest>;
51
+ activeManifest(): Promise<Manifest>;
51
52
  /**
52
53
  * @returns The asset's full {@link ManifestStore}.
53
54
  *
54
55
  * @deprecated Use {@link manifestStore} instead.
55
56
  */
56
- json: () => Promise<any>;
57
+ json(): Promise<any>;
57
58
  /**
58
59
  * @returns The asset's manifest store as crJSON.
59
60
  */
60
- crJson: () => Promise<any>;
61
+ crJson(): Promise<any>;
61
62
  /**
62
63
  * Resolves a URI reference to a binary object (e.g. a thumbnail) in the resource store.
63
64
  *
@@ -66,23 +67,40 @@ export interface Reader {
66
67
  *
67
68
  * @example Retrieving a thumbnail from the resource store:
68
69
  * ```
69
- * const reader = await c2pa.reader.fromBlob(blob.type, blob);
70
- *
70
+ * const reader = await Reader.fromBlob(c2pa, blob.type, blob);
71
71
  * const activeManifest = await reader.activeManifest();
72
- *
73
72
  * const thumbnailBuffer = await reader.resourceToBytes(activeManifest.thumbnail!.identifier);
74
73
  * ```
75
74
  */
76
- resourceToBytes: (uri: string) => Promise<Uint8Array<ArrayBuffer>>;
75
+ resourceToBytes(uri: string): Promise<Uint8Array<ArrayBuffer>>;
77
76
  /**
78
- * Dispose of this Reader, freeing the memory it occupied and preventing further use. Call this whenever the Reader is no longer needed.
77
+ * Dispose of this Reader, freeing the memory it occupied and preventing further use.
78
+ * Call this whenever the Reader is no longer needed.
79
79
  */
80
- free: () => Promise<void>;
80
+ free(): Promise<void>;
81
+ }
82
+ /**
83
+ * @deprecated Use `Reader`'s static methods instead.
84
+ */
85
+ export interface ReaderFactory {
86
+ /**
87
+ * @param settings Optional settings for this reader. Will override any values inherited from
88
+ * the top-level settings passed to {@link createC2pa}.
89
+ * @deprecated Use {@link Reader.fromBlob} with a `Context` instead.
90
+ */
91
+ fromBlob: (format: string, blob: Blob, settings?: Settings) => Promise<Reader | null>;
92
+ /**
93
+ * @param settings Optional settings for this reader. Will override any values inherited from
94
+ * the top-level settings passed to {@link createC2pa}.
95
+ * @deprecated Use {@link Reader.fromBlobFragment} with a `Context` instead.
96
+ */
97
+ fromBlobFragment: (format: string, init: Blob, fragment: Blob, settings?: Settings) => Promise<Reader | null>;
81
98
  }
82
99
  /**
83
- * @param worker - Worker (via WorkerManager) to be associated with this reader factory.
84
- * @param settings - Optional settings to be used for all readers.
100
+ * @deprecated Use `Reader.fromBlob`/`Reader.fromBlobFragment` with a `Context` instead.
101
+ * @param c2pa The `C2pa` instance to create readers on.
102
+ * @param baseSettings Optional settings inherited by every reader created from this factory.
85
103
  * @returns A {@link ReaderFactory} object containing reader creation methods.
86
104
  */
87
- export declare function createReaderFactory(worker: WorkerManager, settings?: Settings): ReaderFactory;
105
+ export declare function createReaderFactory(c2pa: C2pa, baseSettings?: Settings): ReaderFactory;
88
106
  //# sourceMappingURL=reader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/lib/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,QAAQ,EAGT,MAAM,6BAA6B,CAAC;AAGrC,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,QAAQ,EAAE,CACR,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAA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AAI,EACV,QAAQ,EAAE,IAAI,EACd,QAAQ,CAAC,EAAE,QAAQ,KAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,YAAY,GAAE,QAAa,GAC1B,aAAa,CAkBf"}
@@ -2,7 +2,7 @@ import { Action, BuilderIntent, C2paReason } from '@contentauth/c2pa-types';
2
2
  import { ManifestAndAssetBytes } from '../builder.js';
3
3
  import { SerializableSigningPayload } from '../signer.js';
4
4
  declare const createTx: (worker?: Worker) => {
5
- initWorker: (module: WebAssembly.Module, settings?: string | undefined) => Promise<void>;
5
+ initWorker: (module: WebAssembly.Module) => Promise<void>;
6
6
  reader_fromBlob: (format: string, blob: Blob, contextJson?: string | undefined) => Promise<number>;
7
7
  reader_fromBlobFragment: (format: string, init: Blob, fragment: Blob, contextJson?: string | undefined) => Promise<number>;
8
8
  reader_activeLabel: (readerId: number) => Promise<string | null>;
@@ -35,7 +35,7 @@ declare const createTx: (worker?: Worker) => {
35
35
  builder_signAndGetManifestBytes: (builderId: number, requestId: number, payload: SerializableSigningPayload, format: string, blob: Blob) => Promise<ManifestAndAssetBytes>;
36
36
  builder_free: (builderId: number) => Promise<void>;
37
37
  }, rx: (receivers: {
38
- initWorker: (module: WebAssembly.Module, settings?: string) => void;
38
+ initWorker: (module: WebAssembly.Module) => void;
39
39
  reader_fromBlob: (format: string, blob: Blob, contextJson?: string) => Promise<number>;
40
40
  reader_fromBlobFragment: (format: string, init: Blob, fragment: Blob, contextJson?: string) => Promise<number>;
41
41
  reader_activeLabel: (readerId: number) => string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO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AE,CAAC"}
@@ -17,6 +17,12 @@
17
17
  * copies own properties, so it would disappear in transit. We detect this by
18
18
  * checking whether the prototype was changed, and restore the manifest as an
19
19
  * own property before the value leaves the worker.
20
+ *
21
+ * The recovered value's key is always the literal string "__proto__" -
22
+ * that's the only key whose bracket assignment triggers [[SetPrototypeOf]] -
23
+ * regardless of which manifest is active. It must be restored under that
24
+ * key rather than `store.active_manifest`, otherwise a poisoned manifest
25
+ * that isn't the active one would overwrite the genuine active manifest.
20
26
  */
21
27
  export declare function sanitizeManifestStore(store: any): any;
22
28
  //# sourceMappingURL=sanitizeManifestStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizeManifestStore.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/sanitizeManifestStore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAerD"}
1
+ {"version":3,"file":"sanitizeManifestStore.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/sanitizeManifestStore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAerD"}
@@ -7,7 +7,6 @@ export interface WorkerManager {
7
7
  }
8
8
  export interface CreateWorkerManagerConfig {
9
9
  wasm: WebAssembly.Module;
10
- settingsString?: string;
11
10
  workerSrc?: URL;
12
11
  }
13
12
  /**
@@ -23,7 +22,6 @@ export declare function validateWorkerSrc(workerSrc: URL): string;
23
22
  /**
24
23
  * Creates a new web worker and performs initialization steps:
25
24
  * - Compile WASM
26
- * - Load settings (if provided)
27
25
  *
28
26
  * @param config - configuration object
29
27
  * @returns Facade providing convenient control over worker functions
@@ -1 +1 @@
1
- {"version":3,"file":"workerManager.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerManager.ts"],"names":[],"m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E,GAAG,GAAG,MAAM,CAQxD;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,aAAa,CAAC,CAwCxB"}
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentauth/c2pa-web",
3
- "version": "0.14.5",
3
+ "version": "0.15.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,8 +33,8 @@
33
33
  "dependencies": {
34
34
  "highgain": "^0.1.0",
35
35
  "@contentauth/c2pa-types": "0.7.4",
36
- "@contentauth/c2pa-utilities": "0.2.2",
37
- "@contentauth/c2pa-wasm": "0.11.5"
36
+ "@contentauth/c2pa-utilities": "0.3.0",
37
+ "@contentauth/c2pa-wasm": "0.12.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@playwright/test": "^1.60.0",