Skip to content

contentauth/c2pa-js

Repository files navigation

c2pa-js

Note

Looking for the old c2pa-js repo? It's available here as c2pa-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

  1. Install Node.js, pnpm, and NX (see above).
  2. Install the Rust toolchain and c2pa-wasm prerequisites (see packages/c2pa-wasm/README.md).
  3. Run pnpm install from 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 lint c2pa-web # This will run ESLint on the c2pa-web package
nx lint c2pa-web --fix # This will run ESLint on the c2pa-web package and fix any errors

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.

The SDK for interacting with C2PA metadata on the web.

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.

Exports TypeScript types autogenerated from c2pa-rs structs, used by c2pa-web.

tools/

Other tools that provide utilities for local development.

A minimal website that can be used to view c2pa-web output and as a sandbox for local development.

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8