-
Notifications
You must be signed in to change notification settings - Fork 99
feat: Enables generating created assertions and getting the created state #1432
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
base: main
Are you sure you want to change the base?
Conversation
Replace AssertionDefinition with ManifestAssertion.
Adds created to ManifestAssertion Adds AssertionKind kind() and content_type() to AssertionBase with defaults. Adds AssertionBinary Trait (not used yet)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1432 +/- ##
==========================================
+ Coverage 78.37% 78.43% +0.06%
==========================================
Files 162 162
Lines 39567 39615 +48
==========================================
+ Hits 31010 31073 +63
+ Misses 8557 8542 -15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CodSpeed Performance ReportMerging #1432 will degrade performances by 11.9%Comparing Summary
Benchmarks breakdown
Footnotes
|
add_action will now insert created and opened at the top of the actions (fixes a duplicate action bug) Updates v2api example to add an opened action
the add_assertion method will now determine when salting and created/vs gathered are needed. A list of created assertion names can be provided in settings, and you can still call add_created_assertion when needed. All assertions are considered gathered by default except for hard bindings. All redactable assertions are salted. Adding a custom salt is now private to Claim but can be made public if needed (it was never used) add_assertion_with_salt and add_gathered_assertion_with salt have been removed.
sdk/src/assertion.rs
Outdated
} | ||
|
||
/// Returns the content type for this assertion based on its kind | ||
fn content_type(&self) -> &str { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this used for?
/// Note, this does not check for duplicates since it does not return errors. | ||
pub fn add_action(mut self, action: Action) -> Self { | ||
self.actions.push(action); | ||
if action.action() == c2pa_action::OPENED || action.action() == c2pa_action::CREATED { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to check that there is only one as well?
renamed settings.builder.created_assertions to created_assertion_labels salt all assertions removes unused AssertionBinary code.
changed v2api.rs to api.rs removed unused experimental assertion static apis
The 2.2 spec includes replaces the assertions array with two separate assertions arrays, one for gathered_assertions and another for created_assertions. The idea is that signer is responsible for the created assertions and others are considered gathered.
In order to keep the api as consistent as possible, we only have one assertions array, but individual assertions can be set to a created state. If the created flag is not set, the assertion is considered gathered.
The API defaults all v2 claim assertions as gathered except for hard bindings which are generated by the API.
Hard bindings are only reported in the detailed report where you will see them in a created_assertions, vs gathered_assertions array.
When passing in an assertion via JSON you can add a created: = true field to specify that an individual assertion should be considered created. The ManifestAssertion in the Reader will also show the created state.