Skip to content

Commit 539adaa

Browse files
authored
feat: add settings structs to the public API (#1447)
* feat: add settings structs to public API * feat: add json schemas for settings structs * docs: document all settings structs and fields * docs: document settings modules * docs: finishing documenting settings structs and fix doc lints * docs: document main settings struct fields * fix: naming and old field tests * fix: add back trust.verify_trust_list * fix: doc verify setting warnings, private icon resource, single integer for version * fix: specify claim generator info operating system as enum * fix: example settings files * docs: clarify `verify_trust` doesn't include `verify_timestamp_trust` * docs: improve certificate status fetch/override docs * docs: clarify ocsp_fetch and certificate status settings * fix: private `OcspFetchScope` * docs: clarify `remote_manifest_fetch` docs * docs: clarify thumbnail settings * fix: use LLVM triples as claim generator OS convention * docs: remove hidden attribute for pub(crate) fields and clean up * fix: add c2pa-kp-claimSigning OID to trusted EKUs * fix: don't serde skip builder.actions, only schemars skip * fix: feature flag schemars(skip) * fix: export settings in export_schema * test: disable certificate status fetch by default in tests * docs: add more docs to intent and created_assertion_labels * fix: import settings in export_schema * fix: pub(crate) verify trust settings and document CAWG trust option
1 parent 677b1f4 commit 539adaa

File tree

12 files changed

+343
-197
lines changed

12 files changed

+343
-197
lines changed

cli/tests/fixtures/trust/cawg_sign_settings.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# c2pa-rs Configuration File
22

33
# Version information.
4-
version_major = 1
5-
version_minor = 0
4+
version = 1
65

76
# Trust settings for certificate validation.
87
# [trust]
@@ -220,13 +219,13 @@ xPd7wFhjRZHfuWb2cs63xjAGjQ==
220219
"""
221220
# String to trust configuration.
222221
trust_config = """
223-
//id-kp-emailProtection
222+
//id-kp-emailProtection
224223
1.3.6.1.5.5.7.3.4
225-
//id-kp-documentSigning
224+
//id-kp-documentSigning
226225
1.3.6.1.5.5.7.3.36
227-
//id-kp-timeStamping
226+
//id-kp-timeStamping
228227
1.3.6.1.5.5.7.3.8
229-
//id-kp-OCSPSigning
228+
//id-kp-OCSPSigning
230229
1.3.6.1.5.5.7.3.9
231230
// MS C2PA Signing
232231
1.3.6.1.4.1.311.76.59.1.9
@@ -418,8 +417,8 @@ name = "c2pa-rs testing"
418417
version = "1.0.0"
419418
# The operating system the claim generator is running on.
420419
#operating_system.name = "macOS"
421-
# Or if the name isn't specified, it can be inferred automatically.
422-
operating_system.infer = true
420+
# Or specify "auto" to infer the operating system automatically.
421+
operating_system = "auto"
423422
# Arbitrary fields can also be defined.
424423
#
425424
# By default, the SDK adds a field "org.cai.c2pa_rs" with the value

cli/tests/fixtures/trust/cawg_test_settings.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ trusted = true
33

44
[trust]
55
trust_config = """
6-
//id-kp-emailProtection
6+
//id-kp-emailProtection
77
1.3.6.1.5.5.7.3.4
8-
//id-kp-documentSigning
8+
//id-kp-documentSigning
99
1.3.6.1.5.5.7.3.36
10-
//id-kp-timeStamping
10+
//id-kp-timeStamping
1111
1.3.6.1.5.5.7.3.8
12-
//id-kp-OCSPSigning
12+
//id-kp-OCSPSigning
1313
1.3.6.1.5.5.7.3.9
1414
// MS C2PA Signing
1515
1.3.6.1.4.1.311.76.59.1.9
16+
// c2pa-kp-claimSigning
17+
1.3.6.1.4.1.62558.2.1
1618
"""
1719
trust_anchors = """
1820
-----BEGIN CERTIFICATE-----
@@ -227,9 +229,9 @@ xPd7wFhjRZHfuWb2cs63xjAGjQ==
227229

228230
[cawg_trust]
229231
trust_config = """
230-
//id-kp-emailProtection
232+
//id-kp-emailProtection
231233
1.3.6.1.5.5.7.3.4
232-
//id-kp-documentSigning
234+
//id-kp-documentSigning
233235
1.3.6.1.5.5.7.3.36
234236
"""
235237
trust_anchors = """

export_schema/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{fs, path::Path};
22

33
use anyhow::Result;
4-
use c2pa::{Builder, ManifestDefinition, Reader};
4+
use c2pa::{settings::Settings, Builder, ManifestDefinition, Reader};
55
use schemars::{schema::RootSchema, schema_for};
66

77
fn write_schema(schema: &RootSchema, name: &str) {
@@ -24,9 +24,8 @@ fn main() -> Result<()> {
2424
let reader = schema_for!(Reader);
2525
write_schema(&reader, "Reader");
2626

27-
// TODO: no longer json, generate toml schema?
28-
// let settings = schema_for!(Settings);
29-
// write_schema(&settings, "Settings");
27+
let settings = schema_for!(Settings);
28+
write_schema(&settings, "Settings");
3029

3130
Ok(())
3231
}

sdk/examples/c2pa.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# c2pa-rs Configuration File
22

33
# Version information.
4-
version_major = 1
5-
version_minor = 0
4+
version = 1
65

76
# # Trust settings for certificate validation.
87
# [trust]
@@ -66,9 +65,8 @@ name = "My Service"
6665
# A human readable string of the product's version.
6766
version = "1.0.0"
6867
# The operating system the claim generator is running on.
69-
operating_system.name = "macOS"
70-
# Or if the name isn't specified, it can be inferred automatically.
71-
operating_system.infer = true
68+
# Or specify "auto" to infer the operating system automatically.
69+
operating_system = "macOS"
7270
# Arbitrary fields can also be defined.
7371
#
7472
# By default, the SDK adds a field "org.cai.c2pa_rs" with the value

0 commit comments

Comments
 (0)