@contentauth/c2pa-web 0.16.0 → 0.17.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.
- package/README.md +11 -10
- package/dist/builder-EizXw-Lf.js +617 -0
- package/dist/c2pa_worker.js +6 -0
- package/dist/common.d.ts +1 -2
- package/dist/common.d.ts.map +1 -1
- package/dist/index.js +5 -28
- package/dist/inline.d.ts +1 -0
- package/dist/inline.d.ts.map +1 -1
- package/dist/inline.js +4 -3
- package/dist/lib/builder.d.ts +1 -32
- package/dist/lib/builder.d.ts.map +1 -1
- package/dist/lib/c2pa.d.ts +0 -16
- package/dist/lib/c2pa.d.ts.map +1 -1
- package/dist/lib/reader.d.ts +1 -25
- package/dist/lib/reader.d.ts.map +1 -1
- package/dist/lib/signer.d.ts +3 -1
- package/dist/lib/signer.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +4 -4
- package/dist/c2pa-CqMzdYCb.js +0 -968
package/README.md
CHANGED
|
@@ -104,22 +104,23 @@ const reader2 = await Reader.fromBlob(
|
|
|
104
104
|
|
|
105
105
|
Each `Context` holds whatever single `Settings` object was passed to its constructor and does not handle any merging of settings. To combine more than one `Settings` source, merge them first with `mergeSettings()`, then construct a `Context` from the single, merged result. See [`c2pa-utilities`'s README](../c2pa-utilities/README.md#combining-settings) for details.
|
|
106
106
|
|
|
107
|
-
A `Context`'s settings are resolved
|
|
107
|
+
A `Context`'s settings are resolved on its first use and then memoized for re-use. Passing the same `Context` instance to multiple `Reader`/`Builder` calls doesn't re-fetch trust-anchor URLs on every call.
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
`Context` is defined in `@contentauth/c2pa-utilities` and re-exported unchanged by `@contentauth/c2pa-node`, `@contentauth/c2pa-web` and `@contentauth/c2pa-web/inline`. These entry points share constructor identity and types, including for subclasses. Application bundlers should resolve a single compatible utilities version rather than embedding separate copies.
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
### Migrating from the deprecated factory API
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
const c2pa = await createC2pa({ wasmSrc, settings: { verify: { verifyTrust: true } } });
|
|
113
|
+
`createC2pa({ settings })`, `c2pa.reader` and `c2pa.builder` have been removed, including from `/inline`. Use the static Reader/Builder methods with a `Context` instead:
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const builder = await
|
|
115
|
+
```typescript
|
|
116
|
+
const c2pa = await createC2pa({ wasmSrc });
|
|
117
|
+
const context = new Context(mergeSettings(baseSettings, perInstanceSettings));
|
|
118
|
+
const reader = await Reader.fromBlob(c2pa, blob.type, blob, context);
|
|
119
|
+
const builder = await Builder.new(c2pa, context);
|
|
121
120
|
```
|
|
122
121
|
|
|
122
|
+
Import `mergeSettings` from the same SDK entry point to preserve the old top-level/per-call merge precedence explicitly. Use `Reader.fromBlobFragment`, `Builder.fromDefinition` and `Builder.fromArchive` for the corresponding removed factory methods. Omit the context argument, or pass `new Context()`, to use defaults. Raw settings objects and `null` are not Context arguments.
|
|
123
|
+
|
|
123
124
|
## Using the library
|
|
124
125
|
|
|
125
126
|
See also the [versioned API reference documentation](https://contentauth.github.io/c2pa-js/web/).
|