<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
# Implementing Backup Integrity Validation — API Reference

## Restic CLI

```bash
# Initialize repository
restic -r /backup/restic-repo init

# Check integrity (fast)
restic -r /backup/restic-repo check

# Check integrity with data verification (slow)
restic -r /backup/restic-repo check --read-data

# Partial data check (5% sample)
restic -r /backup/restic-repo check --read-data-subset=5%

# List snapshots
restic -r /backup/restic-repo snapshots --json

# Restore for testing
restic -r /backup/restic-repo restore latest --target /tmp/test/
```

## BorgBackup CLI

```bash
# Check repository
borg check /backup/borg-repo

# Verify data integrity
borg check --verify-data /backup/borg-repo

# List archives
borg list --json /backup/borg-repo

# Dry-run extract
borg extract --dry-run /backup/borg-repo::archive-name
```

## AWS S3 Backup Validation

```bash
# Check Object Lock configuration
aws s3api get-object-lock-configuration --bucket BUCKET

# Verify object checksum
aws s3api head-object --bucket BUCKET --key KEY --checksum-mode ENABLED

# List versions for tampering detection
aws s3api list-object-versions --bucket BUCKET --prefix "backups/"
```

## Veeam PowerShell — SureBackup

```powershell
# Start SureBackup verification job
Start-VBRSureBackupJob -Job "SureBackup-Critical"

# Get last verification result
Get-VBRSureBackupJob -Name "SureBackup-Critical" |
  Get-VBRSureBackupJobSession | Select-Object -Last 1

# Check backup file integrity
Get-VBRBackup -Name "Daily-Backup" |
  Get-VBRRestorePoint | Test-VBRBackupFileIntegrity
```

## Hash Verification

```bash
# Generate manifest
find /backup/ -type f -exec sha256sum {} \; > manifest.sha256

# Verify manifest
sha256sum -c manifest.sha256

# Compare two manifests
diff <(sort old-manifest.sha256) <(sort new-manifest.sha256)
```

## Key Parameters

| Parameter | Description | Example |
|-----------|-------------|---------|
| `repo` | Backup repository path | `/backup/restic-repo` |
| `manifest` | SHA-256 hash manifest | `/backup/manifests/2026-03-17.sha256` |
| `rto_target` | Recovery time objective | `4h` |
| `check_level` | Validation depth (L1-L4) | `L3` |
