### Run Signing and Verification Example with SignerInfo Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/examples Executes the `sign_info.py` script, demonstrating signing and verification using a `SignerInfo` object to create a `Signer`. Ensure the c2pa-python package is installed. ```bash python examples/sign_info.py ``` -------------------------------- ### Run TrustMark Example Script Source: https://opensource.contentauthenticity.org/docs/trustmark Execute the provided test script to verify the installation and see watermarking in action. ```bash cd trustmark/python python test.py ``` -------------------------------- ### Run Builder Example Source: https://opensource.contentauthenticity.org/docs/rust-sdk/docs/intents Command to execute the builder example from the SDK directory. ```bash cd sdk cargo run --example builder_sample ``` -------------------------------- ### Build C++ Examples Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp/docs/usage Compiles the provided C++ examples using the make utility. ```bash make examples ``` -------------------------------- ### Run Callback Signing and Verification Example Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/examples Executes the `sign.py` script, which uses a callback signer for signing and verification. Ensure the c2pa-python package is installed. ```bash python examples/sign.py ``` -------------------------------- ### Install TrustMark from Source Source: https://opensource.contentauthenticity.org/docs/trustmark Install the package from the local python directory after cloning the repository. ```bash cd trustmark/python pip install . ``` -------------------------------- ### Manage Signing Server with Makefile Source: https://opensource.contentauthenticity.org/docs/c2pa-android Commands to manage the signing server, which is required for Hardware Security and Remote signing modes in the example app. Use these commands to start, stop, check status, and view logs of the signing server. ```bash # Start the signing server make signing-server-start # Check server status make signing-server-status # View server logs make signing-server-logs # Stop server when done make signing-server-stop or # Start the signing server in the foreground make signing-server-run ``` -------------------------------- ### Build Example Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp/docs/usage Provides instructions on how to build and run a C++ example that demonstrates adding a manifest to an image file using a sample private key and certificate. ```APIDOC ## More examples The C++ example in `examples/training.cpp` uses the JSON for Modern C++ library class. Build and run the example by entering this `make` command: ```bash make examples ``` This example adds the manifest `tests/fixtures/training.json` to the image file `tests/fixtures/A.jpg` using the sample private key and certificate in the `tests/fixtures` directory. The example displays some text to standard out that summarizes whether AI training is allowed based on the specified manifest and then saves the resulting image file with attached manifest to `build/examples/training.jpg`. ``` -------------------------------- ### Start Local Web Server (Python) Source: https://opensource.contentauthenticity.org/docs/trustmark/js Starts a simple HTTP server on port 8000 for serving local files. This is typically used to run the TrustMark JavaScript example in a browser. ```python python -m http.server 8000 ``` -------------------------------- ### Build and run Emscripten example Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp Commands to initialize the Emscripten environment, build the WebAssembly example, and execute it using Node.js. ```bash source /path/to/emsdk/emsdk_env.sh ``` ```bash make emscripten-example node build/emscripten-example/c2pa_example.js path/to/image.jpg ``` -------------------------------- ### Run Example App with Makefile Source: https://opensource.contentauthenticity.org/docs/c2pa-android Build and run the example application on a connected device or emulator using the Makefile. Alternatively, you can open the example-app module in Android Studio and run it from there. ```bash make run-example-app ``` -------------------------------- ### Install project dependencies Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Navigates to the project directory and installs required Python packages. ```bash cd c2pa-python-example pip install -r requirements.txt ``` -------------------------------- ### Run the builder example Source: https://opensource.contentauthenticity.org/docs/rust-sdk/docs/working-stores Executes the builder sample project using cargo. ```bash cd sdk cargo run --example builder_sample ``` -------------------------------- ### Start Signing Server Source: https://opensource.contentauthenticity.org/docs/c2pa-ios Use this command to start the Swift-based signing server for testing certificate enrollment and C2PA signing. The server runs on http://localhost:8080. ```bash make signing-server-start ``` -------------------------------- ### Create Intent Example: With Additional Manifest Metadata Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp/docs/intents Example showing how to combine `Create` intent with additional manifest metadata. ```APIDOC ## Create Intent: With Additional Manifest Metadata ### Description This example illustrates combining the `Create` intent with custom manifest definitions for additional metadata and assertions. ### Method `builder.sign(source_path, output_path, signer);` ### Parameters None explicitly shown in this snippet, but `builder` is initialized with a context and manifest definition. ### Request Example ```c++ c2pa::Context context(R"({ "version": 1, "builder": { "intent": {"Create": "digitalCapture"}, "claim_generator_info": {"name": "an_app", "version": "0.1.0"} } })"); std::string manifest_def = R"({ "title": "My New Image", "assertions": [ { "label": "cawg.training-mining", "data": { "entries": { "cawg.ai_inference": {"use": "notAllowed"}, "cawg.ai_generative_training": {"use": "notAllowed"} } } } ] })"; c2pa::Builder builder(context, manifest_def); builder.sign(source_path, output_path, signer); ``` ``` -------------------------------- ### Install TrustMark CLI Source: https://opensource.contentauthenticity.org/docs/trustmark/rust/crates/trustmark-cli Install the TrustMark CLI by running this command from the `trustmark/crates/trustmark-cli` directory. Ensure you use the `--locked` flag for reproducible builds. ```bash cargo install --locked --path . ``` -------------------------------- ### Setup Python virtual environment Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Creates and activates a virtual environment for the project dependencies. ```bash python -m venv c2pa-env source c2pa-env/bin/activate ``` -------------------------------- ### Run CAWG Example Source: https://opensource.contentauthenticity.org/docs/rust-sdk/docs/cawg-id Execute the CAWG example to sign and verify a claim with a CAWG identity assertion. Replace placeholders with your source and output file paths. ```bash cargo run --example cawg -- ``` ```bash cargo run --example cawg -- ./sdk/tests/fixtures/CA.jpg cawg-out.jpg ``` -------------------------------- ### Verify C2PA Tool Installation Source: https://opensource.contentauthenticity.org/docs/c2patool/c2patool-index Run the help command to confirm the tool is correctly installed and accessible in your PATH. ```bash c2patool -h ``` -------------------------------- ### Install TrustMark via PyPI Source: https://opensource.contentauthenticity.org/docs/trustmark Use this command to install the TrustMark package directly from the Python Package Index. ```bash pip install trustmark ``` -------------------------------- ### Create a Context with Default Settings Source: https://opensource.contentauthenticity.org/docs/rust-sdk/docs/context-settings Instantiate a `Context` with default configuration. No external setup is required. ```rust use c2pa::Context; let context = Context::new(); ``` -------------------------------- ### Minimal Configuration Example Source: https://opensource.contentauthenticity.org/docs/rust-sdk/docs/context-settings A basic configuration defining only the claim generator and intent. ```json { "version": 1, "builder": { "claim_generator": { "name": "my app", "version": "0.1" }, "intent": {"Create": "digitalCapture"} } } ``` -------------------------------- ### Example signing output Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Shows the console output after successfully signing a certificate request. ```text Certificate request self-signature ok subject=O=C2PA Python Demo, CN=John Smith Enter pass phrase for rootCA.key: ``` -------------------------------- ### Install Rust Source: https://opensource.contentauthenticity.org/docs/c2pa-js/c2pa-wasm-readme Install Rust using the official rustup script. Ensure Rust version 1.88.0 or higher is used. ```bash curl https://sh.rustup.rs -sSf | sh ``` -------------------------------- ### Create Intent Example: New Digital Creation Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp/docs/intents Example demonstrating how to use the `Create` intent with `DigitalCreation` source type. ```APIDOC ## Create Intent: New Digital Creation ### Description This example shows how to create content using the `Create` intent and specifying `DigitalCreation` as the source type. ### Method `builder.sign(source_path, output_path, signer);` ### Parameters None explicitly shown in this snippet, but `builder` is initialized with a context specifying the intent. ### Request Example #### Using Context ```c++ c2pa::Context context(R"({ "version": 1, "builder": {"intent": {"Create": "digitalCreation"}} })"); c2pa::Builder builder(context, R"({})"); builder.sign(source_path, output_path, signer); ``` #### Using set_intent ```c++ c2pa::Context context; c2pa::Builder builder(context, R"({})"); builder.set_intent(Create, DigitalCreation); builder.sign(source_path, output_path, signer); ``` ``` -------------------------------- ### Deprecated and Context API signing examples Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp/docs/context-settings Examples showing deprecated stream signing and the updated context-based API approach. ```cpp std::ofstream out("output.jpg", std::ios::binary); builder.sign("image/jpeg", source, out, signer); ``` ```cpp std::fstream dest("output.jpg", std::ios::in | std::ios::out | std::ios::binary); builder.sign("image/jpeg", source, dest, signer); ``` -------------------------------- ### Example signature_info from manifest Source: https://opensource.contentauthenticity.org/docs/getting-started/inspect This snippet shows an example of the signature_info object from an active manifest, including algorithm, issuer, common name, certificate serial number, and timestamp. ```json "signature_info": { "alg": "Ps256", "issuer": "Adobe Inc.", "common_name": "Adobe C2PA", "cert_serial_number": "419323736054358557205556576293173262079519360989", "time": "2025-10-23T19:22:19+00:00" } ``` -------------------------------- ### Example OpenSSL prompt output Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Displays the expected interactive prompts when generating a certificate request. ```text You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]: ... State or Province Name (full name) [Some-State]: ... Locality Name (eg, city) []: ... Organization Name (eg, company) [Internet Widgits Pty Ltd]: ... Organizational Unit Name (eg, section) []: ... Common Name (e.g. server FQDN or YOUR name) []: ... Email Address []: ... ``` -------------------------------- ### Define a C2PA actions assertion Source: https://opensource.contentauthenticity.org/docs/manifest/writing/assertions-actions Example of an actions assertion structure within a manifest, starting with a c2pa.created action. ```json ... "assertions": [ { "label": "c2pa.actions.v2", "data": { "actions": [ { "action": "c2pa.created", "digitalSourceType": "http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia", "softwareAgent": { "name": "Tool XYZ", }, } ] } } ], ... ``` -------------------------------- ### Run C2PA Data Reading Example Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/examples Executes the `read.py` script to demonstrate reading C2PA data from an asset. Ensure the c2pa-python package is installed. ```bash python examples/read.py ``` -------------------------------- ### Run 'Do Not Train' Assertion Example Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/examples Executes the `training.py` script to demonstrate adding and verifying 'do not train' assertions. Ensure the c2pa-python package is installed. ```bash python examples/training.py ``` -------------------------------- ### Install Node.js using nvm Source: https://opensource.contentauthenticity.org/docs/c2pa-js Installs a specific version of Node.js using nvm. Ensure Node.js v22 or later is installed. ```bash nvm install nvm install 22.22.0 ``` -------------------------------- ### Create environment file Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Initializes the .env file from the provided template. ```bash cp example-env.env .env ``` -------------------------------- ### Install c2pa-web Source: https://opensource.contentauthenticity.org/docs/c2pa-js/c2pa-web-readme Install the package via npm. ```bash npm install @contentauth/c2pa-web ``` -------------------------------- ### Install c2pa-wasm Source: https://opensource.contentauthenticity.org/docs/c2pa-js/c2pa-wasm-readme Install the c2pa-wasm package using npm. ```bash npm install @contentauth/c2pa-wasm ``` -------------------------------- ### Install Doxygen on macOS Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp Use Homebrew to install Doxygen on macOS systems. ```bash brew install doxygen ``` -------------------------------- ### Install wasm-pack Source: https://opensource.contentauthenticity.org/docs/c2pa-js/c2pa-wasm-readme Install the wasm-pack tool for building and testing WebAssembly packages. ```bash cargo install wasm-pack@0.13.1 ``` -------------------------------- ### Initialize Context with SDK defaults Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/context-settings Use default settings for quick prototyping or when standard SDK behavior is sufficient. ```python from c2pa import Context ctx = Context() # Uses SDK defaults ``` -------------------------------- ### Build and Archive a Working Store Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/selective-manifests Initializes a context and builder to add image ingredients, then serializes the store to a byte stream. ```python ctx = Context.from_dict({ "builder": {"claim_generator_info": {"name": "an-application", "version": "0.1.0"}}, }) with Builder({ "claim_generator_info": [{"name": "an-application", "version": "0.1.0"}], }, context=ctx) as builder: # Add ingredients to the working store with open("A.jpg", "rb") as ing_a: builder.add_ingredient( {"title": "A.jpg", "relationship": "componentOf"}, "image/jpeg", ing_a, ) with open("B.jpg", "rb") as ing_b: builder.add_ingredient( {"title": "B.jpg", "relationship": "componentOf"}, "image/jpeg", ing_b, ) # Save the working store as an archive archive_stream = io.BytesIO() builder.to_archive(archive_stream) ``` -------------------------------- ### Install c2pa-node package Source: https://opensource.contentauthenticity.org/docs/node-landing Commands to install the library using common package managers. ```bash $ npm install @contentauth/c2pa-node ``` ```bash $ yarn add @contentauth/c2pa-node ``` ```bash $ pnpm add @contentauth/c2pa-node ``` -------------------------------- ### Add and Sign a Manifest to a File Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/usage This example demonstrates adding a signed manifest to a file. It includes security warnings about handling private keys and certificates directly. Custom settings can be applied during signing via a Context. ```python try: with open("path/to/cert.pem", "rb") as cert_file, open("path/to/key.pem", "rb") as key_file: cert_data = cert_file.read() key_data = key_file.read() signer_info = C2paSignerInfo( alg=C2paSigningAlg.PS256, sign_cert=cert_data, private_key=key_data, ta_url=b"http://timestamp.digicert.com" ) with Context() as ctx: with Signer.from_info(signer_info) as signer: with Builder(manifest_json, ctx) as builder: with open("path/to/ingredient.jpg", "rb") as ingredient_file: ingredient_json = json.dumps({"title": "Ingredient Image"}) builder.add_ingredient(ingredient_json, "image/jpeg", ingredient_file) # Sign using file paths builder.sign_file("path/to/source.jpg", "path/to/output.jpg", signer) # Verify the signed file with the same context with Reader("path/to/output.jpg", context=ctx) as reader: manifest_store = json.loads(reader.json()) active_manifest = manifest_store["manifests"][manifest_store["active_manifest"]] print("Signed manifest:", active_manifest) except Exception as e: print("Failed to sign manifest store: " + str(e)) ``` -------------------------------- ### Install awslocal CLI Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Installs the AWS CLI and the awslocal wrapper to interact with LocalStack. ```bash pip install awscli ``` ```bash pip install awscli-local ``` -------------------------------- ### Run the Python Application Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Execute this command in your terminal to start the application. The application will output its startup information and indicate when it is ready to serve requests. ```bash python3 app.py ``` -------------------------------- ### Start LocalStack Source: https://opensource.contentauthenticity.org/docs/c2pa-python-example Starts the LocalStack service in detached mode for local AWS simulation. ```bash localstack start -d ``` -------------------------------- ### Install Doxygen on Ubuntu/Debian Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp Use apt-get to install Doxygen on Ubuntu or Debian-based Linux distributions. ```bash sudo apt-get install doxygen ``` -------------------------------- ### Install C2PA Tool via Homebrew Source: https://opensource.contentauthenticity.org/docs/c2patool/c2patool-index Use this command to install the tool on macOS systems with Homebrew. ```bash brew install c2patool ``` -------------------------------- ### Implement a two-phase workflow Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/working-stores Prepare a manifest and save it as an archive in the first phase, then restore and sign the asset in the second phase. ```python import io import json ctx = Context.from_dict({"builder": {"claim_generator_info": {"name": "my-app", "version": "0.1.0"}}}) manifest_json = json.dumps({ "title": "Artwork draft", "assertions": [] }) builder = Builder(manifest_json, context=ctx) with open("thumb.jpg", "rb") as thumb: builder.add_resource("thumbnail", thumb) with open("sketch.png", "rb") as sketch: builder.add_ingredient( json.dumps({"title": "Sketch"}), "image/png", sketch ) # Save working store as archive with open("artwork_manifest.c2pa", "wb") as f: builder.to_archive(f) print("Working store saved to artwork_manifest.c2pa") ``` ```python ctx = Context.from_dict({ "builder": {"thumbnail": {"enabled": False}}, "signer": signer, }) with open("artwork_manifest.c2pa", "rb") as archive: builder = Builder({}, context=ctx) builder.with_archive(archive) # Sign using the context's signer with open("artwork.jpg", "rb") as src, open("signed_artwork.jpg", "w+b") as dst: builder.sign("image/jpeg", src, dst) ``` -------------------------------- ### Install c2pa-python Package Source: https://opensource.contentauthenticity.org/docs/c2pa-python Install the c2pa-python package from PyPI. This command is used in your terminal or command prompt. ```bash pip install c2pa-python ``` -------------------------------- ### Create, Sign, and Read Manifest Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/working-stores Combines manifest creation, signing with provided credentials, and reading the manifest store. Ensure 'certs.pem', 'private_key.pem', and 'source.jpg' exist. ```python import json from c2pa import Builder, Reader, Context, Signer, C2paSignerInfo, C2paSigningAlg try: # 1. Define manifest manifest_json = json.dumps({ "claim_generator_info": [{"name": "demo-app", "version": "0.1.0"}], "title": "Signed image", "assertions": [] }) # 2. Load credentials and create signer with open("certs.pem", "rb") as f: certs = f.read() with open("private_key.pem", "rb") as f: private_key = f.read() signer_info = C2paSignerInfo( alg=C2paSigningAlg.ES256, sign_cert=certs, private_key=private_key, ta_url=b"http://timestamp.digicert.com" ) signer = Signer.from_info(signer_info) # 3. Create context with settings and signer ctx = Context.from_dict({ "builder": {"thumbnail": {"enabled": True}} }, signer=signer) # 4. Create Builder with context and sign builder = Builder(manifest_json, context=ctx) with open("source.jpg", "rb") as src, open("signed.jpg", "w+b") as dst: builder.sign("image/jpeg", src, dst) print("Asset signed with context settings") # 5. Read back the manifest store reader = Reader("signed.jpg", context=ctx) print(reader.json()) except Exception as e: print(f"Error: {e}") ``` -------------------------------- ### Minimal manifest definition example Source: https://opensource.contentauthenticity.org/docs/c2patool/docs/manifest A sample manifest definition file including signing configuration and assertion data. ```json { "alg": "es256", "private_key": "/Users/randmckinney/work/cai/c2pa-rs/cli/sample/es256_private.key", "sign_cert": "/Users/randmckinney/work/cai/c2pa-rs/cli/sample/es256_certs.pem", "ta_url": "http://timestamp.digicert.com", "claim_generator": "TestApp", "assertions": [ { "label": "c2pa.actions.v2", "data": { "actions": [ { "action": "c2pa.created", "softwareAgent": "My Demo", "digitalSourceType": "http://cv.iptc.org/newscodes/digitalsourcetype/digitalArt" } ], "allActionsIncluded": true } } ] } ``` -------------------------------- ### Install pnpm and NX globally Source: https://opensource.contentauthenticity.org/docs/c2pa-js Installs pnpm and NX globally using npm. These are required for managing the monorepo. ```bash npm install -g pnpm npm install -g nx ``` -------------------------------- ### Install wasm-bindgen-cli Source: https://opensource.contentauthenticity.org/docs/c2pa-js/c2pa-wasm-readme Install the wasm-bindgen-cli tool. Ensure the version matches the dependency in Cargo.toml to avoid build errors. ```bash cargo install wasm-bindgen-cli@0.2.114 ``` -------------------------------- ### Link Ingredient Archive to Action Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/working-stores This example demonstrates creating an ingredient archive, building a manifest with an action referencing it via 'ingredientIds', and then adding the archive to the builder with a specific label. The label must match the 'ingredientIds' value for successful linking. ```python import io, json # Step 1: Create the ingredient archive. archive_builder = Builder.from_json({ "claim_generator_info": [{"name": "an-application", "version": "0.1.0"}], "assertions": [], }) with open("photo.jpg", "rb") as f: archive_builder.add_ingredient( {"title": "photo.jpg", "relationship": "componentOf"}, "image/jpeg", f, ) archive = io.BytesIO() archive_builder.to_archive(archive) archive.seek(0) # Step 2: Build a manifest with an action that references the ingredient. manifest_json = { "claim_generator_info": [{"name": "an-application", "version": "0.1.0"}], "assertions": [ { "label": "c2pa.actions.v2", "data": { "actions": [ { "action": "c2pa.placed", "parameters": { "ingredientIds": ["my-ingredient"] }, } ] }, } ], } ctx = Context.from_dict({"signer": signer}) builder = Builder(manifest_json, context=ctx) # Step 3: Add the ingredient archive with a label matching the ingredientIds value. ``` -------------------------------- ### Decode Watermark Example Source: https://opensource.contentauthenticity.org/docs/trustmark/rust/crates/trustmark-cli Example command to decode a watermark from an image that has already been encoded. Run this from the workspace root. ```bash trustmark -m ./models decode -i ../images/ghost_encoded.png ``` -------------------------------- ### Create Intent Example: AI-Generated Content Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp/docs/intents Example for marking AI-generated content using the `Create` intent with `TrainedAlgorithmicMedia`. ```APIDOC ## Create Intent: AI-Generated Content ### Description This example demonstrates marking content as AI-generated using the `Create` intent and `TrainedAlgorithmicMedia`. ### Method `builder.sign(source_path, output_path, signer);` ### Parameters None explicitly shown in this snippet, but `builder` is initialized with a context specifying the intent. ### Request Example ```c++ c2pa::Context context(R"({ "version": 1, "builder": {"intent": {"Create": "trainedAlgorithmicMedia"}} })"); c2pa::Builder builder(context, R"({})"); builder.sign(source_path, output_path, signer); ``` ``` -------------------------------- ### Implement a two-phase workflow Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp/docs/working-stores Demonstrates preparing a manifest in one phase and signing the asset in a separate phase using an archive. ```cpp void prepare_manifest() { const std::string manifest_json = R"({ "title": "Artwork draft", "assertions": [ ... ] })"; c2pa::Context context; auto builder = c2pa::Builder(context, manifest_json); builder.add_resource("thumbnail", "thumb.jpg"); builder.add_ingredient("{\"title\": \"Sketch\"}", "sketch.png"); // Save working store as archive (C2PA JUMBF format) builder.to_archive("artwork_manifest.c2pa"); std::cout << "Working store saved to artwork_manifest.c2pa" << std::endl; } ``` ```cpp void sign_asset() { // Restore the working store auto builder = c2pa::Builder::from_archive("artwork_manifest.c2pa"); // Create signer using HSM (not shown) auto signer = create_hsm_signer(); // Sign builder.sign("artwork.jpg", "signed_artwork.jpg", signer); std::cout << "Asset signed with manifest store" << std::endl; } ``` -------------------------------- ### Install Playwright Binaries for Testing Source: https://opensource.contentauthenticity.org/docs/c2pa-js/c2pa-web-readme Install Playwright browser binaries required for Vitest. Run this command from the `packages/c2pa-web` directory. ```bash pnpm exec playwright install ``` -------------------------------- ### Create a working store Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/working-stores Initialize a Builder object with a JSON manifest definition and a configuration context. ```python import json from c2pa import Builder, Context manifest_json = json.dumps({ "claim_generator_info": [{ "name": "example-app", "version": "0.1.0" }], "title": "Example asset", "assertions": [] }) ctx = Context.from_dict({ "builder": { "thumbnail": {"enabled": True} } }) builder = Builder(manifest_json, context=ctx) ``` -------------------------------- ### View TrustMark CLI Help Source: https://opensource.contentauthenticity.org/docs/trustmark/rust/crates/trustmark-cli Display CLI help information to understand available subcommands and options. ```bash trustmark [encode | decode] help ``` -------------------------------- ### Initialize Context with SDK Defaults Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/context-settings Use this method when SDK defaults are acceptable for quick prototyping or when default settings meet your needs. ```APIDOC ## Initialize Context with SDK Defaults ### Description Initializes the `Context` object using the SDK's default settings. This is suitable for quick prototyping or when the default configuration (e.g., verification enabled, thumbnails enabled at 1024px) is sufficient. ### Method `Context()` ### Endpoint N/A (Class constructor) ### Request Example ```python from c2pa import Context ctx = Context() ``` ### Response Example (No explicit response, `ctx` object is created) ``` -------------------------------- ### Build SDK with pre-built libraries Source: https://opensource.contentauthenticity.org/docs/c2pa-cpp Execute the release build target to download pre-built binaries and link the C++ SDK. ```makefile make release ``` -------------------------------- ### Download TrustMark Models Source: https://opensource.contentauthenticity.org/docs/trustmark/rust/crates/trustmark-cli Before using the CLI, create a `models` directory and download the necessary models. Execute these commands from the `trustmark/rust` directory. ```bash mkdir models ``` ```bash cargo xtask fetch-models ``` -------------------------------- ### Initialize Context from dictionary Source: https://opensource.contentauthenticity.org/docs/c2pa-python/docs/context-settings Build configuration programmatically using native Python dictionaries. ```python ctx = Context.from_dict({ "verify": {"verify_after_sign": True}, "builder": { "thumbnail": {"enabled": False}, "claim_generator_info": {"name": "An app", "version": "0.1.0"} } }) ```