Note
The old c2pa-js repository is now in c2pa-js-legacy and is deprecated. If you need to work with C2PA metadata in the browser, use the libraries in this repository instead.
JavaScript libraries and tools for working with C2PA metadata. This repository is part of the Content Authenticity Initiative.
This monorepo uses Nx and pnpm.
Install the following before you work in this repository.
Node.js v22 or later is required. Older versions may fail to build because of unrecognized file extensions.
If you use nvm, install a supported v22 release (for example, nvm install 22 or nvm install 22.22.0).
Install pnpm and the Nx CLI globally:
npm install -g pnpm
npm install -g nxTo build from source instead of using published packages only, you need the Rust toolchain and other prerequisites. See Prerequisites in packages/c2pa-wasm/README.md.
- Install Node.js,
pnpm, and the Nx CLI (see the previous sections). - Install the Rust toolchain and
c2pa-wasmprerequisites (packages/c2pa-wasm/README.md). - From the repository root, run
pnpm installto install dependencies.
Run tasks as nx <target> <project>. For example:
nx build c2pa-web # Builds c2pa-web and its dependencies
nx test c2pa-web # Builds and runs tests for c2pa-web
nx lint c2pa-web # Runs ESLint on c2pa-web
nx lint c2pa-web --fix # Runs ESLint and applies fixesInclude a changeset when your change should ship in a release.
From the repository root:
pnpm changesetFollow the prompts to bump affected packages. The command adds a Markdown file under .changeset/; commit that file with your pull request.
After the pull request merges to main, the changeset bot opens a release pull request. When that pull request merges, a new release is published.
See each package directory for full details.
The /packages directory contains libraries published for production use.
SDK for C2PA metadata in the browser. Source: packages/c2pa-web.
WebAssembly bindings for c2pa-rs, built with wasm-bindgen. They power c2pa-web; most applications should use c2pa-web instead of calling the bindings directly. Source: packages/c2pa-wasm.
TypeScript types generated from c2pa-rs structs for use by c2pa-web. Source: packages/c2pa-types.
The /tools directory contains utilities for local development.
Minimal site for inspecting c2pa-web output and experimenting locally. Source: tools/testbed.
Custom Nx executor that builds c2pa-wasm with wasm-bindgen. Source: tools/nx-wasm-bindgen.
This project is licensed under the MIT license.