# ProofMode CLI
Command-line interface for [ProofMode](https://proofmode.org) - capture, share, and preserve verifiable photos and videos.
## Installation
```bash
npm install -g @guardianproject/proofmode-cli
```
Or run directly with npx:
```bash
npx @guardianproject/proofmode-cli
```
## Usage
### Check (Verify) Command
Verify media files and their associated proofs:
```bash
# Check specific files
proofmode check -f photo1.jpg photo2.png
# Check all files in directories
proofmode check -d ./media ./photos
# Check from URLs
proofmode check -u https://example.com/photo.jpg
# Check IPFS content
proofmode check -c QmXxx...
# Save results to file
proofmode check -f photo.jpg -o results.json
```
### Generate Command
Generate cryptographic proof bundles for media files:
```bash
# Generate proofs for specific files
proofmode generate -f photo1.jpg video1.mp4
# Generate proofs for all files in directories
proofmode generate -d ./media ./photos
# Specify storage directory
proofmode generate -f photo.jpg -s ./my-proofs
# Add metadata
proofmode generate -f photo.jpg \
--description "Protest at city hall" \
--location "New York, NY" \
--event-type "protest" \
--tags "activism,documentation"
# Specify PGP details
proofmode generate -f photo.jpg \
--email myemail@example.com \
--passphrase "my-secure-passphrase"
```
### Sign Command
Certificate signing functionality (not yet implemented):
```bash
proofmode sign --csr request.csr --output cert.pem
```
## Options
### Global Options
- `-h, --help` - Show help
- `-v, --version` - Show version
### Check Command Options
- `-f, --file <paths...>` - File paths to check
- `-d, --dir <paths...>` - Directory paths to check
- `-u, --url <urls...>` - URLs to check
- `-c, --cid <cids...>` - IPFS CIDs to check
- `-o, --output-file <path>` - Output file for results (JSON format)
### Generate Command Options
- `-f, --file <paths...>` - File paths to generate proofs for
- `-d, --dir <paths...>` - Directory paths to generate proofs for
- `-s, --storage <path>` - Storage directory for proof data (default: ./proofmode)
- `-e, --email <email>` - Email for PGP key generation (default: user@example.com)
- `-p, --passphrase <pass>` - Passphrase for PGP key
- `--description <text>` - Description metadata
- `--location <text>` - Location metadata
- `--event-type <text>` - Event type metadata
- `--tags <text>` - Tags metadata
## Programmatic Usage
You can also use ProofMode programmatically in your Node.js applications:
```javascript
import { checkFiles, generateProofFromFile } from '@guardianproject/proofmode-cli';
// Verify files
const results = await checkFiles(['photo.jpg'], (type, message) => {
console.log(`${type}: ${message}`);
});
// Generate proof
const hash = await generateProofFromFile('photo.jpg', {
storageDir: './proofs',
metadata: {
description: 'Important evidence',
location: 'City Hall'
}
});
```
## Output Format
### Check Command Output
The check command returns a JSON object with verification results:
```json
{
"files": [
{
"path": "photo.jpg",
"hash": "sha256:abc123...",
"verifications": {
"c2pa": { "valid": true, "details": "..." },
"pgp": { "valid": true, "signer": "..." },
"ots": { "valid": true, "timestamp": "..." }
}
}
],
"summary": {
"total": 1,
"verified": 1,
"failed": 0
}
}
```
### Generate Command Output
The generate command creates proof files in the storage directory:
```
proofmode/
├── ab/
│ └── cd/
│ ├── abcd1234....proof.json
│ ├── abcd1234....proof.csv
│ ├── abcd1234....asc
│ └── abcd1234....ots
└── pubkey.asc
```
## Environment Variables
- `PROOFMODE_STORAGE` - Default storage directory
- `PROOFMODE_EMAIL` - Default email for PGP operations
- `NO_COLOR` - Disable colored output
## Requirements
- Node.js >= 18.0.0
- WebAssembly support in Node.js
## License
Apache License 2.0
## More Information
- Website: https://proofmode.org
- Repository: https://gitlab.com/guardianproject/proofmode/proofmode-rust
- Guardian Project: https://guardianproject.info