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/usage.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,22 +32,26 @@ c2pa = { version = "0.45.2", features = ["file_io", "add_thumbnails"] }
32
32
33
33
## Features
34
34
35
-
The Rust library crate provides the following capabilities:
35
+
You can enable any of the following features:
36
36
37
-
*`openssl`*(enabled by default)* - Enables the system`openssl` implementation for cryptography.
38
-
*`rust_native_crypto` - Enables the Rust native implementation for cryptography.
39
-
*`add_thumbnails` generates thumbnails automatically for JPEG and PNG files. (no longer included with `file_io`)
40
-
*`fetch_remote_manifests` enables the verification step to retrieve externally referenced manifest stores. External manifests are only fetched if there is no embedded manifest store and no locally adjacent .c2pa manifest store file of the same name.
41
-
*`file_io` enables manifest generation, signing via OpenSSL, and embedding manifests in [supported file formats](supported-formats.md).
42
-
*`json_schema` is used by `make schema`to produce a JSON schema document that represents the `ManifestStore` data structures.
43
-
*`pdf` - Enable support for reading claims on PDF files.
37
+
-**openssl***(enabled by default)*: Use the vendored`openssl` implementation for cryptography.
38
+
-**rust_native_crypto**: Use Rust native cryptography.
39
+
-**add_thumbnails**: Adds the [`image`](https://github.com/image-rs/image) crate to enable auto-generated thumbnails, if possible and enabled in settings.
40
+
-**fetch_remote_manifests**: Fetches remote manifests over the network when no embedded manifest is present and that option is enabled in settings.
41
+
-**file_io**: Enables APIs that use filesystem I/O.
42
+
-**json_schema**: Adds the [`schemars`](https://github.com/GREsau/schemars) crate to derive JSON schemas for JSON-compatible structs.
43
+
-**pdf**: Enables basic PDF read support.
44
44
45
-
* the `v1_api` feature is no longer supported.
45
+
> [!NOTE]
46
+
> If both `rust_native_crypto` and `openssl` are enabled, then only `rust_native_crypto` will be enabled.
47
+
> To avoid including `openssl` as a dependency, disable default features when using `rust_native_crypto`.
46
48
47
-
[!NOTE]
48
-
If both `rust_native_crypto` and `openssl` are enabled, it will default to `rust_native_crypto`.
49
-
It is recommended to disable default features when using `rust_native_crypto` as to avoid including `openssl` as a dependency.
49
+
### Features no longer supported
50
50
51
+
The following features are no longer supported:
52
+
53
+
***v1_api**. The old API that this enabled has been removed.
54
+
***serialize_thumbnails**. Thumbnails can be serialized by accessing resources directly.
51
55
52
56
### Resource references
53
57
@@ -60,19 +64,20 @@ When defining a resource for the [ManifestStoreBuilder](https://docs.rs/c2pa/lat
60
64
The specification often requires adding a `HashedUri` to an assertion. Since the JUMBF URIs for a new manifest are not known when defining the manifest, this creates a "chicken and egg" scenario, resolved with local resource references. When constructing the JUMBF for a manifest, the library converts all local URI references into JUMBF references and corrects the the associated cross references.
61
65
62
66
URI schemes in a resource reference can have the following forms:
67
+
63
68
-`self#jumbf` - An internal JUMBF reference
64
69
-`file:///` - A local file reference
65
70
-`app://contentauth/` - A working store reference
66
71
-`http://` - Remote URI
67
72
-`https://` - Remote secure URI
68
73
69
-
Note that the `file:` and `app:` schemes are only used in the context of ManifestStoreBuilder and will never be in JUMBF data. This is proposal, currently there is no implementation for file or app schemes and we do not yet handle http/https schemes this way.
74
+
Note that the `file:` and `app:` schemes are only used in the context of `ManifestStoreBuilder` and will never be in JUMBF data. This is proposal, currently there is no implementation for file or app schemes and we do not yet handle HTTP/HTTPS schemes this way.
70
75
71
76
<!-- Is the above still true? "This is proposal, currently there is no implementation" -->
72
77
73
78
When `file_io` is enabled, the lack of a scheme will be interpreted as a `file:///` reference, otherwise as an `app:` reference.
74
79
75
-
### Source asset vs parent asset
80
+
### Source asset versus parent asset
76
81
77
82
The source asset isn't always the parent asset: The source asset is the asset that is hashed and signed. It can be the output from an editing application that has not preserved the manifest store from the parent. In that case, the application should have extracted a parent ingredient from the parent asset and added that to the manifest definition.
78
83
@@ -86,6 +91,7 @@ If there is no parent ingredient defined, and the source has a manifest store, t
86
91
### Remote URLs and embedding
87
92
88
93
The default operation of C2PA signing is to embed a C2PA manifest store into an asset. The library also returns the C2PA manifest store so that it can be written to a sidecar or uploaded to a remote service.
94
+
89
95
- The API supports embedding a remote URL reference into the asset.
90
96
- The remote URL is stored in different ways depending on the asset, but is often stored in XMP data.
91
97
- The remote URL must be added to the asset before signing so that it can be hashed along with the asset.
@@ -95,7 +101,6 @@ The default operation of C2PA signing is to embed a C2PA manifest store into an
95
101
- The remote URL can be set with `builder.remote_url`.
96
102
- If embedding is not needed, set the `builder.no_embed` flag to `true`.
97
103
98
-
99
104
## Example code
100
105
101
106
The [sdk/examples](https://github.com/contentauth/c2pa-rs/tree/main/sdk/examples) directory contains some minimal example code. The [client/client.rs](https://github.com/contentauth/c2pa-rs/blob/main/sdk/examples/client/client.rs) is the most instructive and provides and example of reading the contents of a manifest store, recursively displaying nested manifests.
Copy file name to clipboardExpand all lines: sdk/src/lib.rs
+16-2Lines changed: 16 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,9 @@
25
25
//! The library has a Builder/Reader API that focuses on simplicity
26
26
//! and stream support.
27
27
//!
28
-
//! ## Example: Reading a ManifestStore
28
+
//! # Examples
29
+
//!
30
+
//! ## Reading a manifest
29
31
//!
30
32
//! ```
31
33
//! # use c2pa::Result;
@@ -46,7 +48,7 @@
46
48
//! # }
47
49
//! ```
48
50
//!
49
-
//! ## Example: Adding a Manifest to a file
51
+
//! ## Adding a manifest to a file
50
52
//!
51
53
//! ```ignore-wasm32
52
54
//! # use c2pa::Result;
@@ -86,6 +88,18 @@
86
88
//! # Ok(())
87
89
//! # }
88
90
//! ```
91
+
//!
92
+
//! # Features
93
+
//!
94
+
//! You can enable any of the following features:
95
+
//!
96
+
//! - **openssl** *(enabled by default)*: Use the vendored `openssl` implementation for cryptography.
97
+
//! - **rust_native_crypto**: Use Rust native cryptography.
98
+
//! - **add_thumbnails**: Adds the [`image`](https://github.com/image-rs/image) crate to enable auto-generated thumbnails, if possible and enabled in settings.
99
+
//! - **fetch_remote_manifests**: Fetches remote manifests over the network when no embedded manifest is present and that option is enabled in settings.
100
+
//! - **file_io**: Enables APIs that use filesystem I/O.
101
+
//! - **json_schema**: Adds the [`schemars`](https://github.com/GREsau/schemars) crate to derive JSON schemas for JSON-compatible structs.
0 commit comments