Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Claim v2 #707

Merged
merged 75 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
b5391ce
Initial Claim_v2 work
mauricefisher64 Aug 26, 2024
13889dd
Merge branch 'main' of https://github.com/contentauth/c2pa-rs into cl…
mauricefisher64 Oct 3, 2024
ab3ae3a
Support data hash
mauricefisher64 Oct 21, 2024
6028853
More features
mauricefisher64 Nov 4, 2024
bfdadc1
sigTst2 fixes
mauricefisher64 Nov 11, 2024
c8108ca
Support for Ingredient.V3 assertions
mauricefisher64 Nov 13, 2024
e7e1c34
Merge branch 'main' of https://github.com/contentauth/c2pa-rs into cl…
mauricefisher64 Nov 13, 2024
15f9aed
Support for Ingredient.V3
mauricefisher64 Nov 19, 2024
9d3198a
Merge branch 'main' of https://github.com/contentauth/c2pa-rs into cl…
mauricefisher64 Nov 20, 2024
dcc97ec
Merge branch 'main' of https://github.com/contentauth/c2pa-rs into cl…
mauricefisher64 Nov 20, 2024
b91cacc
More checks
mauricefisher64 Nov 21, 2024
469702f
Merge branch 'main' of https://github.com/contentauth/c2pa-rs into cl…
mauricefisher64 Nov 21, 2024
cfdda74
signature box support
mauricefisher64 Nov 22, 2024
168512e
Fix error checking
mauricefisher64 Nov 27, 2024
7adf3e1
check fix
mauricefisher64 Dec 3, 2024
c42275c
Missing file
mauricefisher64 Dec 4, 2024
fa6725d
Merge branch 'main' of https://github.com/contentauth/c2pa-rs into cl…
mauricefisher64 Dec 4, 2024
7d964b2
Build fix
mauricefisher64 Dec 4, 2024
ef5e75d
Merge branch 'main' into claim_v2
scouten-adobe Dec 5, 2024
82ff07f
Merge commit 'f110ea8d0fb02720d36593ed483a4fddb5c4aedb' into claim_v2…
scouten-adobe Dec 7, 2024
d5df782
Merge commit '2a6575668fb535d7a3d70fc2a03050333e025aac' into claim_v2…
scouten-adobe Dec 11, 2024
3b2f611
Merge commit '11e2c0daa1ece49f278ac6284f03e36906e731ad' into claim_v2…
scouten-adobe Dec 12, 2024
7518649
Merge commit '4c7e4e8717bfc251d24d1f0aa87799d2b52c97fe' into claim_v2…
scouten-adobe Dec 18, 2024
1ccac24
Merge commit 'dbf64a6311e811baa12f4c2667771515b7c0661f' into claim_v2…
scouten-adobe Dec 20, 2024
d8ce409
Merge commit '5b13bb271f1c052dadf2168e9f88df8e6441492f' into claim_v2…
scouten-adobe Dec 20, 2024
d7e2978
Merge commit '690ed5cf7265d1734d889e63474788c39e799ca5' into claim_v2…
scouten-adobe Dec 24, 2024
cac55ab
Merge branch 'main' into claim_v2+c2pa_crypto
scouten-adobe Jan 2, 2025
d42f488
Merge branch 'main' into claim_v2+c2pa_crypto
scouten-adobe Jan 3, 2025
01058f2
Add version check for ingredient add
mauricefisher64 Jan 7, 2025
ea9a3e8
Merge branch 'claim_v2' into claim_v2+c2pa_crypto
gpeacock Jan 7, 2025
b0eec4a
feat: Support v2 claims in 24 API
gpeacock Jan 8, 2025
bd49c28
chore: some cleanup
gpeacock Jan 8, 2025
a6745a9
feat: Support v2 claims
gpeacock Jan 14, 2025
ae6d2ce
chore: revert test case
gpeacock Jan 14, 2025
f86a101
Merge branch 'claim_v2' into claim_v2+c2pa_crypto
gpeacock Jan 14, 2025
adda4c0
chore: Code cleanup
gpeacock Jan 14, 2025
f562600
Merge branch 'claim_v2' into claim_v2+c2pa_crypto
gpeacock Jan 14, 2025
eef13c5
fix: c2patool upgrades to API change in Ingredient.title()
gpeacock Jan 14, 2025
a022505
chore: PR comment cleanup
gpeacock Jan 14, 2025
9d3400a
chore: clippy fixes
gpeacock Jan 14, 2025
35f69f7
feat: Add ingredient_url tracking for status.
gpeacock Jan 15, 2025
b8c9166
feat: Add ingredient tracking for status
gpeacock Jan 15, 2025
b13d25b
fix: Bring `claim_v2` branch up to date with `main` branch (#809)
scouten-adobe Jan 15, 2025
c892fa2
feat: add validation_results to Reader debug output
gpeacock Jan 16, 2025
0a1092f
feat: add validation_results to Reader debug output
gpeacock Jan 16, 2025
f4083c5
fix: c2patool sidecar not written
gpeacock Jan 17, 2025
a2baf69
fix: c2patool sidecar not written
gpeacock Jan 17, 2025
c8df14e
feat: 24 API enabled and v1_api disabled by default
gpeacock Jan 17, 2025
89a7549
feat: 24 API enabled and v1_api disabled by default
gpeacock Jan 17, 2025
d433621
fix(c2patool) assortment of bug fixes
gpeacock Jan 22, 2025
50b0a4d
Merge branch 'claim_v2' of https://github.com/contentauth/c2pa-rs int…
gpeacock Jan 22, 2025
6a86dbd
fix(c2patool): do not write instanceId named generated thumbnail file
gpeacock Jan 22, 2025
5ceccb9
feat: Remove the unstable_api feature (always available now)
gpeacock Jan 22, 2025
046b198
feat: rename ValidationResults to not use Map
gpeacock Jan 22, 2025
b09a3c3
feat: Adds Reader. validation_results() method
gpeacock Jan 23, 2025
bd04fb1
Merge branch 'main' into claim_v2
gpeacock Jan 23, 2025
51613fd
chore: clippy is_some_and fix
gpeacock Jan 23, 2025
5d658b8
Minor proofreading
scouten-adobe Jan 24, 2025
9c0aefb
Remove function `ts_token_from_time_stamp_response`. No longer used a…
scouten-adobe Jan 24, 2025
324319b
Fix Markdown syntax
scouten-adobe Jan 24, 2025
d6adbac
Proofreading
scouten-adobe Jan 24, 2025
c19e230
Proofreading
scouten-adobe Jan 24, 2025
9e584c5
chore: Release notes and review fixes
gpeacock Jan 24, 2025
a3d4f16
Merge branch 'claim_v2' of https://github.com/contentauth/c2pa-rs int…
gpeacock Jan 24, 2025
be0fd0e
chore: More review cleanup
gpeacock Jan 24, 2025
e3ee2b7
Merge branch 'main' into claim_v2
gpeacock Jan 25, 2025
242d096
Proofreading
scouten-adobe Jan 25, 2025
a455b2e
Proofreading
scouten-adobe Jan 25, 2025
4126d94
Proofreading
scouten-adobe Jan 25, 2025
fa9e6cb
chore: more code review fixes
gpeacock Jan 25, 2025
7755368
Merge branch 'claim_v2' of https://github.com/contentauth/c2pa-rs int…
gpeacock Jan 25, 2025
7f78e33
feat: handle validation results and status together
gpeacock Jan 27, 2025
cd7a1a4
chore: review feedback
gpeacock Jan 27, 2025
dc98bbb
chore: yet more review feedback
gpeacock Jan 27, 2025
bd68b82
Merge branch 'main' into claim_v2
gpeacock Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cawg_identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
async-trait = "0.1.78"
base64 = "0.22.1"
c2pa = { path = "../sdk", version = "0.42.0", features = ["openssl", "unstable_api"] }
c2pa = { path = "../sdk", version = "0.42.0", features = ["openssl"] }
gpeacock marked this conversation as resolved.
Show resolved Hide resolved
c2pa-crypto = { path = "../internal/crypto", version = "0.4.0" }
chrono = { version = "0.4.38", features = ["serde"] }
ciborium = "0.2.2"
Expand Down
3 changes: 1 addition & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ c2pa = { path = "../sdk", version = "0.42.0", features = [
"fetch_remote_manifests",
"file_io",
"add_thumbnails",
"pdf",
"unstable_api",
"pdf"
] }
c2pa-crypto = { path = "../internal/crypto", version = "0.4.0" }
clap = { version = "4.5.10", features = ["derive", "env"] }
Expand Down
9 changes: 5 additions & 4 deletions cli/sample/test.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"alg": "ps256",
"private_key": "ps256.pem",
"sign_cert": "ps256.pub",
"claim_version": 1,
"ta_url": "http://timestamp.digicert.com",
"claim_generator": "TestApp",
"claim_generator_info":[{
"name": "TestApp",
"version": "1.0.0"
}],
"title": "My Title",
"assertions": [
{
Expand Down
5 changes: 3 additions & 2 deletions cli/src/callback_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ impl CallbackSignerConfig {
pub fn new(sign_config: &SignConfig, reserve_size: usize) -> anyhow::Result<Self> {
let alg = sign_config
.alg
.clone()
.and_then(|alg| alg.parse::<SigningAlg>().ok())
.as_deref()
.map_or_else(|| "es256".to_string(), |alg| alg.to_lowercase())
.parse::<SigningAlg>()
.context("Invalid signing algorithm provided")?;

let sign_cert_path = sign_config
Expand Down
2 changes: 1 addition & 1 deletion cli/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn info(path: &Path) -> Result<()> {
}
}
let ingredient = c2pa::Ingredient::from_file_with_options(path, &Options {})?;
println!("Information for {}", ingredient.title());
println!("Information for {}", ingredient.title().unwrap_or_default());
let mut is_cloud_manifest = false;
//println!("instanceID = {}", ingredient.instance_id());
if let Some(provenance) = ingredient.provenance() {
Expand Down
30 changes: 19 additions & 11 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/// in that file. If a manifest definition JSON file is specified,
/// the claim will be added to any existing claims.
use std::{
fs::{create_dir_all, remove_dir_all, File},
fs::{create_dir_all, remove_dir_all, remove_file, File},
io::Write,
path::{Path, PathBuf},
str::FromStr,
Expand Down Expand Up @@ -469,7 +469,7 @@
// match args.output {
// Some(output) => {
// if output.exists() && !args.force {
// bail!("Output already exists, use -f/force to force write");
// bail!("Output already exists; use -f/force to force write");
// }
// if path != &output {
// std::fs::copy(path, &output)?;
Expand Down Expand Up @@ -517,7 +517,7 @@
} else {
manifest.claim_generator_info.insert(1, tool_generator);
}
println!("claim generator {:?}", manifest.claim_generator_info);

// set manifest base path before ingredients so ingredients can override it
if let Some(base) = base_path.as_ref() {
builder.base_path = Some(base.clone());
Expand Down Expand Up @@ -596,8 +596,12 @@
if ext_normal(&output) != ext_normal(&args.path) {
bail!("Output type must match source type");
}
if output.exists() && !args.force {
bail!("Output already exists, use -f/force to force write");
if output.exists() {
if args.force {
remove_file(&output)?;

Check warning on line 601 in cli/src/main.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/main.rs#L599-L601

Added lines #L599 - L601 were not covered by tests
} else {
bail!("Output already exists; use -f/force to force write");

Check warning on line 603 in cli/src/main.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/main.rs#L603

Added line #L603 was not covered by tests
}
}

if output.file_name().is_none() {
Expand All @@ -607,11 +611,16 @@
bail!("Missing extension output");
}

#[allow(deprecated)] // todo: remove when we can
builder
let manifest_data = builder

Check warning on line 614 in cli/src/main.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/main.rs#L614

Added line #L614 was not covered by tests
.sign_file(signer.as_ref(), &args.path, &output)
.context("embedding manifest")?;

if args.sidecar {
let sidecar = output.with_extension("c2pa");
let mut file = File::create(&sidecar)?;
file.write_all(&manifest_data)?;
}

Check warning on line 622 in cli/src/main.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/main.rs#L618-L622

Added lines #L618 - L622 were not covered by tests

// generate a report on the output file
let reader = Reader::from_file(&output).map_err(special_errs)?;
if args.detailed {
Expand All @@ -633,7 +642,7 @@
if args.force {
remove_dir_all(&output)?;
} else {
bail!("Output already exists, use -f/force to force write");
bail!("Output already exists; use -f/force to force write");

Check warning on line 645 in cli/src/main.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/main.rs#L645

Added line #L645 was not covered by tests
}
}
create_dir_all(&output)?;
Expand Down Expand Up @@ -708,8 +717,8 @@
#[test]
fn test_manifest_config() {
const SOURCE_PATH: &str = "tests/fixtures/earth_apollo17.jpg";
const OUTPUT_PATH: &str = "target/tmp/unit_out.jpg";
create_dir_all("target/tmp").expect("create_dir");
const OUTPUT_PATH: &str = "../target/tmp/unit_out.jpg";
create_dir_all("../target/tmp").expect("create_dir");
std::fs::remove_file(OUTPUT_PATH).ok(); // remove output file if it exists
let mut builder = Builder::from_json(CONFIG).expect("from_json");

Expand All @@ -719,7 +728,6 @@
.signer()
.expect("get_signer");

#[allow(deprecated)] // todo: remove when we can
let _result = builder
.sign_file(signer.as_ref(), SOURCE_PATH, OUTPUT_PATH)
.expect("embed");
Expand Down
10 changes: 5 additions & 5 deletions cli/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@
}

for ingredient in manifest.ingredients().iter() {
let title = ingredient.title().unwrap_or("Untitled");

Check warning on line 33 in cli/src/tree.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/tree.rs#L33

Added line #L33 was not covered by tests
tmathern marked this conversation as resolved.
Show resolved Hide resolved
if let Some(label) = ingredient.active_manifest() {
// create new node
let data = if name_only {
format!("{}_{}", ingredient.title(), label)
format!("{}_{}", title, label)

Check warning on line 37 in cli/src/tree.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/tree.rs#L37

Added line #L37 was not covered by tests
} else {
format!("Asset:{}, Manifest:{}", ingredient.title(), label)
format!("Asset:{}, Manifest:{}", title, label)

Check warning on line 39 in cli/src/tree.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/tree.rs#L39

Added line #L39 was not covered by tests
};

let new_token = current_token.append(tree, data);

populate_node(tree, reader, label, &new_token, name_only)?;
} else {
let asset_name = ingredient.title();
let data = if name_only {
asset_name.to_string()
title.to_string()

Check warning on line 47 in cli/src/tree.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/tree.rs#L47

Added line #L47 was not covered by tests
} else {
format!("Asset:{asset_name}")
format!("Asset:{title}")

Check warning on line 49 in cli/src/tree.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/tree.rs#L49

Added line #L49 was not covered by tests
tmathern marked this conversation as resolved.
Show resolved Hide resolved
};
current_token.append(tree, data);
}
Expand Down
Loading
Loading