Skip to content

adobe/profile-evaluator

C2PA / JPEG Trust Evaluator

This project is a command line tool that evaluates a JSON file containing an asset's provenance data against a YAML-based evaluation document. It supports two types of evaluation documents:

  • JPEG Trust Profiles — based on the JPEG Trust standard (ISO 21617-1:2025), used to evaluate a Trust Indicator Set
  • C2PA Asset Rubrics — based on C2PA conformance specifications, used to evaluate crJSON

This tool also serves to validate forthcoming work in the 2nd Edition of JPEG Trust Part 1 as well as JPEG Trust Part 2 (ISO 21617-2).

Table of Contents

Installation

  1. Clone the repository:

    git clone https://github.com/adobe/profile-evaluator.git
    
  2. Navigate to the project directory:

    cd profile-evaluator
    
  3. Install the dependencies:

    npm install
    

Usage

To run the tool, use the following command:

node src/index.js [options] <jsonFile>

Required Arguments

  • <jsonFile> - Path to the JSON file containing the asset data to evaluate (Trust Indicator Set or C2PA manifest report)

Required Options

  • -p, --profile <path> / -r, --rubric <path> - Path to the evaluation document file (YAML format) — either a JPEG Trust Profile or a C2PA Asset Rubric (--rubric is an alias for --profile, and defaults output to JSON format)

OR

  • -e, --eval <expression> - JSON formula expression to evaluate against the data (cannot be used with --profile/--rubric)

Optional Options

  • -o, --output <directory> - Output directory for reports (if not specified, results are printed to console)
  • -y, --yaml - Output report in YAML format (default for profiles)
  • -j, --json - Output report in JSON format (default for rubrics)
  • --html <path> - Path to HTML template file for generating HTML reports
  • -h, --help - Display help information
  • -V, --version - Display version number

Examples

JPEG Trust Profile evaluation

  1. Basic evaluation (output to console):

    node src/index.js -p testfiles/trust-profiles/camera_profile.yml testfiles/trust-profiles/camera_indicators.json
    
  2. Generate YAML report in output directory:

    node src/index.js -p testfiles/trust-profiles/genai_profile.yml -o output testfiles/trust-profiles/genai_indicators.json
    
  3. Generate JSON report:

    node src/index.js -p testfiles/trust-profiles/no_manifests_profile.yml -o output --json testfiles/trust-profiles/no_manifests_indicators.json
    
  4. Generate HTML report using a template:

    node src/index.js -p testfiles/trust-profiles/camera_profile.yml -o output --html testfiles/trust-profiles/report_template.html testfiles/trust-profiles/camera_indicators.json
    

C2PA Asset Rubric evaluation

  1. Evaluate a C2PA asset against the conformance rubric:
    node src/index.js -r testfiles/asset-rubrics/asset-rubric-conformance0.2-spec2.4.yml testfiles/asset-rubrics/capture-non-ai-then-ai-edits.json
    

Expression evaluation

  1. Evaluate a simple expression against asset data:

    node src/index.js --eval "declaration.'claim.v2'.alg" testfiles/trust-profiles/camera_indicators.json
    
  2. Check if a property exists:

    node src/index.js --eval "has(declaration.assertions)" testfiles/trust-profiles/camera_indicators.json
    

Evaluation Mode

The --eval option allows you to run JSON formula expressions directly against asset data without requiring a Trust Profile or Asset Rubric. This is useful for:

  • Quick data exploration: Extract specific values from asset data
  • Property validation: Check if certain fields exist in the data
  • Data transformation: Apply expressions to compute derived values
  • Debugging: Test expressions before including them in Trust Profiles or Asset Rubrics

Expression Syntax

The tool supports JSON formula expressions with the following features:

  • Property access: Use dot notation (e.g., data.field)
  • Nested properties: Use quotes for special characters (e.g., "claim.v2")
  • Array access: Use bracket notation (e.g., array[0])
  • Functions: Built-in functions like has(), length(), etc.
  • Operators: Standard comparison and logical operators

Evaluation Examples

# Extract a simple property
node src/index.js --eval "declaration" testfiles/trust-profiles/camera_indicators.json

# Access nested properties with special characters
node src/index.js --eval "declaration.'claim.v2'.alg" testfiles/trust-profiles/camera_indicators.json

# Check if a property exists
node src/index.js --eval "has(declaration.assertions)" testfiles/trust-profiles/camera_indicators.json

# Get array length
node src/index.js --eval "length(declaration.assertions)" testfiles/trust-profiles/camera_indicators.json

Note: The --eval and --profile/--rubric options are mutually exclusive - you cannot use both in the same command.

Development

Scripts

# Run the CLI
npm start

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Run tests in watch mode
npm run test:watch

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

Testing

The project includes comprehensive tests using Jest:

  • Unit Tests: Test individual features and functions
  • Integration Tests: Test the complete CLI workflow
  • Error Handling Tests: Verify graceful error handling
# Run all tests
npm test

# Run tests with coverage report
npm run test:coverage

# Run tests in watch mode for development
npm run test:watch

Code Quality

The project uses ESLint for code quality and consistency:

# Check for linting issues
npm run lint

# Automatically fix linting issues
npm run lint:fix

ESLint Configuration

The project uses modern ESLint configuration with the following features:

  • Modern JavaScript: ES2020 support with async/await
  • Node.js Environment: Configured for Node.js development
  • Strict Rules: Enforces consistent code style and best practices
  • Jest Support: Configured for Jest testing environment

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.

Submitting a Pull Request

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (npm test)
  5. Run linting (npm run lint)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.

Changelog

v1.3

  • Added -r/--rubric as an alias for -p/--profile
  • Default output format is now JSON for rubrics and YAML for profiles, with the option to override using -y or -j

v1.2

  • Expanded tool to support C2PA Asset Rubrics in addition to JPEG Trust Profiles
  • Updated documentation to reflect support for both evaluation document types
  • Updated examples and fixed -j option description typo
  • Reorganized test files into testfiles/trust-profiles/ and testfiles/asset-rubrics/ subdirectories

v1.1

  • Changed default output format to YAML
  • Added --eval option for evaluating JSON formula expressions directly (and associated tests!)
  • Improved error handling for missing profile or JSON file
  • Started work on 21617-2 support

v1.0.0

  • Initial release
  • Comprehensive test suite
  • ESLint integration
  • Jest testing framework
  • Pretty printing support
  • Error handling and validation

About

Node.js application for processing a JPEG Trust Indicator Set and a JPEG Trust Profile as per ISO 21617-1.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors