@photivra/engine 2.20.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +295 -1
- package/CITATION.cff +1 -1
- package/README.md +7 -6
- package/SECURITY.md +1 -1
- package/THIRD_PARTY.md +18 -0
- package/dist/capture/c2pa-embed.d.ts +116 -0
- package/dist/capture/c2pa-embed.js +493 -0
- package/dist/capture/c2pa-embed.js.map +1 -0
- package/dist/capture/dng-import.d.ts +73 -8
- package/dist/capture/dng-import.js +315 -80
- package/dist/capture/dng-import.js.map +1 -1
- package/dist/capture/dng-lens-correction-opcodes.d.ts +2 -2
- package/dist/capture/dng-lens-correction-opcodes.js +2 -2
- package/dist/capture/dng-lens-correction-opcodes.js.map +1 -1
- package/dist/capture/dng-opcodes.d.ts +96 -0
- package/dist/capture/dng-opcodes.js +391 -0
- package/dist/capture/dng-opcodes.js.map +1 -0
- package/dist/capture/dng-profile-maps.d.ts +99 -0
- package/dist/capture/dng-profile-maps.js +381 -0
- package/dist/capture/dng-profile-maps.js.map +1 -0
- package/dist/capture/dng-stage-image.d.ts +23 -0
- package/dist/capture/dng-stage-image.js +65 -0
- package/dist/capture/dng-stage-image.js.map +1 -0
- package/dist/capture/exposure-build-up-stage.d.ts +16 -0
- package/dist/capture/exposure-build-up-stage.js +4 -0
- package/dist/capture/exposure-build-up-stage.js.map +1 -0
- package/dist/capture/jpeg-xl-tiles.d.ts +22 -0
- package/dist/capture/jpeg-xl-tiles.js +151 -0
- package/dist/capture/jpeg-xl-tiles.js.map +1 -0
- package/dist/capture/lossy-jpeg.d.ts +17 -0
- package/dist/capture/lossy-jpeg.js +369 -0
- package/dist/capture/lossy-jpeg.js.map +1 -0
- package/dist/capture/native-environment-lean.d.ts +2 -1
- package/dist/capture/native-environment-lean.js +41 -73
- package/dist/capture/native-environment-lean.js.map +1 -1
- package/dist/capture/native-environment-tabulated.js +4 -3
- package/dist/capture/native-environment-tabulated.js.map +1 -1
- package/dist/capture/native-raw-development.d.ts +2 -1
- package/dist/capture/native-raw-development.js.map +1 -1
- package/dist/capture/native-raw.d.ts +3 -2
- package/dist/capture/native-raw.js +5 -4
- package/dist/capture/native-raw.js.map +1 -1
- package/dist/capture/sensor-raw-producer.d.ts +4 -1
- package/dist/capture/sensor-raw-producer.js +12 -3
- package/dist/capture/sensor-raw-producer.js.map +1 -1
- package/dist/color/neighbor-highlight-reconstruction.d.ts +66 -0
- package/dist/color/neighbor-highlight-reconstruction.js +234 -0
- package/dist/color/neighbor-highlight-reconstruction.js.map +1 -0
- package/dist/color/sensor-color-development.d.ts +5 -0
- package/dist/color/sensor-color-development.js +7 -1
- package/dist/color/sensor-color-development.js.map +1 -1
- package/dist/color/spectral-spikiness.d.ts +11 -0
- package/dist/color/spectral-spikiness.js +23 -0
- package/dist/color/spectral-spikiness.js.map +1 -0
- package/dist/core/execution-error.d.ts +21 -0
- package/dist/core/execution-error.js +12 -0
- package/dist/core/execution-error.js.map +1 -0
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/core/version.js.map +1 -1
- package/dist/equipment/generic-lens-catalogue.d.ts +3 -2
- package/dist/equipment/generic-lens-catalogue.js +18 -5
- package/dist/equipment/generic-lens-catalogue.js.map +1 -1
- package/dist/equipment/generic-tier-assets.d.ts +32 -0
- package/dist/equipment/generic-tier-assets.js +16 -11
- package/dist/equipment/generic-tier-assets.js.map +1 -1
- package/dist/equipment/sensor-profile-body.d.ts +78 -0
- package/dist/equipment/sensor-profile-body.js +77 -0
- package/dist/equipment/sensor-profile-body.js.map +1 -0
- package/dist/equipment/sensor-profiles.d.ts +8 -0
- package/dist/equipment/sensor-profiles.js +82 -0
- package/dist/equipment/sensor-profiles.js.map +1 -0
- package/dist/facade/catalogue-lens-signal.d.ts +28 -3
- package/dist/facade/catalogue-lens-signal.js +83 -78
- package/dist/facade/catalogue-lens-signal.js.map +1 -1
- package/dist/facade/chart-radiance-batch.js +2 -1
- package/dist/facade/chart-radiance-batch.js.map +1 -1
- package/dist/facade/defocus-image-space-provider.d.ts +7 -0
- package/dist/facade/defocus-image-space-provider.js +64 -76
- package/dist/facade/defocus-image-space-provider.js.map +1 -1
- package/dist/facade/diffraction-provider.d.ts +1 -1
- package/dist/facade/diffraction-provider.js +4 -4
- package/dist/facade/diffraction-provider.js.map +1 -1
- package/dist/facade/display-view-gpu-session.js +39 -5
- package/dist/facade/display-view-gpu-session.js.map +1 -1
- package/dist/facade/display-view-gpu.d.ts +19 -6
- package/dist/facade/display-view-gpu.js.map +1 -1
- package/dist/facade/display-view-lens-signal.js +25 -23
- package/dist/facade/display-view-lens-signal.js.map +1 -1
- package/dist/facade/display-view-normal.d.ts +15 -0
- package/dist/facade/display-view-normal.js +44 -0
- package/dist/facade/display-view-normal.js.map +1 -0
- package/dist/facade/display-view-rendering.d.ts +97 -0
- package/dist/facade/display-view-rendering.js +598 -0
- package/dist/facade/display-view-rendering.js.map +1 -0
- package/dist/facade/display-view.d.ts +37 -65
- package/dist/facade/display-view.js +152 -499
- package/dist/facade/display-view.js.map +1 -1
- package/dist/facade/expected-signal-setup.d.ts +3 -1
- package/dist/facade/expected-signal-setup.js +3 -3
- package/dist/facade/expected-signal-setup.js.map +1 -1
- package/dist/facade/expected-signal.d.ts +47 -14
- package/dist/facade/expected-signal.js +117 -112
- package/dist/facade/expected-signal.js.map +1 -1
- package/dist/facade/exposure-build-up.d.ts +70 -0
- package/dist/facade/exposure-build-up.js +164 -0
- package/dist/facade/exposure-build-up.js.map +1 -0
- package/dist/facade/fast-methods.d.ts +1 -1
- package/dist/facade/fast-methods.js +46 -9
- package/dist/facade/fast-methods.js.map +1 -1
- package/dist/facade/generic-lens-capture.d.ts +3 -3
- package/dist/facade/generic-lens-capture.js +3 -3
- package/dist/facade/generic-lens-capture.js.map +1 -1
- package/dist/facade/image-plane-enable.d.ts +7 -0
- package/dist/facade/image-plane-enable.js +17 -0
- package/dist/facade/image-plane-enable.js.map +1 -0
- package/dist/facade/image-plane-lattice-data.d.ts +6 -0
- package/dist/facade/image-plane-lattice-data.js +10 -0
- package/dist/facade/image-plane-lattice-data.js.map +1 -0
- package/dist/facade/image-plane-support.d.ts +33 -0
- package/dist/facade/image-plane-support.js +11 -0
- package/dist/facade/image-plane-support.js.map +1 -0
- package/dist/facade/image-plane.d.ts +36 -0
- package/dist/facade/image-plane.js +384 -0
- package/dist/facade/image-plane.js.map +1 -0
- package/dist/facade/mixed-illumination.d.ts +108 -0
- package/dist/facade/mixed-illumination.js +174 -0
- package/dist/facade/mixed-illumination.js.map +1 -0
- package/dist/facade/on-demand-kits.d.ts +14 -0
- package/dist/facade/on-demand-kits.js +36 -0
- package/dist/facade/on-demand-kits.js.map +1 -0
- package/dist/facade/opt-in-kit.d.ts +9 -0
- package/dist/facade/opt-in-kit.js +11 -0
- package/dist/facade/opt-in-kit.js.map +1 -0
- package/dist/facade/quality-kit.d.ts +21 -0
- package/dist/facade/quality-kit.js +23 -0
- package/dist/facade/quality-kit.js.map +1 -0
- package/dist/facade/quality-paths.d.ts +22 -0
- package/dist/facade/quality-paths.js +44 -0
- package/dist/facade/quality-paths.js.map +1 -0
- package/dist/facade/representative-light-sources.d.ts +72 -0
- package/dist/facade/representative-light-sources.js +124 -0
- package/dist/facade/representative-light-sources.js.map +1 -0
- package/dist/facade/scene-radiance.d.ts +145 -4
- package/dist/facade/scene-radiance.js +50 -13
- package/dist/facade/scene-radiance.js.map +1 -1
- package/dist/facade/simulate-capture.d.ts +68 -20
- package/dist/facade/simulate-capture.js +399 -146
- package/dist/facade/simulate-capture.js.map +1 -1
- package/dist/facade/simulate-display-view.d.ts +10 -12
- package/dist/facade/simulate-display-view.js +70 -53
- package/dist/facade/simulate-display-view.js.map +1 -1
- package/dist/gpu/chart-composite-gpu.d.ts +13 -1
- package/dist/gpu/chart-composite-gpu.js +48 -9
- package/dist/gpu/chart-composite-gpu.js.map +1 -1
- package/dist/gpu/chart-radiance-gpu.js +4 -30
- package/dist/gpu/chart-radiance-gpu.js.map +1 -1
- package/dist/gpu/display-view-composite-material-module.d.ts +10 -4
- package/dist/gpu/display-view-composite-material-module.js +39 -13
- package/dist/gpu/display-view-composite-material-module.js.map +1 -1
- package/dist/gpu/display-view-gpu-renderer.d.ts +43 -0
- package/dist/gpu/display-view-gpu-renderer.js +134 -0
- package/dist/gpu/display-view-gpu-renderer.js.map +1 -0
- package/dist/gpu/display-view-image-material-module.d.ts +87 -0
- package/dist/gpu/display-view-image-material-module.js +361 -0
- package/dist/gpu/display-view-image-material-module.js.map +1 -0
- package/dist/gpu/display-view-image-quality.d.ts +87 -0
- package/dist/gpu/display-view-image-quality.js +625 -0
- package/dist/gpu/display-view-image-quality.js.map +1 -0
- package/dist/gpu/display-view-quality-gpu.d.ts +80 -65
- package/dist/gpu/display-view-quality-gpu.js +187 -445
- package/dist/gpu/display-view-quality-gpu.js.map +1 -1
- package/dist/gpu/display-view-speed-gpu.d.ts +67 -19
- package/dist/gpu/display-view-speed-gpu.js +181 -105
- package/dist/gpu/display-view-speed-gpu.js.map +1 -1
- package/dist/gpu/image-kernel-accelerator.js +3 -0
- package/dist/gpu/image-kernel-accelerator.js.map +1 -1
- package/dist/gpu/image-kernel-execution.d.ts +2 -13
- package/dist/gpu/image-kernel-execution.js +2 -10
- package/dist/gpu/image-kernel-execution.js.map +1 -1
- package/dist/gpu/wgsl-display-view-coupled-stub.d.ts +8 -0
- package/dist/gpu/wgsl-display-view-coupled-stub.js +21 -0
- package/dist/gpu/wgsl-display-view-coupled-stub.js.map +1 -0
- package/dist/gpu/wgsl-display-view-coupled.d.ts +88 -0
- package/dist/gpu/wgsl-display-view-coupled.js +353 -0
- package/dist/gpu/wgsl-display-view-coupled.js.map +1 -0
- package/dist/gpu/wgsl-display-view-quality-kernel.d.ts +33 -24
- package/dist/gpu/wgsl-display-view-quality-kernel.js +166 -146
- package/dist/gpu/wgsl-display-view-quality-kernel.js.map +1 -1
- package/dist/gpu/wgsl-display-view-speed-kernel.d.ts +19 -44
- package/dist/gpu/wgsl-display-view-speed-kernel.js +116 -18
- package/dist/gpu/wgsl-display-view-speed-kernel.js.map +1 -1
- package/dist/gpu/wgsl-exact-sum.d.ts +20 -0
- package/dist/gpu/wgsl-exact-sum.js +42 -0
- package/dist/gpu/wgsl-exact-sum.js.map +1 -0
- package/dist/index.d.ts +22 -6
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/motion/subject-motion.d.ts +66 -0
- package/dist/motion/subject-motion.js +52 -0
- package/dist/motion/subject-motion.js.map +1 -0
- package/dist/optics/generic-lens-lateral-color.d.ts +83 -0
- package/dist/optics/generic-lens-lateral-color.js +77 -0
- package/dist/optics/generic-lens-lateral-color.js.map +1 -0
- package/dist/optics/generic-lens-psf.js +54 -46
- package/dist/optics/generic-lens-psf.js.map +1 -1
- package/dist/optics/lens-psf-profile.d.ts +7 -0
- package/dist/optics/lens-psf-profile.js +2 -1
- package/dist/optics/lens-psf-profile.js.map +1 -1
- package/dist/output/camera-channel-response.d.ts +50 -0
- package/dist/output/camera-channel-response.js +69 -0
- package/dist/output/camera-channel-response.js.map +1 -0
- package/dist/output/developed-lens-corrections.d.ts +19 -5
- package/dist/output/developed-lens-corrections.js +28 -9
- package/dist/output/developed-lens-corrections.js.map +1 -1
- package/dist/output/generic-lens-corrections.d.ts +41 -5
- package/dist/output/generic-lens-corrections.js +52 -8
- package/dist/output/generic-lens-corrections.js.map +1 -1
- package/dist/output/native-capture-sdr.js +5 -2
- package/dist/output/native-capture-sdr.js.map +1 -1
- package/dist/output/print-plan.d.ts +41 -5
- package/dist/output/print-plan.js +59 -14
- package/dist/output/print-plan.js.map +1 -1
- package/dist/output/sdr-rendering.d.ts +18 -1
- package/dist/output/sdr-rendering.js +39 -2
- package/dist/output/sdr-rendering.js.map +1 -1
- package/dist/sensor/binomial-sample.d.ts +3 -0
- package/dist/sensor/binomial-sample.js +86 -0
- package/dist/sensor/binomial-sample.js.map +1 -0
- package/dist/sensor/native-sensor-report.d.ts +10 -0
- package/dist/sensor/native-sensor-report.js +16 -0
- package/dist/sensor/native-sensor-report.js.map +1 -0
- package/dist/sensor/sensor-characteristics.d.ts +91 -13
- package/dist/sensor/sensor-characteristics.js +30 -15
- package/dist/sensor/sensor-characteristics.js.map +1 -1
- package/docs/AGENT_GUIDE.md +1 -0
- package/docs/API_REFERENCE.md +214 -4
- package/docs/QUICK_START.md +162 -8
- package/docs/USAGE.md +195 -22
- package/docs/api/capture-c2pa-embed.md +177 -0
- package/docs/api/capture-dng-import.md +86 -10
- package/docs/api/capture-dng-opcodes.md +93 -0
- package/docs/api/capture-dng-profile-maps.md +141 -0
- package/docs/api/capture-dng-stage-image.md +43 -0
- package/docs/api/capture-jpeg-xl-tiles.md +33 -0
- package/docs/api/capture-lossy-jpeg.md +41 -0
- package/docs/api/capture-native-raw-development.md +2 -1
- package/docs/api/core-execution-error.md +43 -0
- package/docs/api/core-version.md +1 -1
- package/docs/api/equipment-generic-lens-catalogue.md +10 -5
- package/docs/api/equipment-sensor-profile-body.md +64 -0
- package/docs/api/equipment-sensor-profiles.md +86 -0
- package/docs/api/exports.json +460 -5
- package/docs/api/facade-display-view-gpu.md +5 -2
- package/docs/api/facade-display-view.md +11 -15
- package/docs/api/facade-exposure-build-up.md +105 -0
- package/docs/api/facade-fast-methods.md +47 -10
- package/docs/api/facade-image-plane-enable.md +16 -0
- package/docs/api/facade-mixed-illumination.md +67 -0
- package/docs/api/facade-quality-paths.md +24 -0
- package/docs/api/facade-representative-light-sources.md +131 -0
- package/docs/api/facade-scene-radiance.md +54 -3
- package/docs/api/facade-simulate-capture.md +48 -11
- package/docs/api/facade-simulate-display-view.md +10 -12
- package/docs/api/gpu-image-kernel-execution.md +0 -36
- package/docs/api/motion-subject-motion.md +23 -0
- package/docs/api/optics-generic-lens-lateral-color.md +79 -0
- package/docs/api/output-camera-channel-response.md +55 -0
- package/docs/api/output-developed-lens-corrections.md +10 -1
- package/docs/api/output-generic-lens-corrections.md +40 -4
- package/docs/api/output-print-plan.md +35 -1
- package/docs/api/output-sdr-rendering.md +6 -1
- package/docs/api/sensor-sensor-characteristics.md +54 -2
- package/llms.txt +3 -0
- package/package.json +6 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c2pa-embed.js","sourceRoot":"","sources":["../../src/capture/c2pa-embed.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,4HAA4H;AAC5H,MAAM,CAAC,MAAM,kCAAkC,GAAG,iEAA0E,CAAC;AAC7H,kGAAkG;AAClG,MAAM,CAAC,MAAM,iCAAiC,GAAG,UAAU,CAAC;AA2D5D,MAAM,IAAI,GAAG,UAAU,EAAE,IAAI,GAAG,UAAU,EAAE,IAAI,GAAG,UAAU,EAAE,IAAI,GAAG,UAAU,EAAE,IAAI,GAAG,UAAU,CAAC;AACpG,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACnH,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACvE,uEAAuE;AACvE,MAAM,UAAU,GAAG,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;AAC5C,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B,SAAS,IAAI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AAC,EAAE,CAAC,EAAE,CAAC;QAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QAAC,EAAE,IAAI,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC;QAAC,IAAI,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IAAC,CAAC;IACpK,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AACpI,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Content Credentials (C2PA) export writers: the engine half of #165. The engine embeds a finished, caller-built C2PA\n * Manifest Store in a JPEG, PNG or DNG export, reports the byte ranges the data hash must exclude, optionally computes that\n * SHA-256, writes the signed store back in place at the same length, and finds an existing store in a file. It never builds\n * JUMBF or COSE, verifies no signature, holds no keys and makes no network calls: the caller brings its own manifest builder,\n * signer and validator.\n *\n * Every rule cited is from the C2PA Technical Specification 2.4 (April 2026):\n *\n * - Manifest Store (§11.1.4.2): a JUMBF superbox labelled `c2pa` with JUMBF type UUID 63327061-0011-0010-8000-00AA00389B71.\n * The engine checks only that outer framing (superbox, description box, UUID, label, child box lengths).\n * - JPEG (§A.3.1): the store is the data of APP11 marker segments (JPEG XT, ISO/IEC 18477-3), split per ISO 19566-5:2023 D.2,\n * written in order and contiguous. Each segment carries CI = \"JP\", En (box instance number) and Z (packet sequence number,\n * from 1); every continuation segment repeats the box's LBox and TBox. The engine writes what the C2PA reference SDK\n * (c2pa-rs, `jpeg_io.rs`) writes, owner decision on #165: 64,000-byte pieces of the store, En = 0x0211, and the segments\n * right after the last APP0 segment, or right after SOI when there is none.\n * - PNG (§A.3.2): the store is the data of one ancillary, private, not-safe-to-copy chunk 'caBX' (PNG 3rd edition §4.7.2), which\n * should precede IDAT. As c2pa-rs (`png_io.rs`) does, the engine puts it right after IHDR.\n * - TIFF and DNG (§A.3.6): the store is the data of tag 52545 (0xCD41), type 7 (UNDEFINED), in the last IFD of the main chain.\n * For a file with one main IFD the entry may sit in that IFD, which is where the engine puts it, in ascending tag order. The\n * store goes at the end of the file, as the section recommends. The TIFF byte order does not apply inside the store.\n * - Data hash `c2pa.hash.data` (§18.5): the hash covers every byte except the exclusions, which are ascending and\n * non-overlapping (§18.5.1). JPEG: one exclusion covering every C2PA APP11 segment, each FFEB marker and length field\n * included (§18.5.3). PNG: one exclusion covering the whole caBX chunk: its Length and type (§18.5.4), its data, and its CRC,\n * which changes with the data (c2pa-rs excludes the same 12 + n bytes). TIFF: the store's bytes and, as §18.5.5 recommends,\n * the 4-byte count field of its IFD entry.\n * - Multiple step processing (§10.4): the caller embeds a placeholder store whose size already allows for the signature, hashes\n * the bound bytes, fills in the data hash and signature, and writes the final store \"without changing the size\". The engine\n * enforces that last step: `setC2paManifestStore` refuses a store of any other length, so no offset in the file ever moves.\n *\n * The digital source type for an image the engine simulates is IPTC `algorithmicMedia` (owner decision on #165, 2026-11-10);\n * `C2PA_ALGORITHMIC_MEDIA_SOURCE_TYPE` holds it for the caller's `c2pa.created` action (§18.15). The engine does not write it.\n * This module is imported by nothing in the capture path, so a bundler leaves it out unless an application uses it.\n * @see docs/CONTENT_CREDENTIALS.md for the workflow, the byte layouts and what is still to be validated externally.\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { requireAllowlistedRecord, requireInputKeys } from \"../core/record-validation.js\";\nimport { pngCrc32 } from \"../output/png-encoder.js\";\n\n/** IPTC digital source type for media created purely by an algorithm (https://cv.iptc.org/newscodes/digitalsourcetype/). */\nexport const C2PA_ALGORITHMIC_MEDIA_SOURCE_TYPE = \"http://cv.iptc.org/newscodes/digitalsourcetype/algorithmicMedia\" as const;\n/** Largest manifest store the engine embeds or reads, bytes (an engine limit, not a C2PA one). */\nexport const C2PA_MANIFEST_STORE_MAXIMUM_BYTES = 33_554_432;\n\n/** A byte range of a file: `start` is a zero-based offset, `length` a byte count. */\nexport interface C2paByteRange { start: number; length: number }\n/**\n * Where the manifest store sits in a file and which bytes the data hash excludes. Plain data: it can be kept, sent to a\n * worker or serialized, and must be passed back unchanged to `setC2paManifestStore`.\n */\nexport interface C2paHardBinding {\n /** `image/jpeg`, `image/png`, or for TIFF files `image/dng` when the main IFD has DNGVersion (50706), otherwise `image/tiff`. */\n mediaType: \"image/jpeg\" | \"image/png\" | \"image/dng\" | \"image/tiff\";\n /** Length of the file with the store embedded, bytes. */\n fileLength: number;\n /** The `exclusions` of the `c2pa.hash.data` assertion, ascending and non-overlapping (§18.5). */\n exclusions: readonly C2paByteRange[];\n /** JPEG: every C2PA APP11 segment, markers and length fields included. PNG: the whole caBX chunk. TIFF/DNG: the store's own bytes. */\n manifestRegion: C2paByteRange;\n /** Length of the JUMBF manifest store itself, bytes. A replacement store must have exactly this length. */\n manifestStoreLength: number;\n}\n/** A file with a manifest store embedded, and its binding. */\nexport interface C2paBoundFile { bytes: Uint8Array; binding: C2paHardBinding }\n/** A manifest store found in a file (`parseC2paManifestStore`): its binding and a copy of the store's JUMBF bytes. */\nexport interface C2paFoundManifestStore { binding: C2paHardBinding; manifestStore: Uint8Array }\n/** Input of `bindC2paManifestStore`. */\nexport interface BindC2paManifestStoreInput {\n /** A JPEG, a PNG, or a TIFF-based file such as a DNG, as written by the engine's exporters. It is read, never changed. */\n file: Uint8Array;\n /**\n * The placeholder store (§10.4): a JUMBF C2PA Manifest Store sized for the final signature. For JPEG it may instead be the\n * same store already split into APP11 segments (what the C2PA reference SDK's placeholder call returns), as long as that\n * split is the one described above.\n */\n manifestStore: Uint8Array;\n}\n/** Input of `setC2paManifestStore`. */\nexport interface SetC2paManifestStoreInput {\n /** The bound file (`C2paBoundFile.bytes`). It is read, never changed. */\n file: Uint8Array;\n /** The binding `bindC2paManifestStore` (or `parseC2paManifestStore`) returned for it. */\n binding: C2paHardBinding;\n /** The final, signed store: exactly `binding.manifestStoreLength` bytes, as JUMBF or (JPEG) in the same APP11 split. */\n manifestStore: Uint8Array;\n}\n/** Input of `parseC2paManifestStore`. */\nexport interface ParseC2paManifestStoreInput {\n /** A JPEG, PNG or TIFF-based file such as a DNG. It is read, never changed. */\n file: Uint8Array;\n}\n/** Input of `calculateC2paDataHash`. */\nexport interface CalculateC2paDataHashInput {\n /** The bound file. */\n file: Uint8Array;\n /** The binding's exclusions (or any ascending, non-overlapping ranges inside the file). */\n exclusions: readonly C2paByteRange[];\n}\n/** SHA-256 over every byte of the file outside the exclusions, in file order (§18.5): the `hash` of `c2pa.hash.data`. */\nexport interface C2paDataHash { alg: \"sha256\"; hash: Uint8Array; hashHex: string; hashedByteCount: number }\n\nconst JUMB = 0x6a756d62, JUMD = 0x6a756d64, CABX = 0x63614258, IHDR = 0x49484452, IEND = 0x49454e44;\nconst C2PA_UUID = [0x63, 0x32, 0x70, 0x61, 0x00, 0x11, 0x00, 0x10, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71];\nconst PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\n/** c2pa-rs `MAX_JPEG_MARKER_SIZE` and its En; see the module notes. */\nconst JPEG_PIECE = 64_000, JPEG_EN = 0x0211;\nconst TIFF_C2PA_TAG = 52545;\n\nfunction fail(message: string): never { throw new InvalidConfigurationError(\"C2PA: \" + message); }\nfunction bytesOf(value: unknown, name: string): Uint8Array {\n if (!(value instanceof Uint8Array)) fail(name + \" must be a Uint8Array.\");\n return value;\n}\nconst u32be = (b: Uint8Array, p: number): number => ((b[p]! << 24) >>> 0) + (b[p + 1]! << 16) + (b[p + 2]! << 8) + b[p + 3]!;\nconst putU32be = (b: Uint8Array, p: number, v: number): void => { b.set([v >>> 24, (v >>> 16) & 255, (v >>> 8) & 255, v & 255], p); };\n/** True when `b` at `p` starts a JUMBF superbox whose description box has the C2PA UUID (§11.1.4.2). */\nconst isC2paSuperbox = (b: Uint8Array, p: number): boolean => p + 24 <= b.length && u32be(b, p + 4) === JUMB && u32be(b, p + 12) === JUMD && C2PA_UUID.every((v, i) => b[p + 16 + i] === v);\n\n/** Checks the outer framing of a C2PA Manifest Store (§11.1.4.2, ISO 19566-5 boxes); the manifests inside are the caller's. */\nfunction checkStore(store: Uint8Array): Uint8Array {\n if (store.length < 8 + 8 + 16 + 1 + 5 || store.length > C2PA_MANIFEST_STORE_MAXIMUM_BYTES) fail(\"manifest store size is outside 38 B to 32 MiB.\");\n if (u32be(store, 0) !== store.length || u32be(store, 4) !== JUMB) fail(\"manifest store must be one JUMBF superbox ('jumb') whose LBox is its whole length.\");\n let at = 8, first = true;\n while (at < store.length) {\n if (at + 8 > store.length) fail(\"manifest store has a truncated child box.\");\n const size = u32be(store, at);\n if (size < 8 || at + size > store.length) fail(\"manifest store has a child box with an unsupported or out-of-range LBox.\");\n if (first) {\n // JUMBF description box: TYPE (16-byte UUID), TOGGLES, then the null-terminated label when toggle bit 0x02 is set.\n if (u32be(store, at + 4) !== JUMD || size < 8 + 16 + 1 + 5) fail(\"manifest store must start with a JUMBF description box ('jumd').\");\n if (C2PA_UUID.some((v, i) => store[at + 8 + i] !== v)) fail(\"manifest store's JUMBF type is not the C2PA UUID 63327061-0011-0010-8000-00AA00389B71.\");\n if ((store[at + 24]! & 0x02) === 0 || [0x63, 0x32, 0x70, 0x61, 0].some((v, i) => store[at + 25 + i] !== v)) fail(\"manifest store's label must be 'c2pa'.\");\n first = false;\n }\n at += size;\n }\n if (first) fail(\"manifest store has no description box.\");\n return store;\n}\n\n/**\n * A store located in a file: its binding, and where its bytes lie, in order (`pieces`; several for a JPEG). For JPEG the\n * continuation headers (`repeats`) repeat the store's first 8 bytes; for PNG `crc` is where the chunk's CRC goes.\n */\ninterface Located { binding: C2paHardBinding; pieces: C2paByteRange[]; repeats: number[]; crc?: number }\nfunction gather(file: Uint8Array, at: Located): Uint8Array {\n const store = new Uint8Array(at.binding.manifestStoreLength);\n at.pieces.reduce((offset, p) => (store.set(file.subarray(p.start, p.start + p.length), offset), offset + p.length), 0);\n return checkStore(store);\n}\nfunction locatedOne(mediaType: C2paHardBinding[\"mediaType\"], file: Uint8Array, region: C2paByteRange, store: C2paByteRange, extra?: Partial<Located>): Located {\n return { binding: { mediaType, fileLength: file.length, exclusions: [region], manifestRegion: region, manifestStoreLength: store.length }, pieces: [store], repeats: [], ...extra };\n}\n\n// ---- JPEG (§A.3.1, §18.5.3) ----\n\n/** The APP11 segments for a store (ISO 19566-5 D.2), split as the reference SDK splits them. */\nfunction jpegSegments(store: Uint8Array): Uint8Array {\n const pieces = Math.ceil(store.length / JPEG_PIECE);\n const out = new Uint8Array(pieces * 12 + (pieces - 1) * 8 + store.length);\n let at = 0;\n for (let i = 0; i < pieces; i++) {\n const piece = store.subarray(i * JPEG_PIECE, Math.min(store.length, (i + 1) * JPEG_PIECE)), lp = 2 + 8 + (i ? 8 : 0) + piece.length;\n out.set([0xff, 0xeb, lp >> 8, lp & 255, 0x4a, 0x50, JPEG_EN >> 8, JPEG_EN & 255], at); putU32be(out, at + 8, i + 1);\n at += 12;\n if (i) { out.set(store.subarray(0, 8), at); at += 8; }\n out.set(piece, at); at += piece.length;\n }\n return out;\n}\n/** A JUMBF APP11 segment (CI 'JP') at `at`: its En, Z and end, or null for any other segment. */\nfunction app11(b: Uint8Array, at: number, end: number): { en: number; z: number } | null {\n return b[at + 1] === 0xeb && end - at >= 12 && b[at + 4] === 0x4a && b[at + 5] === 0x50 ? { en: (b[at + 6]! << 8) | b[at + 7]!, z: u32be(b, at + 8) } : null;\n}\ninterface JpegLayout { app0End: number; located: Located | null }\n/**\n * Walks a JPEG's marker segments up to SOS (ITU-T T.81 B.1.1): where the last APP0 ends, and the C2PA APP11 run if any. A run\n * starts at a JUMBF segment with Z = 1 whose box is the C2PA superbox; its continuations follow at once with the same En and\n * Z + 1 (§A.3.1). Other JUMBF APP11 segments (for example JPEG 360) are left alone.\n */\nfunction jpegLayout(bytes: Uint8Array): JpegLayout {\n let at = 2, app0End = 2, run: { en: number; z: number; start: number; end: number; pieces: C2paByteRange[]; repeats: number[] } | null = null, done = false;\n for (;;) {\n if (at + 4 > bytes.length || bytes[at] !== 0xff) fail(\"JPEG marker structure is malformed before the scan.\");\n const marker = bytes[at + 1]!;\n if (marker === 0xda) break;\n if (marker === 0xd8 || marker === 0xd9 || marker === 0x01 || marker === 0xff || (marker >= 0xd0 && marker <= 0xd7)) fail(\"JPEG has an unexpected marker before the scan.\");\n const end = at + 2 + ((bytes[at + 2]! << 8) | bytes[at + 3]!);\n if (end - at < 4 || end > bytes.length) fail(\"JPEG segment length runs past the file.\");\n if (marker === 0xe0) app0End = end;\n const box = app11(bytes, at, end);\n if (box && run && !done && box.en === run.en && run.end === at) {\n if (box.z !== run.z + 1 || end - at < 20 || bytes.subarray(at + 12, at + 20).some((v, i) => v !== bytes[run!.start + 12 + i])) fail(\"C2PA APP11 continuation is out of sequence or does not repeat LBox and TBox.\");\n run.repeats.push(at + 12); run.pieces.push({ start: at + 20, length: end - at - 20 }); run.z++; run.end = end;\n } else if (box && box.z === 1 && isC2paSuperbox(bytes, at + 12)) {\n if (run) fail(\"JPEG has more than one C2PA manifest store.\");\n run = { en: box.en, z: 1, start: at, end, pieces: [{ start: at + 12, length: end - at - 12 }], repeats: [] };\n } else if (box && run && box.en === run.en) fail(\"C2PA APP11 segments are not contiguous (§A.3.1).\");\n else if (run) done = true;\n at = end;\n }\n if (!run) return { app0End, located: null };\n const region = { start: run.start, length: run.end - run.start }, length = run.pieces.reduce((s, p) => s + p.length, 0);\n return { app0End, located: { binding: { mediaType: \"image/jpeg\", fileLength: bytes.length, exclusions: [region], manifestRegion: region, manifestStoreLength: length },\n pieces: run.pieces, repeats: run.repeats } };\n}\n/** Store bytes as JUMBF, or (`jpeg`) as already-split APP11 segments in the reference split; returns the JUMBF. */\nfunction storeFrom(value: Uint8Array, jpeg: boolean): Uint8Array {\n if (!(jpeg && value[0] === 0xff && value[1] === 0xeb)) return checkStore(value);\n // Read the segments as a JPEG would (behind a stand-in SOI and SOS), then require the reference split exactly.\n const wrapped = new Uint8Array(value.length + 6);\n wrapped.set([0xff, 0xd8]); wrapped.set(value, 2); wrapped.set([0xff, 0xda, 0, 2], value.length + 2);\n const found = jpegLayout(wrapped).located;\n if (!found || found.binding.manifestRegion.length !== value.length) fail(\"APP11 segments are not one contiguous C2PA sequence.\");\n const store = gather(wrapped, found), canonical = jpegSegments(store);\n if (canonical.length !== value.length || canonical.some((v, i) => v !== value[i])) fail(\"APP11 segments are not split as 64,000-byte pieces with En 0x0211.\");\n return store;\n}\n\n// ---- PNG (§A.3.2, §18.5.4) ----\n\n/** Walks a PNG's chunks (PNG 3rd edition §5.3): where IHDR ends, and the caBX chunk if any. */\nfunction pngLayout(bytes: Uint8Array): { ihdrEnd: number; located: Located | null } {\n let at = 8, ihdrEnd = -1, located: Located | null = null;\n for (;;) {\n if (at + 12 > bytes.length) fail(\"PNG ends before IEND.\");\n const length = u32be(bytes, at), type = u32be(bytes, at + 4), end = at + 12 + length;\n if (length > 0x7fffffff || end > bytes.length) fail(\"PNG chunk runs past the file.\");\n if (at === 8 && type !== IHDR) fail(\"PNG must start with IHDR.\");\n if (type === IHDR) ihdrEnd = end;\n if (type === CABX) {\n if (located) fail(\"PNG has more than one caBX chunk.\");\n located = locatedOne(\"image/png\", bytes, { start: at, length: 12 + length }, { start: at + 8, length }, { crc: at + 8 + length });\n }\n at = end;\n if (type === IEND) return { ihdrEnd, located };\n }\n}\nfunction pngChunkCrc(file: Uint8Array, chunk: number, length: number): number { return pngCrc32(file.subarray(chunk + 4, chunk + 8 + length)); }\n\n// ---- TIFF and DNG (§A.3.6, §18.5.5) ----\n\nconst TIFF_TYPE_SIZE = [0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];\n/** Tags whose values are file offsets (StripOffsets, TileOffsets, JPEGInterchangeFormat) or IFD offsets (SubIFDs, Exif, GPS, Interoperability). */\nconst OFFSET_TAGS = new Set([273, 324, 513]), IFD_TAGS = new Set([330, 34665, 34853, 40965]);\n/** Tags that may hold absolute offsets inside opaque data (MakerNote, DNGPrivateData): moving the file under them is unsafe. */\nconst OPAQUE_OFFSET_TAGS = new Set([37500, 50740]);\ninterface TiffReader { le: boolean; u16(p: number): number; u32(p: number): number }\nfunction tiffReader(bytes: Uint8Array): TiffReader {\n const le = bytes[0] === 0x49;\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n const r: TiffReader = {\n le,\n u16: (p) => (p < 0 || p + 2 > bytes.length ? fail(\"TIFF structure runs past the file.\") : view.getUint16(p, le)),\n u32: (p) => (p < 0 || p + 4 > bytes.length ? fail(\"TIFF structure runs past the file.\") : view.getUint32(p, le))\n };\n if (bytes.length < 8 || r.u16(2) !== 42) fail(\"only classic TIFF (not BigTIFF) is supported.\");\n return r;\n}\ninterface TiffIfd { ifd: number; count: number; entries: { tag: number; at: number }[] }\n/** The main IFD chain (TIFF 6.0 §2), at most 64 IFDs. */\nfunction tiffChain(r: TiffReader): TiffIfd[] {\n const chain: TiffIfd[] = [];\n for (let ifd = r.u32(4); ifd !== 0; ifd = r.u32(ifd + 2 + chain[chain.length - 1]!.count * 12)) {\n if (chain.length >= 64 || chain.some((c) => c.ifd === ifd)) fail(\"TIFF IFDs loop or are too many.\");\n const count = r.u16(ifd);\n chain.push({ ifd, count, entries: Array.from({ length: count }, (_, i) => ({ tag: r.u16(ifd + 2 + i * 12), at: ifd + 2 + i * 12 })) });\n }\n if (chain.length === 0) fail(\"TIFF has no IFD.\");\n return chain;\n}\n/** Every 2- or 4-byte field holding a file offset, in the main IFD and every sub-IFD it points to (TIFF 6.0 §2; Exif 2.32 §4.6.3). */\nfunction tiffOffsetFields(bytes: Uint8Array, r: TiffReader, main: number): Map<number, 2 | 4> {\n const fields = new Map<number, 2 | 4>(), seen = new Set<number>();\n const walk = (ifd: number, sub: boolean): void => {\n if (seen.has(ifd) || seen.size >= 64) fail(\"TIFF IFDs loop or are too many.\");\n seen.add(ifd);\n const n = r.u16(ifd);\n for (let i = 0; i < n; i++) {\n const e = ifd + 2 + i * 12, tag = r.u16(e), type = r.u16(e + 2), count = r.u32(e + 4), unit = TIFF_TYPE_SIZE[type];\n if (!unit) fail(\"TIFF entry has an unknown field type.\");\n if (OPAQUE_OFFSET_TAGS.has(tag)) fail(\"TIFF has a MakerNote or DNGPrivateData, whose inner offsets cannot be moved safely.\");\n const size = unit * count;\n const value = size > 4 ? r.u32(e + 8) : e + 8;\n if (value + size > bytes.length) fail(\"TIFF entry data runs past the file.\");\n if (size > 4) fields.set(e + 8, 4);\n if (OFFSET_TAGS.has(tag) || IFD_TAGS.has(tag)) {\n if (!(type === 3 && !IFD_TAGS.has(tag)) && type !== 4 && type !== 13) fail(\"TIFF offset tag has an unexpected type.\");\n for (let k = 0; k < count; k++) {\n fields.set(value + k * unit, unit as 2 | 4);\n if (IFD_TAGS.has(tag)) walk(unit === 4 ? r.u32(value + k * 4) : r.u16(value + k * 2), true);\n }\n }\n }\n const next = ifd + 2 + n * 12;\n if (sub && r.u32(next) !== 0) { fields.set(next, 4); walk(r.u32(next), true); }\n };\n walk(main, false);\n return fields;\n}\n/** The C2PA entry of a TIFF, if any: it must be in the last IFD of the main chain (§A.3.6). */\nfunction tiffLayout(file: Uint8Array): { r: TiffReader; chain: TiffIfd[]; located: Located | null } {\n const r = tiffReader(file), chain = tiffChain(r), dng = chain[0]!.entries.some((e) => e.tag === 50706);\n const holders = chain.filter((c) => c.entries.some((e) => e.tag === TIFF_C2PA_TAG));\n if (holders.length === 0) return { r, chain, located: null };\n const entries = holders.flatMap((c) => c.entries.filter((e) => e.tag === TIFF_C2PA_TAG));\n if (entries.length > 1 || holders[0] !== chain[chain.length - 1]) fail(\"TIFF C2PA entry must be one entry in the last IFD of the main chain (§A.3.6).\");\n const at = entries[0]!.at, length = r.u32(at + 4), start = r.u32(at + 8);\n if (r.u16(at + 2) !== 7 || length <= 4 || start + length > file.length) fail(\"TIFF C2PA entry is not type 7 data inside the file.\");\n // Another writer may put the store before the IFD; the exclusions are listed in ascending order either way (§18.5.1).\n const store = { start, length }, count = { start: at + 4, length: 4 };\n if (start < at + 8 && start + length > at + 4) fail(\"TIFF C2PA store overlaps its IFD entry.\");\n return { r, chain, located: { binding: { mediaType: dng ? \"image/dng\" : \"image/tiff\", fileLength: file.length, exclusions: start < at ? [store, count] : [count, store], manifestRegion: store, manifestStoreLength: length },\n pieces: [store], repeats: [] } };\n}\nfunction bindTiff(file: Uint8Array, store: Uint8Array): C2paBoundFile {\n const { r, chain, located } = tiffLayout(file);\n if (located) fail(\"file already has a C2PA manifest store; this adds the first one only.\");\n if (chain.length !== 1) fail(\"TIFF must have exactly one main IFD (no IFD chain).\");\n const main = chain[0]!;\n if (main.entries.some((e, i) => i > 0 && e.tag <= main.entries[i - 1]!.tag)) fail(\"TIFF main IFD entries are not in ascending tag order.\");\n const fields = tiffOffsetFields(file, r, main.ifd);\n // The new entry goes at its ascending place in the main IFD; every byte from there on moves 12 bytes, and every offset to\n // such a byte moves with it. 12 keeps every 2- and 4-byte alignment, and nothing before the insertion point moves.\n const index = main.entries.findIndex((e) => e.tag > TIFF_C2PA_TAG), insertAt = main.ifd + 2 + (index < 0 ? main.count : index) * 12;\n const storeStart = (file.length + 12 + 3) & ~3;\n if (storeStart + store.length > 0xffffffff) fail(\"TIFF with the store would exceed 4 GiB.\");\n const out = new Uint8Array(storeStart + store.length), view = new DataView(out.buffer), le = r.le;\n out.set(file.subarray(0, insertAt));\n out.set(file.subarray(insertAt), insertAt + 12);\n view.setUint16(main.ifd, main.count + 1, le);\n view.setUint16(insertAt, TIFF_C2PA_TAG, le); view.setUint16(insertAt + 2, 7, le);\n view.setUint32(insertAt + 4, store.length, le); view.setUint32(insertAt + 8, storeStart, le);\n for (const [at, size] of fields) {\n const to = at >= insertAt ? at + 12 : at, value = size === 4 ? r.u32(at) : r.u16(at);\n if (value < insertAt) continue;\n if (size === 2) { if (value + 12 > 65535) fail(\"a SHORT offset would overflow.\"); view.setUint16(to, value + 12, le); } else view.setUint32(to, value + 12, le);\n }\n out.set(store, storeStart);\n return { bytes: out, binding: tiffLayout(out).located!.binding };\n}\n\n// ---- Format dispatch ----\n\ntype Format = \"jpeg\" | \"png\" | \"tiff\";\nfunction formatOf(file: Uint8Array): Format {\n if (file.length >= 4 && file[0] === 0xff && file[1] === 0xd8) return \"jpeg\";\n if (file.length >= 8 && PNG_SIGNATURE.every((v, i) => file[i] === v)) return \"png\";\n if (file.length >= 8 && ((file[0] === 0x49 && file[1] === 0x49) || (file[0] === 0x4d && file[1] === 0x4d))) return \"tiff\";\n return fail(\"file is not a JPEG, PNG or TIFF.\");\n}\nfunction locate(file: Uint8Array, format: Format): Located | null {\n return format === \"jpeg\" ? jpegLayout(file).located : format === \"png\" ? pngLayout(file).located : tiffLayout(file).located;\n}\n/** Inserts `chunk` at `at`. */\nfunction spliced(file: Uint8Array, at: number, chunk: Uint8Array): Uint8Array {\n const out = new Uint8Array(file.length + chunk.length);\n out.set(file.subarray(0, at)); out.set(chunk, at); out.set(file.subarray(at), at + chunk.length);\n return out;\n}\n\n// ---- Public functions ----\n\n/**\n * Embeds a placeholder C2PA Manifest Store in a JPEG, PNG or TIFF/DNG export and returns the new file with its hard binding:\n * the exclusions for `c2pa.hash.data` and where the store sits (C2PA 2.4 §A.3.1, §A.3.2, §A.3.6, §18.5, §10.4; see the module\n * notes). The input file is not changed. Only the first store of a file can be added; a file that already has one is rejected.\n * @param input - The file and the placeholder store.\n * @returns The bound file (a new array) and its binding.\n *\n * @see docs/CONTENT_CREDENTIALS.md for the workflow and the byte layouts.\n */\nexport function bindC2paManifestStore(input: BindC2paManifestStoreInput): C2paBoundFile {\n requireInputKeys(input, \"bindC2paManifestStore\", [\"file\", \"manifestStore\"]);\n const r = input as unknown as Record<string, unknown>;\n const file = bytesOf(r.file, \"file\"), given = bytesOf(r.manifestStore, \"manifestStore\"), format = formatOf(file);\n const store = storeFrom(given, format === \"jpeg\");\n if (format === \"tiff\") return bindTiff(file, store);\n let out: Uint8Array;\n if (format === \"jpeg\") {\n const layout = jpegLayout(file);\n if (layout.located) fail(\"file already has a C2PA manifest store; this adds the first one only.\");\n out = spliced(file, layout.app0End, jpegSegments(store));\n } else {\n const layout = pngLayout(file);\n if (layout.located) fail(\"file already has a C2PA manifest store; this adds the first one only.\");\n const chunk = new Uint8Array(12 + store.length);\n putU32be(chunk, 0, store.length); putU32be(chunk, 4, CABX); chunk.set(store, 8);\n putU32be(chunk, 8 + store.length, pngCrc32(chunk.subarray(4, 8 + store.length)));\n out = spliced(file, layout.ihdrEnd, chunk);\n }\n return { bytes: out, binding: locate(out, format)!.binding };\n}\n\n/**\n * Finds the C2PA Manifest Store embedded in a JPEG (APP11), PNG (caBX) or TIFF/DNG (tag 52545) and returns its location as a\n * binding (the exclusions the engine's own writer uses for that format) and a copy of the store. It checks the file's structure\n * and the store's outer framing only: it does not read the manifests, check the data hash or verify any signature. The\n * manifest's own `c2pa.hash.data` assertion is what a validator uses; this binding is what `setC2paManifestStore` needs.\n * @param input - The file.\n * @returns The store and its binding, or null when the file has none.\n *\n * @see docs/CONTENT_CREDENTIALS.md for the byte layouts.\n */\nexport function parseC2paManifestStore(input: ParseC2paManifestStoreInput): C2paFoundManifestStore | null {\n requireInputKeys(input, \"parseC2paManifestStore\", [\"file\"]);\n const file = bytesOf((input as unknown as Record<string, unknown>).file, \"file\"), found = locate(file, formatOf(file));\n if (!found) return null;\n if (found.binding.manifestStoreLength > C2PA_MANIFEST_STORE_MAXIMUM_BYTES) fail(\"manifest store is larger than 32 MiB.\");\n return { binding: found.binding, manifestStore: gather(file, found) };\n}\n\nfunction parseBinding(value: unknown): C2paHardBinding {\n const b = requireAllowlistedRecord(value, [\"mediaType\", \"fileLength\", \"exclusions\", \"manifestRegion\", \"manifestStoreLength\"], \"C2PA: invalid binding.\");\n const range = (v: unknown): C2paByteRange => {\n const x = requireAllowlistedRecord(v, [\"start\", \"length\"], \"C2PA: invalid byte range.\");\n if (!Number.isSafeInteger(x.start) || !Number.isSafeInteger(x.length) || (x.start as number) < 0 || (x.length as number) < 1) fail(\"byte ranges need integer start ≥ 0 and length ≥ 1.\");\n return { start: x.start as number, length: x.length as number };\n };\n if (![\"image/jpeg\", \"image/png\", \"image/dng\", \"image/tiff\"].includes(b.mediaType as string) || !Number.isSafeInteger(b.fileLength) || !Number.isSafeInteger(b.manifestStoreLength) || !Array.isArray(b.exclusions))\n fail(\"binding needs mediaType, fileLength, exclusions, manifestRegion and manifestStoreLength.\");\n return { mediaType: b.mediaType as C2paHardBinding[\"mediaType\"], fileLength: b.fileLength as number, exclusions: (b.exclusions as unknown[]).map(range),\n manifestRegion: range(b.manifestRegion), manifestStoreLength: b.manifestStoreLength as number };\n}\n\n/**\n * Writes the final, signed manifest store over the placeholder of a bound file (C2PA 2.4 §10.4.4). The store must have\n * exactly the placeholder's length, so the file's length, every offset and every byte outside the exclusions stay the same\n * and the data hash computed before signing still holds. The binding is checked against the file first. The new store goes\n * into the file's existing segments or chunk as they are (for PNG the chunk CRC is recomputed; it is inside the exclusion).\n * @param input - The bound file, its binding and the signed store.\n * @returns A new array: the file with the signed store.\n *\n * @see docs/CONTENT_CREDENTIALS.md for the workflow.\n */\nexport function setC2paManifestStore(input: SetC2paManifestStoreInput): Uint8Array {\n requireInputKeys(input, \"setC2paManifestStore\", [\"file\", \"binding\", \"manifestStore\"]);\n const r = input as unknown as Record<string, unknown>;\n const file = bytesOf(r.file, \"file\"), binding = parseBinding(r.binding), format = formatOf(file);\n const store = storeFrom(bytesOf(r.manifestStore, \"manifestStore\"), format === \"jpeg\");\n const found = locate(file, format);\n if (!found) fail(\"file has no C2PA manifest store to replace.\");\n if (JSON.stringify(found.binding) !== JSON.stringify(binding)) fail(\"binding does not match the file's manifest store.\");\n if (store.length !== binding.manifestStoreLength) fail(\"signed store is \" + store.length + \" B but the placeholder reserved \" + binding.manifestStoreLength + \" B; rebuild with a larger placeholder (§10.4).\");\n gather(file, found);\n const out = file.slice();\n found.pieces.reduce((offset, p) => (out.set(store.subarray(offset, offset + p.length), p.start), offset + p.length), 0);\n for (const at of found.repeats) out.set(store.subarray(0, 8), at);\n if (found.crc !== undefined) putU32be(out, found.crc, pngChunkCrc(out, binding.manifestRegion.start, store.length));\n return out;\n}\n\n/**\n * SHA-256 over every byte of a file outside the given exclusions, in file order: the value of `hash` in a `c2pa.hash.data`\n * assertion with `alg` \"sha256\" (C2PA 2.4 §18.5). It uses Web Crypto (`crypto.subtle`, browsers in secure contexts and\n * Node 22+). The bytes outside the exclusions are copied once into one array before hashing.\n * @param input - The file and its exclusions (ascending, non-overlapping, inside the file).\n * @returns The digest as bytes and hexadecimal, and how many bytes it covers.\n *\n * @see docs/CONTENT_CREDENTIALS.md for the workflow.\n */\nexport async function calculateC2paDataHash(input: CalculateC2paDataHashInput): Promise<C2paDataHash> {\n requireInputKeys(input, \"calculateC2paDataHash\", [\"file\", \"exclusions\"]);\n const r = input as unknown as Record<string, unknown>;\n const file = bytesOf(r.file, \"file\");\n if (!Array.isArray(r.exclusions)) fail(\"exclusions must be an array.\");\n const exclusions = parseBinding({ mediaType: \"image/jpeg\", fileLength: 0, manifestRegion: { start: 0, length: 1 }, manifestStoreLength: 0, exclusions: r.exclusions }).exclusions;\n let end = 0, kept = file.length;\n for (const e of exclusions) {\n if (e.start < end || e.start + e.length > file.length) fail(\"exclusions must be ascending, non-overlapping and inside the file.\");\n end = e.start + e.length; kept -= e.length;\n }\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) fail(\"needs crypto.subtle (a secure browser context or Node 22+).\");\n const data = new Uint8Array(kept);\n let from = 0, at = 0;\n for (const e of [...exclusions, { start: file.length, length: 0 }]) { data.set(file.subarray(from, e.start), at); at += e.start - from; from = e.start + e.length; }\n const hash = new Uint8Array(await subtle.digest(\"SHA-256\", data));\n return { alg: \"sha256\", hash, hashHex: Array.from(hash, (b) => b.toString(16).padStart(2, \"0\")).join(\"\"), hashedByteCount: kept };\n}\n"]}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type DngJpegXlDecoder } from "./jpeg-xl-tiles.js";
|
|
2
|
+
import { type DngOpcode } from "./dng-opcodes.js";
|
|
3
|
+
import { type DngProfileGainTableMap, type DngRgbTables } from "./dng-profile-maps.js";
|
|
4
|
+
/** 1.1.0 (2.22.0): lossy JPEG and JPEG XL raw data, opcode lists, profile maps, semantic masks, `scale`, `assumptions`. */
|
|
5
|
+
export declare const DNG_IMPORT_SCHEMA_VERSION: "1.1.0";
|
|
6
|
+
/**
|
|
7
|
+
* Upper bound for `maximumPixels`: 200 MP (megapixels) of 16-bit codes is 400 MB. `maximumBytes` bounds the estimated peak memory
|
|
8
|
+
* of the import (default 1 GiB, at most 4 GiB).
|
|
9
|
+
*/
|
|
3
10
|
export declare const DNG_IMPORT_LIMITS: Readonly<{
|
|
4
11
|
defaultMaximumPixels: 64000000;
|
|
5
12
|
maximumPixels: 200000000;
|
|
6
13
|
defaultMaximumIfds: 64;
|
|
7
14
|
maximumIfds: 1024;
|
|
15
|
+
defaultMaximumBytes: 1073741824;
|
|
16
|
+
maximumBytes: 4294967296;
|
|
8
17
|
}>;
|
|
9
18
|
export interface DngImportInput {
|
|
10
19
|
bytes: Uint8Array;
|
|
@@ -12,6 +21,32 @@ export interface DngImportInput {
|
|
|
12
21
|
maximumPixels?: number;
|
|
13
22
|
/** Total IFDs (main chain plus SubIFDs) visited. Default 64, at most 1024. */
|
|
14
23
|
maximumIfds?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Estimated peak memory of the import, bytes (the codes, the largest strip or tile's decode buffers and its decoder's working
|
|
26
|
+
* memory; see docs/IMPORT_AND_PNG.md, "Memory"), checked before any image allocation. Default 1 073 741 824 (1 GiB), at most 4 GiB.
|
|
27
|
+
*/
|
|
28
|
+
maximumBytes?: number;
|
|
29
|
+
/**
|
|
30
|
+
* "half": a half-size preview of a LinearRaw image, each output pixel the rounded mean of a 2 × 2 block of stored codes, decoded
|
|
31
|
+
* strip by strip (a quarter of the codes' memory). Areas, crops and black-level deltas are halved; CFA images are refused.
|
|
32
|
+
* Default "full".
|
|
33
|
+
*/
|
|
34
|
+
size?: "full" | "half";
|
|
35
|
+
}
|
|
36
|
+
/** {@link importDngRawImage}'s input: {@link DngImportInput} plus the JPEG XL decoder a 52546 file needs. */
|
|
37
|
+
export interface DngImportAsyncInput extends DngImportInput {
|
|
38
|
+
/** Decodes one JPEG XL strip or tile to PNG (`createJxlOxideDngDecoder`). Needed only for JPEG XL raw data or masks. */
|
|
39
|
+
jpegXlDecoder?: DngJpegXlDecoder;
|
|
40
|
+
}
|
|
41
|
+
/** A decoded semantic mask (DNG 1.6 SemanticName, NewSubFileType 0x10004, PhotometricInterpretation 52527). */
|
|
42
|
+
export interface ImportedDngSemanticMask {
|
|
43
|
+
name: string;
|
|
44
|
+
/** SemanticInstanceID, or null. */
|
|
45
|
+
instanceId: string | null;
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
/** Mask values 0..1 (code / (2^bits − 1)), row-major. */
|
|
49
|
+
data: Float32Array;
|
|
15
50
|
}
|
|
16
51
|
/** Repeating CFA pattern. Its origin is the top-left corner of `activeArea` (DNG 1.7.1.0, PhotometricInterpretation). */
|
|
17
52
|
export interface ImportedDngCfa {
|
|
@@ -54,7 +89,14 @@ export interface ImportedDngRaw {
|
|
|
54
89
|
height: number;
|
|
55
90
|
samplesPerPixel: number;
|
|
56
91
|
bitsPerSample: number;
|
|
57
|
-
compression: "uncompressed" | "lossless-jpeg";
|
|
92
|
+
compression: "uncompressed" | "lossless-jpeg" | "lossy-jpeg" | "jpeg-xl";
|
|
93
|
+
/**
|
|
94
|
+
* True when the raw data went through a lossy coder: lossy JPEG always; JPEG XL when JXLDistance (52553) is above 0 or absent
|
|
95
|
+
* (the file then does not say it is lossless).
|
|
96
|
+
*/
|
|
97
|
+
lossySource: boolean;
|
|
98
|
+
/** 1, or 0.5 for a `size: "half"` preview (every geometry field is already halved). */
|
|
99
|
+
scale: 1 | 0.5;
|
|
58
100
|
photometricInterpretation: "cfa" | "linear-raw";
|
|
59
101
|
/** Stored raw codes, row-major then sample, length width x height x samplesPerPixel. */
|
|
60
102
|
codes: Uint16Array;
|
|
@@ -78,14 +120,37 @@ export interface ImportedDngRaw {
|
|
|
78
120
|
asShotNeutral: number[] | null;
|
|
79
121
|
/** RawDataUniqueID as 32 lowercase hex digits, or null. */
|
|
80
122
|
rawDataUniqueId: string | null;
|
|
123
|
+
/** ForwardMatrix1/2 (white-balanced camera → XYZ D50), row-major 3 x colorPlanes, or null. */
|
|
124
|
+
forwardMatrix1: number[] | null;
|
|
125
|
+
forwardMatrix2: number[] | null;
|
|
126
|
+
/** BaselineExposure plus BaselineExposureOffset (stops), or null when neither is present. */
|
|
127
|
+
baselineExposure: number | null;
|
|
128
|
+
/** OpcodeList1/2/3 (raw IFD), parsed but not applied (`developDngStageImage` applies them), or null when absent. */
|
|
129
|
+
opcodeList1: DngOpcode[] | null;
|
|
130
|
+
opcodeList2: DngOpcode[] | null;
|
|
131
|
+
opcodeList3: DngOpcode[] | null;
|
|
132
|
+
/** ProfileGainTableMap2 (IFD 0), else ProfileGainTableMap (raw IFD), or null; applied by `applyDngProfileGainTableMap`. */
|
|
133
|
+
profileGainTableMap: DngProfileGainTableMap | null;
|
|
134
|
+
/** RGBTables (IFD 0), or null; applied by `applyDngRgbTables`. */
|
|
135
|
+
rgbTables: DngRgbTables | null;
|
|
136
|
+
/** Decoded semantic masks, for `applyDngRgbTables`. */
|
|
137
|
+
semanticMasks: ImportedDngSemanticMask[];
|
|
138
|
+
/** What the import did not do: tags present but not returned or applied, masks not decoded, lossy sources, inferred layouts. */
|
|
139
|
+
assumptions: string[];
|
|
81
140
|
}
|
|
82
141
|
/**
|
|
83
|
-
* Parse one DNG or TIFF-EP file and decode its primary CFA or LinearRaw image (the first IFD with
|
|
84
|
-
*
|
|
142
|
+
* Parse one DNG or TIFF-EP file and decode its primary CFA or LinearRaw image (the first IFD with NewSubFileType 0 and
|
|
143
|
+
* PhotometricInterpretation 32803 or 34892, in IFD-chain then SubIFD order), synchronously.
|
|
85
144
|
*
|
|
86
|
-
* Supported raw data: Compression 1 at 8..16 bits/sample (8 bits as bytes, 16 bits in the file byte
|
|
87
|
-
*
|
|
88
|
-
*
|
|
145
|
+
* Supported raw data: Compression 1 at 8..16 bits/sample (8 bits as bytes, 16 bits in the file byte order, other depths packed
|
|
146
|
+
* MSB-first with byte-aligned rows, per DNG BitsPerSample), Compression 7 lossless Huffman JPEG (T.81 Annex H) and Compression 34892
|
|
147
|
+
* 8-bit lossy JPEG (T.81 sequential DCT), in strips or tiles, chunky planar configuration only. JPEG XL (52546) needs
|
|
148
|
+
* {@link importDngRawImage}; a JPEG XL semantic mask is skipped here and named in `assumptions`.
|
|
89
149
|
* @returns Owned typed arrays and plain metadata; nothing is applied to the codes.
|
|
90
150
|
*/
|
|
91
151
|
export declare function parseDngRawImage(input: DngImportInput): ImportedDngRaw;
|
|
152
|
+
/**
|
|
153
|
+
* {@link parseDngRawImage} for every supported compression, JPEG XL included: each JPEG XL strip or tile goes to `jpegXlDecoder` in
|
|
154
|
+
* turn (one at a time, so only one tile's decoder memory is held), and its PNG is read at the DNG's bit depth (jpeg-xl-tiles.ts).
|
|
155
|
+
*/
|
|
156
|
+
export declare function importDngRawImage(input: DngImportAsyncInput): Promise<ImportedDngRaw>;
|