Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c0c0c9c
feat: Add metadata struct and validation for allowed fields
alextrnnn Jul 22, 2025
4214e07
fix: validation now follow specs
alextrnnn Jul 23, 2025
f45cb28
format: fix formatting
alextrnnn Jul 23, 2025
9a6908f
fix: Add support for custom metadata assertions and change validation…
alextrnnn Jul 24, 2025
68fbf29
fix: Fix label being lost in to/from assertion conversion (json still…
alextrnnn Jul 25, 2025
e9e9ff2
fix: Resort to copying logic from_json_assertion and adding extra logic
alextrnnn Jul 25, 2025
f1b48c9
fix: Revert changes to from_json_assertion
alextrnnn Jul 25, 2025
448ea1d
fix: Add some integration tests and change logic to retrieve duplicat…
alextrnnn Jul 25, 2025
e2404fd
test: Add more tests and remove debug artifacts
alextrnnn Jul 27, 2025
10ef3d9
docs: Add docs to methods
alextrnnn Jul 27, 2025
d305c1e
Merge branch 'main' into alextrnnn/metadata-assertion
alextrnnn Jul 28, 2025
71912de
fix: Validate empty context and change logging
alextrnnn Jul 28, 2025
3c62b23
Merge branch 'main' into alextrnnn/metadata-assertion
alextrnnn Jul 31, 2025
9657943
refactor: Rename Meta to Metadata
alextrnnn Jul 31, 2025
c83632c
fix: Add special case for metadata
alextrnnn Jul 31, 2025
f81df38
chore: Fix clippy
alextrnnn Jul 31, 2025
b80ebfb
refactor: Use std Lazy Lock instead of macro, move it to labels
alextrnnn Jul 31, 2025
c29bac1
Merge branch 'main' into alextrnnn/metadata-assertion
alextrnnn Aug 5, 2025
37d105f
fix: Update old metadata integration test, input label before json_ld
alextrnnn Aug 5, 2025
08d6678
docs: Add docs and fix mentions of URLs to be URIs
alextrnnn Aug 6, 2025
e175638
Merge branch 'main' into alextrnnn/metadata-assertion
alextrnnn Aug 6, 2025
de467cb
format: Fix format error
alextrnnn Aug 6, 2025
f9114ba
Merge branch 'main' into alextrnnn/metadata-assertion
gpeacock Aug 11, 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
20 changes: 19 additions & 1 deletion sdk/src/assertions/labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//! These constants do not include version suffixes.
//!
//! See <https://c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_c2pa_standard_assertions>.
use std::sync::LazyLock;

use regex::Regex;

/// Label prefix for a claim assertion.
///
Expand Down Expand Up @@ -184,9 +187,24 @@ pub(crate) const DATABOX_STORE: &str = "c2pa.databoxes";

/// Label prefix for asset reference assertion.
///
/// See <https://spec.c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_asset_reference>
/// See <https://spec.c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_asset_reference>.
pub const ASSET_REFERENCE: &str = "c2pa.asset-ref";

/// Label prefix for a metadata assertion.
///
/// See <https://spec.c2pa.org/specifications/specifications/2.2/specs/C2PA_Specification.html#_metadata>.
pub const METADATA: &str = "c2pa.metadata";

/// Must have a label that ends in '.metadata' and is preceded by an entity-specific namespace.
/// For example, a 'com.litware.metadata' assertion would be valid.
pub static METADATA_LABEL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
#[allow(clippy::unwrap_used)]
{
Regex::new(r"^(?:[a-zA-Z0-9][a-zA-Z0-9_-]*)(?:\.(?:[a-zA-Z0-9][a-zA-Z0-9_-]*))*\.metadata$")
.unwrap()
}
});

/// Return the version suffix from an assertion label if it exists.
///
/// When an assertion's schema is changed in a backwards-compatible manner,
Expand Down
Loading