NOTE: This documentation is for the example developer.
This directory contains the client for signing JPEG images with Content Credentials. The client works with the C2PA Python example server in development mode using demo certificates (included in this repository).
The client.py file is a command-line test tool that signs JPEG image files. It connects to the signing server defined in app.py to add Content Credentials to JPEG images.
-
Install Python dependencies. Enter this command in the top level of the repo:
pip install -r requirements.txt
-
Run the signing server (
app.py). It uses local certificates and must be accessible to the client:python app.py
-
Run the client as explained below to submit images for the server to sign.
NOTE: This test client supports only JPEG images.
python tests/client.py <image-file> -o <output-directory>| Argument | Type | Required | Description |
|---|---|---|---|
files |
string | Yes | One or more image files to be signed |
-o, --output |
string | Yes | Output directory where signed images will be saved |
-f, --envfile |
string | No | Path to environment configuration file |
python tests/client.py ./image-to-sign.jpeg -o signed-imagespython tests/client.py ./image-to-sign.jpeg -o signed-images -f ./my-config.env- Server Connection: Client connects to the signing server's
/signer_dataendpoint. - Configuration Retrieval: Gets signing algorithm, certificate chain, and signing URL.
- Signer Creation: Creates a remote signer using the modern C2PA API (
Signer.from_callback)/ - Manifest Creation: Generates a default C2PA manifest.
- Image Processing: Creates a thumbnail for the manifest and adds it as resource.
- Remote Signing: Uses the
Builder.sign()method with remote signing callback. - Output: Saves the signed image to the specified output directory.