# Tectra SDK

Sign, watermark, and verify images/videos locally with the Tectra platform.

## Installation

```bash
pip install tectravision-sdk
# or from source:
pip install -e ./sdk
```

## Quick Start

```python
from tectravision_sdk import TectraClient

client = TectraClient(
    api_key="iai_...",
    signing_key_id="your-signing-key-uuid",
    api_url="https://tectra.vision",
    fernet_key="your-fernet-key",  # or set TECTRA_FERNET_KEY env var
)

# Sign an image (locally — only metadata sent to backend)
result = client.sign("photo.jpg")
print(f"Signed! Record: {result['record_id']}")
print(f"Watermarked file: {result['output_path']}")

# Sign a video (frame-by-frame watermarking)
result = client.sign_video("footage.mp4", keyframe_fps=1)

# Verify any image/video
result = client.verify("suspect.jpg")
print(f"Authentic: {result['authentic']}")
print(f"Origin: {result.get('origin')}")

# Watch a directory and auto-sign new files
def on_signed(path, result):
    print(f"Auto-signed {path}: {result['record_id']}")

client.watch("/camera/output/", callback=on_signed)
```

## How It Works

1. Your signing key's encrypted private key is fetched once from the backend
2. Decrypted locally using the Fernet key (never sent back)
3. Images are watermarked and signed entirely on your machine
4. Only hashes + metadata are POSTed to the backend for registration + blockchain anchoring
5. Your actual image/video bytes never leave your infrastructure
