JavaScript library
Sept 2025: The new JavaScript library, c2pa-js has been released. You're encouraged to move to the new library as soon as possible.
The legacy JavaScript library has been moved to the c2pa-js-legacy repository.
You can continue to install and use the old library, but it will no longer be updated or supported. The Legacy JavaScript library documentation is also still available for reference.
[!NOTE] Looking for the old
c2pa-jsrepo? It's available here asc2pa-js-legacy. Those packages are now deprecated and implementors wishing to interact with C2PA metadata on the web should use the libraries in this repo instead.
A collection of libraries and tools that enable interaction with C2PA metadata in JavaScript. Part of the Content Authenticity Initiative.
Using This Monorepo
This monorepo is managed by NX and pnpm.
Prerequisites
The following must be installed before working with this monorepo:
Node.js
Node.js v22 or later is required (earlier versions may fail with build errors related to unknown file extensions).
If you use nvm, you can install the required version with:
nvm install <version>
nvm install 22.22.0
pnpm and NX
Install pnpm and NX.
npm install -g pnpm
npm install -g nx
Rust Toolchain (for building c2pa-wasm)
If you plan to build from source (rather than only consuming published packages), the Rust toolchain and additional prerequisites are required. See c2pa-wasm's prerequisites for full details.
Recommended Setup Order
- Install Node.js, pnpm, and NX (see above).
- Install the Rust toolchain and
c2pa-wasmprerequisites (seepackages/c2pa-wasm/README.md). - Run
pnpm installfrom the repo root to install the project's dependencies.
Running Commands with Nx
Commands are run in the following format: nx [target] [project], e.g.:
nx build c2pa-web # This will build c2pa-web and all of its dependencies
nx test c2pa-web # This will build and run the tests defined in the c2pa-web package
nx run lint # This will run the linter (eslint) on the entire repo.
Committing Changes for Release
If your changes should be part of a release, you will need to create and commit a changeset.
To create a new changeset, from the root repo directory, run:
pnpm changeset
Follow the prompts to bump the version numbers of affected packages as appropriate. This will generate a new changeset markdown file in the .changeset directory, which should then be committed as part of your PR.
Once the PR is merge into main, the changeset bot will create a release PR, which will then be reviewed, merged, and result in a new release being published.
Packages
Please see the individual package directories for more detailed information.
packages/
Published libraries intended for production use.
c2pa-web
The SDK for interacting with C2PA metadata on the web.
c2pa-wasm
The WebAssembly wrapper for c2pa-rs that powers c2pa-web, built with wasm-bindgen. While these bindings can be used directly, most users will prefer the convenience of c2pa-web.
c2pa-types
Exports TypeScript types autogenerated from c2pa-rs structs, used by c2pa-web.
tools/
Other tools that provide utilities for local development.
testbed
A minimal website that can be used to view c2pa-web output and as a sandbox for local development.
nx-wasm-bindgen
A custom NX executor that contains the logic for building c2pa-wasm using wasm-bindgen.
License
This project is licensed under the terms of the MIT license.