Feat: Add embeddable and fragmented signing#98
Open
redaranj wants to merge 4 commits into
Open
Conversation
Complete the lower-level, two-pass signing surface on Builder: - Embeddable / data-hash (GP-255): signEmbeddable, formatEmbeddable, placeholder, needsPlaceholder, setDataHashExclusions for caller-managed embedding. - Fragmented BMFF Merkle hashing (GP-256): setFixedSizeMerkle, hashMdatBytes, updateHashFromStream, hashType, plus a HashType enum (DATA_HASH/BMFF_HASH). Wraps the corresponding c2pa_builder_* FFI through the JNI bridge, with shared + Android instrumented tests.
Exercise the previously-uncovered signing methods so they are not reported at 0% coverage, and fix the placeholder embeddable test: - Sign Embeddable (data hash): direct-mode updateHashFromStream + signEmbeddable on a JPEG, using a context-configured signer. - BMFF Merkle Hashing: placeholder + setFixedSizeMerkle + hashMdatBytes + updateHashFromStream + signEmbeddable on a fragmented MP4. - Embeddable and Placeholder: rewritten to the canonical placeholder workflow. placeholder() reserves space sized to the signature, so it requires a signer on the context; the original built the placeholder on a signer-less Builder.fromJson and threw on device. Now uses a context-backed signer, embeds after the SOI marker, registers the exclusion, hashes, and signs. All mirror the c2pa-rs c-ffi / data_hash embeddable workflows. Adds the video1.mp4 test fixture (from the upstream c2pa-rs fixtures) for the BMFF path.
The jacocoInstrumentedTestReport task pointed classDirectories at intermediates/javac/debug and tmp/kotlin-classes/debug, both empty under AGP's built-in Kotlin compilation, so the report rendered "No class files specified" despite execution data being present. Add the intermediates/built_in_kotlinc/debug/compileDebugKotlin/classes path alongside the existing ones (non-existent dirs are ignored, so it stays robust across AGP layouts). GP-314.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
============================================
- Coverage 72.04% 71.66% -0.38%
+ Complexity 267 38 -229
============================================
Files 59 60 +1
Lines 2214 2255 +41
Branches 243 260 +17
============================================
+ Hits 1595 1616 +21
- Misses 482 491 +9
- Partials 137 148 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add deterministic error-path coverage for the signing methods' failure branches (the uncovered 'if (result < 0) throw' lines that dominated the patch). On a signer-less Builder.fromJson with no placeholder, placeholder/signEmbeddable have no context signer and setFixedSizeMerkle/setDataHashExclusions have no DataHash assertion, so each must throw C2PAError; the test asserts that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes in this pull request
Adds two-pass embeddable signing (to sign large assets in place without a rewrite) and fragmented BMFF Merkle hashing for videos and streamed media
Types of changes
Checklist
TO DOitems (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment