Repository navigation
feat!: adopt c2pa-swift 0.1.0 and c2pa-android 0.1.2 - #8
Merged
Merged
Conversation
Both SDKs (c2pa-rs 0.92) dropped global settings and now scope all
configuration to a context that can also carry a signer, progress,
cancellation and an HTTP resolver. The plugin is rebuilt around that
model.
Upstream features:
- C2paContext.create(settings, signer, onProgress, httpResolver) and
cancel(), with native and Dart HTTP resolvers.
- ManifestBuilder signs with the context signer and adds signFile,
setBasePath, ingredient archives and the data-hash/BMFF embeddable
flow, plus C2pa.composeManifest.
- The reader adds crJSON, sidecar and remote manifests, fragment reading
(Android) and SDK-provided MIME types.
- CawgIdentitySigner.
- iOS createCSR, importKey and enrollHardwareKey.
- readIngredientFromFile, ReaderOptions.dataDir and the hashed-signing
calls are removed with the SDKs.
Dart API:
- Every failure is a sealed C2paException. Reading an asset without a
manifest throws C2paManifestNotFoundException.
- Builder calls run in call order even when not awaited; the setters
and every dispose() return futures. Finalizers release handles that
are garbage collected undisposed.
- ValidationStatus gains trusted from validation_state.
- setValue takes JSON values and enrollHardwareKey returns a typed
result.
- Stricter analyzer settings.
Native:
- A Pigeon 30.0.2 definition (pigeons/c2pa_api.dart) generates typed
Dart, Kotlin and Swift bindings; CI checks that they are current.
- Each plugin runs SDK calls on one serial worker, so callbacks never
block the UI and dispose never frees a builder under a running call.
- Fixes:
- addIngredientFromFile now works.
- Android truncates destinations and keeps action parameter types.
- iOS applies Android's default created_assertion_labels.
- createKey honours its algorithm.
- iOS exports SubjectPublicKeyInfo public keys, tags keychain keys the
way c2pa-swift reads them, and deletes keychain keys.
- claimGenerator reads v2 claims.
Toolchain: Dart 3.13 / Flutter 3.47 (CI pins 3.47.9), Xcode 26.4+ for
c2pa-swift's Swift tools 6.3, Android compileSdk 36.
Tests:
- 307 unit tests, including a fake-host test of the Pigeon layer.
- Every integration test file now runs in CI on an iOS simulator and an
Android emulator.
- A new parity suite ports the upstream SDK scenarios: all signing
algorithms, real callback signatures, BMFF, embeddable error paths,
cancellation, HTTP resolver failures, key management and concurrency.
redaranj
force-pushed
the
feat/sync-with-c2pa-swift-android-0-1-x-apis
branch
from
November 30, 2026 10:32
b55826f to
e9c0f90
Compare
2 tasks done
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.
Stacked on #6.
This brings c2pa-flutter up to date with c2pa-swift 0.1.0 (c2pa-rs 0.92.0) and c2pa-android 0.1.2 (c2pa-rs 0.92.2), the latest release of each. It also moves the Dart/native boundary to Pigeon, adds typed errors, and runs the whole integration suite on both platforms in CI. It replaces #7, whose fixes it includes.
Upstream changes and how the plugin follows them
Both SDKs dropped global settings: all configuration now lives on a context, which can also carry a signer, a progress callback, cancellation and an HTTP resolver. The plugin is rebuilt around that model.
C2paContext.create(settings:, signer:, onProgress:, httpResolver:)andcancel().NativeHttpResolveruses URLSession / OkHttp;CallbackHttpResolveranswers the SDK's requests from Dart.C2pa.loadSettingskeeps working by applying its settings to readers and builders created without a context.sign()without a signer uses the context signer. Also new:signFile()(streams files natively),setBasePath(), ingredient archives, the embeddable flow (placeholder,setDataHashExclusions,updateHashFromBytes/File,signEmbeddable,hashType, BMFFsetFixedSizeMerkle/hashMdatBytes) andC2pa.composeManifest().readFileWithManifest/readBytesWithManifest,readFragment(Android), an optional context, and MIME type lists from the SDKs.CawgIdentitySignerwraps a claim signer and an X.509 identity signer.createCSR,importKeyandenrollHardwareKeynow work. The IPTC source types c2pa-swift does not model are recorded instead of falling back todigitalCapture.readIngredientFromFile,ReaderOptions.dataDir, and the hashed-signing trio.Where the SDKs differ, the Dart API exposes the union and fails with
NOT_IMPLEMENTED_<PLATFORM>; the README has the table.Dart API
C2paException: manifest not found, cancelled, SDK error, invalid argument, unsupported, key error or platform error. Reading an asset without a manifest throwsC2paManifestNotFoundException, as both SDKs do, and the read methods return non-nullable types.setIntent,setNoEmbed,setRemoteUrl,addActionand everydispose()return futures, and finalizers release handles that are garbage collected undisposed.ValidationStatusgainstrustedfrom the SDK'svalidation_state.setValuetakes JSON values,enrollHardwareKeyreturns a typed result, andIngredientInfo.activeManifestlinks ingredients to their manifests.unawaited_futures,discarded_futuresandavoid_dynamic_calls.Native side
pigeons/c2pa_api.dartdefines the interface, and Pigeon 30.0.2 generates typed Dart, Kotlin and Swift bindings. CI fails if the generated files drift from the definition.addIngredientFromFileused the wrong argument key and never worked.detailed.created_assertion_labelsas Android, so the same manifest records the same assertions as created on both platforms.createKeyhonours its algorithm.exportPublicKeyreturns a SubjectPublicKeyInfo, keychain keys are tagged the way c2pa-swift looks them up, anddeleteKeyactually deletes keychain keys.claimGeneratorreads v2 claims.Toolchain
macos-26.Tests
test/c2pa_pigeon_test.dartdrivesPigeonC2pathrough a fake host API, covering:example/integration_test/now runs in CI on an iOS simulator and an Android emulator. The newsdk_parity_test.dartports scenarios from the upstream SDK suites:For reviewers
This is a breaking release (0.1.0). The CHANGELOG lists every change, including the
C2paPlatformchanges that matter only to code calling the platform interface directly.