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

DO NOT MERGE: Hack the CAWG SDK to create error test case files #950

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6a4a7cc
Add StatusTracker to the IdentityAssertion entry points
scouten-adobe Feb 25, 2025
ef95c5f
Signal invalid CBOR through new status tracking path
scouten-adobe Feb 27, 2025
674bbd6
Merge branch 'main' into cawg-validate+status-tracker
scouten-adobe Feb 27, 2025
1592e18
Add links from tests to spec
scouten-adobe Feb 27, 2025
ced18a0
cargo fmt
scouten-adobe Feb 27, 2025
3e4164c
Move fixtures into validation_method folder for consistency
scouten-adobe Feb 27, 2025
aa51d6f
Use doc comments to cite the section of spec we're testing
scouten-adobe Feb 27, 2025
481223c
Ensure we don't balk at extra fields in identity assertion CBOR
scouten-adobe Feb 27, 2025
14f21aa
WIP / STASH test framework for extra assertion
scouten-adobe Feb 27, 2025
da65cc2
Add test case for referenced_assertion not found in C2PA claim V1's a…
scouten-adobe Feb 27, 2025
4a2cb04
Merge branch 'main' into cawg-validate+status-tracker
scouten-adobe Feb 27, 2025
1378f7b
Merge branch 'main' into cawg-validate+status-tracker
scouten-adobe Feb 28, 2025
9b8baf8
Code for duplicate assertion case
scouten-adobe Feb 28, 2025
63cacdb
Placeholder for test case for referenced_assertion not found in C2PA …
scouten-adobe Feb 28, 2025
e9538e8
No hard binding
scouten-adobe Feb 28, 2025
433a41d
Properly handle duplicate assertion reference
scouten-adobe Feb 28, 2025
5dcfaa5
Properly handle missing reference to hard binding assertion
scouten-adobe Feb 28, 2025
ebc65ad
Invalid sig_type
scouten-adobe Feb 28, 2025
cc137a6
Back out hack for no hard binding assertion
scouten-adobe Feb 28, 2025
64a8afa
Invalid sig type asset
scouten-adobe Feb 28, 2025
6cdc7c9
Properly handle unknown signature type
scouten-adobe Mar 1, 2025
a6565b7
Merge branch 'main' into hack-cawg-sdk-for-error-test-cases
scouten-adobe Mar 1, 2025
5448d55
Merge branch 'cawg-validate+status-tracker' into hack-cawg-sdk-for-er…
scouten-adobe Mar 1, 2025
a26e200
Reverse out a couple of cases
scouten-adobe Mar 1, 2025
4019779
Place an invalid value in pad1
scouten-adobe Mar 1, 2025
1feff22
Place an invalid value in pad2
scouten-adobe Mar 4, 2025
b806ae0
Merge branch 'main' into hack-cawg-sdk-for-error-test-cases
scouten-adobe Mar 12, 2025
351a2ff
Fix merge conflict
scouten-adobe Mar 12, 2025
a8c170d
Generate example from CAWG spec
scouten-adobe Mar 12, 2025
122ec50
Merge branch 'main' into hack-cawg-sdk-for-error-test-cases
scouten-adobe Mar 17, 2025
5731ce2
Back out X.509-based tests
scouten-adobe Mar 17, 2025
c426832
Merge branch 'main' into hack-cawg-sdk-for-error-test-cases
scouten-adobe Mar 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
5 changes: 4 additions & 1 deletion cawg_identity/src/claim_aggregation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
//! [§8.1, Identity claims aggregation]: https://creator-assertions.github.io/identity/1.1-draft/#_identity_claims_aggregation

mod ica_credential;
pub use ica_credential::{IcaCredential, IcaCredentialSummary, IdentityProvider, VerifiedIdentity};
pub use ica_credential::{
IcaCredential, IcaCredentialSummary, IdentityClaimsAggregationVc, IdentityProvider,
VerifiedIdentity,
};

mod ica_signature_verifier;
pub use ica_signature_verifier::IcaSignatureVerifier;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Copyright 2025 Adobe. All rights reserved.
// This file is licensed to you under the Apache License,
// Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
// or the MIT license (http://opensource.org/licenses/MIT),
// at your option.

// Unless required by applicable law or agreed to in writing,
// this software is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or
// implied. See the LICENSE-MIT and LICENSE-APACHE files for the
// specific language governing permissions and limitations under
// each license.

//! Example that builds an example credential matching the one in [§8.1.3,
//! "Identity claims aggregation verifiable credential example,”] of the CAWG
//! identity spec.
//!
//! [§8.1.3, "Identity claims aggregation verifiable credential example,”]: https://cawg.io/identity/1.1-draft+ica-validation/#_identity_claims_aggregation_verifiable_credential_example

use std::str::FromStr;

use chrono::{DateTime, FixedOffset};
use iref::UriBuf;
use non_empty_string::NonEmptyString;
use nonempty_collections::nev;

use crate::{
claim_aggregation::{IdentityClaimsAggregationVc, IdentityProvider, VerifiedIdentity},
SignerPayload,
};

pub(crate) fn ica_example() -> IdentityClaimsAggregationVc {
IdentityClaimsAggregationVc {
c2pa_asset: SignerPayload {
referenced_assertions: vec![],
sig_type: "unknown".to_string(),
},
verified_identities: nev![
VerifiedIdentity {
name: Some(NonEmptyString::new("First-Name Last-Name".to_string()).unwrap()),
type_: NonEmptyString::new("cawg.document_verification".to_string()).unwrap(),
provider: IdentityProvider {
id: UriBuf::from_str("https://example-id-verifier.com").unwrap(),
name: NonEmptyString::new("Example ID Verifier".to_string()).unwrap(),
},
address: None,
uri: None,
username: None,
verified_at: "2024-07-26T22:30:15Z"
.parse::<DateTime<FixedOffset>>()
.unwrap(),
},
VerifiedIdentity {
name: None,
type_: NonEmptyString::new("cawg.affiliation".to_string()).unwrap(),
provider: IdentityProvider {
id: UriBuf::from_str("https://example-affiliated-organization.com").unwrap(),
name: NonEmptyString::new("Example Affiliated Organization".to_string())
.unwrap(),
},
address: None,
uri: None,
username: None,
verified_at: "2024-07-26T22:29:57Z"
.parse::<DateTime<FixedOffset>>()
.unwrap(),
},
VerifiedIdentity {
type_: NonEmptyString::new("cawg.social_media".to_string()).unwrap(),
name: Some(NonEmptyString::new("Silly Cats 929".to_string()).unwrap()),
username: Some(NonEmptyString::new("username".to_string()).unwrap()),
uri: Some(UriBuf::from_str("https://example-social-network.com/username").unwrap()),
provider: IdentityProvider {
id: UriBuf::from_str("https://example-social-network.com").unwrap(),
name: NonEmptyString::new("Example Social Network".to_string()).unwrap(),
},
address: None,
verified_at: "2024-05-27T08:40:39.569856Z"
.parse::<DateTime<FixedOffset>>()
.unwrap(),
},
VerifiedIdentity {
type_: NonEmptyString::new("cawg.crypto_wallet".to_string()).unwrap(),
name: None,
username: Some(NonEmptyString::new("username".to_string()).unwrap()),
uri: Some(UriBuf::from_str("https://example-crypto-wallet.com/username").unwrap()),
provider: IdentityProvider {
id: UriBuf::from_str("https://example-crypto-wallet.com").unwrap(),
name: NonEmptyString::new("Example Crypto Wallet".to_string()).unwrap(),
},
address: None,
verified_at: "2024-05-27T08:40:39.569856Z"
.parse::<DateTime<FixedOffset>>()
.unwrap(),
}
],
}
}
14 changes: 14 additions & 0 deletions cawg_identity/src/tests/fixtures/claim_aggregation/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2025 Adobe. All rights reserved.
// This file is licensed to you under the Apache License,
// Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
// or the MIT license (http://opensource.org/licenses/MIT),
// at your option.

// Unless required by applicable law or agreed to in writing,
// this software is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or
// implied. See the LICENSE-MIT and LICENSE-APACHE files for the
// specific language governing permissions and limitations under
// each license.

pub(crate) mod ica_credential_example;
2 changes: 2 additions & 0 deletions cawg_identity/src/tests/fixtures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#![allow(unused)]

pub(crate) mod claim_aggregation;

mod default_built_in_signature_verifier;
pub(crate) use default_built_in_signature_verifier::default_built_in_signature_verifier;

Expand Down
Loading