How contentauth/c2pa-js works
Project Type and Purpose
• This is a monorepo for a JavaScript SDK with the primary goal of making it easy to view and verify C2PA metadata directly in the browser.
• The SDK is designed to support different integration scenarios (e.g., standard web components, React integrations, toolkit utilities, and detection logic) while sharing a core implementation.
• It uses Rush for monorepo management, which centralizes configuration, dependency management, and build orchestration across multiple packages.
File Structure
• The top-level directories include:
– Common: Contains shared APIs, autoinstallers, configuration files, and git hooks. These are reusable across packages.
– Examples: Provides multiple sample applications or configurations (e.g., minimal TypeScript setups with Rollup, Vite, Webpack, and React integrations) that demonstrate how to integrate the SDK.
– Packages: Contains several packages, each focusing on a specific aspect:
▪ packages/c2pa – The core library managing metadata, manifest handling, and core algorithms.
▪ packages/c2pa-wc – A web component implementation exposing UI parts such as badges, headers, and tooltips, with Storybook support for visual demonstrations.
▪ packages/detector – Likely responsible for detecting and analyzing media content for authenticity.
▪ packages/react – Provides React hooks and components for integrating the SDK into React applications.
▪ packages/toolkit – Contains additional utilities and CLI tools to work with or extend the SDK functionality.
– Tools: Contains additional tooling (like c2pa-wc-storykit) and testing utilities.
– Configurations: Numerous build, lint, and workflow configuration files that show the integration with CI/CD (GitHub Workflows) and packaging rules.
• The structure also shows language integrations (TypeScript, Rust for toolkit parts, WebAssembly) and multiple bundler configurations (Rollup, Webpack, Vite).