Repository navigation
Conversation
c2pa-node 0.11 removed SettingsContext and the synchronous Builder.withJson. Port signC2PA to Context and Builder.withJsonAsync. The 0.10 settings object used camelCase keys that c2pa-rs ignored, so production always signed with c2pa-rs defaults; pin verifyAfterSign true to keep that behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Upgrades
@contentauth/c2pa-nodefrom 0.10.0 to 0.12.3 and portsserver/src/services/c2pa.tsto its API. Every AI-generated portrait and illustration AAO signs keeps the same content credentials. This also unblocks the grouped dependabot PR #9403, which bumps c2pa-node to 0.11 and fails to compile:SettingsContextis no longer exported, andBuilder.withJsonis gone.Once this lands, dependabot rebases #9403 without its c2pa change.
API mapping
type SettingsContext(raw settings object)new Context(settings)Builder.withJson(json, settings)(sync)await Builder.withJsonAsync(json, context)Reader.fromAsset(asset, settings?)Reader.fromAsset(asset, context?). Our callers pass no second argument, so nothing changes.LocalSigner.newSigner(...),setIntent,addAssertion,builder.signsignC2PAis nowasync. All four callers await it inside their existingtryblocks:portrait-generator.ts,illustration-generator.ts,scripts/generate-images.tsandscripts/backfill-c2pa-static.ts. The unit test now uses.rejects.toThrow.Settings: this keeps what production actually ran
Up to 0.10, the old
BUILDER_SETTINGSobject (verify.verifyAfterSign: false,trust.verifyTrustList: false) was passed to c2pa-rs untouched, with camelCase keys. c2pa-rs reads only snake_case keys and ignores unknown ones, so neither setting ever took effect. A deliberately invalid value underverify_after_signfails to parse; the same value underverifyAfterSignsigns without complaint. Production therefore signed with c2pa-rs defaults, includingverify_after_sign = true. A self-signed cert doesn't make that check fail: the sign succeeds and reportssigningCredential.untrusted.0.12.3's
Contextdoes convert and apply settings. A literal port,verifyAfterSign: false, would have turned off a post-sign check that has always run. So this PR pins the effective behaviour:verify.verifyAfterSign: true. Unchanged from what production ran.trust.verifyTrustList: false. It has no c2pa-rs counterpart;Contexttreats it as "add no trust anchors". We configure none, so it contributes nothing, as before.The code comment records this history.
Signed output, old vs new
Same inputs and the same self-signed cert:
Valid; the same status codes (signingCredential.untrustedonly); title,instance_id,claim_generator_infoname and version, both assertions' data, Es256, issuer, and thetrainedAlgorithmicMediasource type.org.contentauth.c2pa_rsclaim-generator entry goes from 0.91.10 to 0.92.4.c2pa.actions.v2and the thumbnail move from gathered to created assertions (created = actions, thumbnail, hash.data; gathered = the AAO generation assertion), so AAO now attests to the AI-generation action. No repo code depends on assertion placement.C2PA_TSA_URL. TheLocalSignerAPI that takes the TSA URL is unchanged.Install and runtime
@contentauth/c2pa-node(0.10.0 → 0.12.3),c2pa-types(0.7.8 → 0.8.0) andc2pa-utilities(0.4.0 → 0.5.3).dist/index.nodethat needs glibc 2.34 or newer; the image's Debian bookworm has 2.36. The Dockerfile'snpm ci --ignore-scriptsships that bundled binary, the same as with 0.10.0. Thepostinstallscript is unchanged, and theallowScriptspin is left alone.Tests
tsc --project server/tsconfig.json: clean.c2pa.test.ts,portrait-c2pa-wiring.test.tsandillustration-c2pa-wiring.test.ts: 23/23 pass on 0.12.3, including real signing through the native module.No changeset: this is a server dependency, not a protocol package.
🤖 Generated with Claude Code