You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/intents.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Using Builder intents
2
2
3
-
_Intents_ enable validation, add required actions that are required by the C2PA specification, and help prevent invalid operations when using a `Builder`. Intents are about the operation (create, edit, update) executed on the source asset.
3
+
_Intents_ enable validation, add the actions required by the C2PA specification, and help prevent invalid operations when using a `Builder`. Intents are about the operation (create, edit, update) executed on the source asset.
4
4
5
5
## Why use intents?
6
6
@@ -125,7 +125,7 @@ flowchart TD
125
125
126
126
## How intents relate to the source stream
127
127
128
-
The intent operates on the source passed to `sign()`, not on any ingredient added via `add_ingredient`.
128
+
The intent operates on the source passed to `sign()`, not on any ingredient added via `add_ingredient()`.
129
129
130
130
The following diagram shows what happens at sign time for each intent:
131
131
@@ -168,7 +168,7 @@ For `Edit` and `Update` intents, `Builder` looks at the source stream, and if no
168
168
169
169
### How intent relates to `add_ingredient`
170
170
171
-
The `Builder` intent controls what the Builder does with the source stream (source asset) at sign time. The `add_ingredient` method adds other ingredients explicitly. These are separate concerns.
171
+
The `Builder` intent controls what the `Builder` does with the source stream (source asset) at sign time. The `add_ingredient` method adds other ingredients explicitly. These are separate concerns.
Copy file name to clipboardExpand all lines: docs/selective-manifests.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ The fundamental workflow is:
34
34
35
35
## Reading an existing manifest
36
36
37
-
Use `Reader` with a `Context` to extract the manifest store JSON and any binary resources (thumbnails, manifest data). The source asset is never modified. The context is used for trust configuration (which certificates are trusted when validating signatures) and verification settings. See [Configuring Reader](../context.md#configuring-reader) and [Trust configuration](../context.md#trust-configuration) for details.
37
+
Use `Reader` with a `Context` to extract the manifest store JSON and any binary resources (thumbnails, manifest data). The source asset is never modified. The context is used for trust configuration (which certificates are trusted when validating signatures) and verification settings. See [Configuring `Reader`](context-settings.md#with-reader) and [Trust configuration](context-settings.md#trust) for details.
38
38
39
39
```py
40
40
ctx = Context.from_dict({
@@ -70,7 +70,7 @@ with open("thumbnail.jpg", "wb") as f:
70
70
## Filtering into a new Builder
71
71
72
72
> [!NOTE]
73
-
> All examples on this page use `Context` with `Reader` and `Builder`. For `Reader`, the context provides trust configuration and verification settings: `Reader(format, source, context=ctx)`. For `Builder`, the context provides custom settings (thumbnails, claim generator, intent): `Builder(manifest_json, context=ctx)`. When a signer is configured in the context, `builder.sign()` is called without a signer instance. See [Context](../context.md) for details.
73
+
> All examples on this page use `Context` with `Reader` and `Builder`. For `Reader`, the context provides trust configuration and verification settings: `Reader(format, source, context=ctx)`. For `Builder`, the context provides custom settings (thumbnails, claim generator, intent): `Builder(manifest_json, context=ctx)`. When a signer is configured in the context, `builder.sign()` is called without a signer instance. See [Context and settings](context-settings.md) for details.
74
74
75
75
Each example below creates a **new `Builder`** from filtered data. The original asset and its manifest store are never modified.
76
76
@@ -482,7 +482,7 @@ with open("signed_asset.jpg", "rb") as signed:
482
482
483
483
## Working with archives
484
484
485
-
A `Builder` represents a **working store**: a manifest that is being assembled but has not yet been signed. Archives serialize this working store (definition + resources) to a `.c2pa` binary format, allowing to save, transfer, or resume the work later. For more background on working stores and archives, see [Working stores](https://opensource.contentauthenticity.org/docs/rust-sdk/docs/working-stores).
485
+
A `Builder` represents a **working store**: a manifest that is being assembled but has not yet been signed. Archives serialize this working store (definition + resources) to a `.c2pa` binary format, allowing to save, transfer, or resume the work later. For more background on working stores and archives, see [Working stores and archives](working-stores.md).
486
486
487
487
There are two distinct types of archives, sharing the same binary format but being conceptually different: builder archives (working store archives) and ingredient archives.
488
488
@@ -632,7 +632,8 @@ layer_actions = [
632
632
]
633
633
```
634
634
635
-
> **Naming convention:** Vendor parameters must use reverse domain notation with period-separated components (e.g., `com.mycompany.tool`, `net.example.session_id`). Some namespaces (e.g., `c2pa` or `cawg`) may be reserved.
635
+
> [!NOTE]
636
+
> Vendor parameters must use reverse domain notation with period-separated components (for example, `com.mycompany.tool`, `net.example.session_id`). Some namespaces (for example, `c2pa` or `cawg`) may be reserved.
636
637
637
638
### Extracting ingredients from a working store
638
639
@@ -692,7 +693,7 @@ with Builder({
692
693
```
693
694
694
695
> [!NOTE]
695
-
> When restoring from an archive, `with_archive()` preserves context settings while `from_archive()` does not. See [Working with archives](../working-stores.md#working-with-archives) for the full comparison.
696
+
> When restoring from an archive, `with_archive()` preserves context settings while `from_archive()` does not. See [Working with archives](working-stores.md#working-with-archives) for the full comparison.
696
697
697
698
**Step 2:** Read the archive and extract ingredients:
698
699
@@ -733,7 +734,7 @@ with Reader("application/c2pa", archive_stream, context=ctx) as reader:
733
734
### Merging multiple working stores
734
735
735
736
> [!NOTE]
736
-
> The `Builder` construction and signing in the merge workflow also support `Context`. The caller can pass `context=ctx` to `Builder()` and call `sign()` without a signer argument when the context has one. See [Context](../context.md) for details.
737
+
> The `Builder` construction and signing in the merge workflow also support `Context`. The caller can pass `context=ctx` to `Builder()` and call `sign()` without a signer argument when the context has one. See [Context and settings](context-settings.md) for details.
737
738
738
739
In some cases it is necessary to merge ingredients from multiple working stores (builder archives) into a single `Builder`. This should be a **fallback strategy**. The recommended practice is to maintain a single active working store and add ingredients incrementally (archived ingredient catalogs help with this). Merging is available when multiple working stores must be consolidated.
Copy file name to clipboardExpand all lines: docs/usage.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,12 +154,12 @@ Use the `Reader` to read C2PA data from the specified asset file.
154
154
155
155
This examines the specified media file for C2PA data and generates a report of any data it finds. If there are validation errors, the report includes a `validation_status` field.
156
156
157
-
An asset file may contain many manifests in a manifest store. The most recent manifest is identified by the value of the `active_manifest` field in the manifests map. The manifests may contain binary resources such as thumbnails which can be retrieved with `resource_to_stream` using the associated `identifier` field values and a `uri`.
157
+
An asset file may contain many manifests in a manifest store. The most recent manifest is identified by the value of the `active_manifest` field in the manifests map. The manifests may contain binary resources such as thumbnails which can be retrieved with `resource_to_stream()` using the associated `identifier` field value as the URI.
158
158
159
159
> [!NOTE]
160
160
> For a comprehensive reference to the JSON manifest structure, see the [Manifest store reference](https://opensource.contentauthenticity.org/docs/manifest/manifest-ref).
161
161
162
-
Pass a `Context` to apply custom settings to the Reader, such as trust anchors or verification flags.
162
+
Pass a `Context` to apply custom settings to the `Reader`, such as trust anchors or verification flags.
163
163
164
164
```py
165
165
try:
@@ -181,7 +181,7 @@ except Exception as err:
181
181
> [!WARNING]
182
182
> This example accesses the private key and security certificate directly from the local file system. This is fine during development, but doing so in production is insecure. Instead use a Key Management Service (KMS) or a hardware security module (HSM) to access the certificate and key; for example as show in the [C2PA Python Example](https://github.com/contentauth/c2pa-python-example).
183
183
184
-
Pass a `Context` to the Builder to apply custom settings during signing. The signer is still passed explicitly to `builder.sign()`.
184
+
Pass a `Context` to the `Builder` to apply custom settings during signing. The signer is still passed explicitly to `builder.sign()`.
Copy file name to clipboardExpand all lines: docs/working-stores.md
+13-57Lines changed: 13 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ For more information, see:
45
45
46
46
-[Reading manifest stores from assets](#reading-manifest-stores-from-assets)
47
47
-[Creating and signing manifests](#creating-and-signing-manifests)
48
-
-[Embedded vs external manifests](#embedded-vs-external-manifests)
48
+
-[Embedded versus external manifests](#embedded-versus-external-manifests)
49
49
50
50
### Working store
51
51
@@ -59,7 +59,7 @@ A _working store_ is a `Builder` object representing an editable, in-progress ma
59
59
60
60
**Example:** When you create a `Builder` object and add assertions to it, you're dealing with a working store, as it is an "in progress" manifest being built.
61
61
62
-
For more information, see [Using Working stores](#using-working-stores).
62
+
For more information, see [Using working stores](#using-working-stores).
63
63
64
64
### Archive
65
65
@@ -68,7 +68,7 @@ A _C2PA archive_ (or just _archive_) contains the serialized bytes of a working
68
68
**Characteristics:**
69
69
70
70
- Portable serialization of a working store (`Builder`).
71
-
- Save an archive by using `Builder.to_archive()` and restore a full working store from an archive by using `Builder.with_archive()` (with a Builder created from a Context).
71
+
- Save an archive by using `Builder.to_archive()` and restore a full working store from an archive by using `Builder.with_archive()` (with a `Builder` created from a `Context`).
72
72
- Useful for separating manifest preparation ("work in progress") from final signing.
73
73
74
74
For more information, see [Working with archives](#working-with-archives).
@@ -99,7 +99,7 @@ with open("signed_image.jpg", "rb") as stream:
99
99
manifest_json = reader.json()
100
100
```
101
101
102
-
For full details on `Context` and `Settings`, see [Using Context to configure the SDK](../context.md).
102
+
For full details on `Context` and `Settings`, see [Context and settings](context-settings.md).
For testing, create a `Signer` with certificates and private key:
@@ -417,10 +406,11 @@ with open("source.jpg", "rb") as src, open("signed.jpg", "w+b") as dst:
417
406
418
407
## Working with ingredients
419
408
420
-
Ingredients represent source materials used to create an asset, preserving the provenance chain. Adding an ingredient to a manifest creates a verifiable link from the current asset back to its source material.
421
-
The `relationship` field describes how the source (ingredient) was used: `"parentOf"` for a direct edit, `"componentOf"` for an element composited into a larger work, or `"inputTo"` for a general input.
409
+
Ingredients represent source materials used to create an asset, preserving the provenance chain. Adding an ingredient to a manifest creates a verifiable link from the current asset back to its source material.
422
410
423
-
Ingredients themselves can be turned into ingredient archives (`.c2pa`). An ingredient archive is a serialized `Builder` with _exactly one_ ingredient. Once archived with only one ingredient, the Builder archive is an ingredient archive. Such ingredient archives can be used as ingredient in other working stores, as an ingredient archive can be added back directly to a working store (no un-archiving of the ingredient needed, use `application/c2pa` format when adding an ingredient archive to a Builder instance).
411
+
The `relationship` field describes how the source (ingredient) was used: `"parentOf"` for a direct edit, `"componentOf"` for an element composited into a larger work, or `"inputTo"` for a general input.
412
+
413
+
Ingredients themselves can be turned into ingredient archives (`.c2pa`). An ingredient archive is a `Builder` archive containing _exactly one_ ingredient. Ingredient archives can be added directly as an ingredient to another working store using the `application/c2pa` MIME type — no un-archiving step is needed.
424
414
425
415
### Adding ingredients to a working store
426
416
@@ -455,7 +445,7 @@ Specify the relationship between the ingredient and the current asset:
455
445
|`componentOf`| The ingredient is a component used in this asset |
456
446
|`inputTo`| The ingredient was an input to creating this asset |
457
447
458
-
Example with explicit relationship (builder is created with a Context as in the examples above):
448
+
Example with explicit relationship:
459
449
460
450
```py
461
451
ingredient_json = json.dumps({
@@ -591,7 +581,7 @@ By default, manifest stores are **embedded** directly into the asset file. You c
591
581
592
582
### Default: embedded manifest stores
593
583
594
-
By default, the manifest store is embedded in the output asset.
584
+
By default, the manifest store is embedded in the output asset.
withopen("edited.jpg", "rb") as src, open("signed.jpg", "w+b") as dst:
682
-
builder.sign("image/jpeg", src, dst)
683
-
```
637
+
-**Use `Context` for all configuration.** Pass a `Context` to `Builder` and `Reader` rather than using global state. See [Context and settings](context-settings.md).
638
+
-**Use ingredients to build provenance chains.** Add a `parentOf` ingredient whenever editing an existing asset. See [Working with ingredients](#working-with-ingredients).
639
+
-**Never hard-code private keys in production.** Use a Hardware Security Module (HSM) or Key Management Service (KMS) to access credentials.
0 commit comments