Repository navigation
Conversation
Remove approved deprecated embeddable and global-settings APIs. Preserve default constructors through Context initialization and adapt stream wrappers to opaque native handles. Migrate callers, ownership cleanup, tests, and compatibility documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add move-only ByteBuffer and buffer-returning siblings for every signing overload, placeholders, and embeddable manifests. Keep vector APIs compatible through owning conversions. Retain capturing signer callbacks across moves and Context ownership transfers, document stream and HTTP borrows, and validate pointer identity, lifetime, cleanup, and signing round trips. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.
Summary
Add zero-copy byte-buffer consumption and in-place signing callbacks, alongside the compatibility changes required for the current Rust C API.
Existing vector-returning methods retain their names and signatures. Deprecated API removals and the opaque-stream migration are documented breaking changes.
Changes
Native byte buffers without a C++ copy
ByteBufferwith read-only access, iterators, byte views, and explicitto_vector()conversion.sign_to_buffersiblings for all five signing overloads.placeholder_to_bufferandsign_embeddable_to_buffer.c2pa_free.Capturing, in-place signing callbacks
SignerIntoFunc, receiving borrowed input and mutable signature-buffer views.release().ReleasedBuilderwithsigner_callback_owner; custom providers must retain it until all native objects using the signer are freed.The existing vector-based
SignerFuncconstructor remains available.Rust C API compatibility
Remove the following deprecated APIs whose underlying C functions were removed:
Builder::data_hashed_placeholderBuilder::sign_data_hashed_embeddableBuilder::format_embeddablec2pa::load_settingsMigrate callers and tests to context-scoped settings/signers and the modern placeholder, hashing, signing, and composition APIs.
Preserve default Builder and Reader constructor signatures by initializing through default Contexts. Adapt stream wrappers to hold opaque
C2paStreamhandles rather than inheriting from the C struct.Ownership documentation and regression coverage
Compatibility and migration
c_streammember when passing stream wrappers to C APIs.ContextBuilder::release()must preserve both callback owners.Dependency and release status
Validation uses local c2pa-rs and cimpl source checkouts containing the allocation-handoff changes.
C2PA_VERSIONremains0.91.6. The default prebuilt configuration is not the validated integration target for this branch. Before release integration:C2PA_VERSIONand run the hosted build/sanitizer matrix.No publication or hosted CI dispatch is included.
Validation
Configured a local Debug source build with ASan and UBSan:
cmake -S . -B build/zero-copy -DCMAKE_BUILD_TYPE=Debug -DC2PA_BUILD_FROM_SOURCE=ON -DC2PA_RS_PATH=/Users/gsharma/source/c2pa/c2pa-rs -DENABLE_SANITIZERS=ONcmake --build build/zero-copy --target c2pa_c_tests ctest -j 4— passed.build/zero-copy/tests/c2pa_c_tests --gtest_filter='ByteBuffer.*:ZeroCopyBuilder.*:SignerInto.*:ZeroCopyStreams.*'— passed, all 13 new regression tests.build/zero-copy/tests/c2pa_c_tests— passed, all 383 tests.build/zero-copy/tests/ctest— passed, all 17 C smoke checks.git diff --check— passed.Both C and C++ tests compile with
-Wall -Wextra -Werror. No ASan/UBSan errors were reported. LeakSanitizer is unavailable on this macOS configuration.The local Apple linker rejected the stripped Rust dylib with a LINKEDIT alignment error. Validation used the same Rust sources rebuilt with
CARGO_PROFILE_RELEASE_STRIP=none; no repository linker or release-profile changes were made.Independent signing calls generate fresh labels and salts. Tests verify exact allocation identity and byte conversion at the shared adapter, compare decoded assertions across independent signing calls, and validate signed assets through Reader as
ValidorTrusted.