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.
npm install @contentauth/c2pa-wasmEnsure the repo-wide prerequisites (Node.js v22+, NX, and pnpm) are installed. See the top-level README for details.
Then, all of the following prerequisites must be installed before c2pa-wasm can be built:
Minimum supported Rust version: 1.88.0.
To install Rust via rustup:
curl https://sh.rustup.rs -sSf | shAdditionally, the wasm32-unknown-unknown target must be installed:
rustup target add wasm32-unknown-unknowncargo install [email protected]Important: The version of
wasm-bindgen-climust match the version of thewasm-bindgendependency inCargo.toml. A version mismatch will cause build failures with errors like "rust Wasm file schema version: X.X.X, this binary schema version: Y.Y.Y". If you encounter this, checkCargo.tomlfor the correct version and reinstall the CLI accordingly.
cargo install [email protected]To build the library:
nx build c2pa-wasmThis will execute the commands defined in the nx-wasm-bindgen executor to produce the final output in the pkg/ directory.
The library relies on wasm-pack to run its tests. As a general principle, the majority of test coverage will come from c2pa-web's test suite.
To run the tests:
nx test c2pa-wasm