@contentauth/c2pa-wasm
v0.6.2
Published
The WebAssembly wrapper for [`c2pa-rs`](https://github.com/contentauth/c2pa-rs) that powers `c2pa-web`, built with [wasm-bindgen](https://github.com/wasm-bindgen/wasm-bindgen). While these bindings can be used directly, most users will prefer the convenie
Downloads
46,247
Readme
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.
Installation
npm install @contentauth/c2pa-wasmDevelopment
Prerequisites
Ensure the repo-wide prerequisites are installed.:
See the c2pa-js README for details.
Then, install all of the following prerequisites:
Rust
The minimum supported Rust version is 1.88.0.
To install Rust via rustup:
curl https://sh.rustup.rs -sSf | shFor more information, see Install Rust.
Additionally, you must install the wasm32-unknown-unknown target:
rustup target add wasm32-unknown-unknownwasm-bindgen-cli
The wasm-bindgen-cli provides options to tweak JavaScript generated by wasm-bingen.
For more information, see the wasm-bindgen-cli documentation.
cargo 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.
wasm-pack
Wasm-pack is a tool for building and working with Rust-generated WebAssembly that interoperates with JavaScript.
cargo install [email protected]For more information, see the wasm-pack documentation.
Building
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.
Testing
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