- Database URL:
https://rzgplzaytxronhcakemi.supabase.co - Project ID:
rzgplzaytxronhcakemi - Anon Key:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJ6Z3BsemF5dHhyb25oY2FrZW1pIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjY4NzMxODAsImV4cCI6MjA4MjQ0OTE4MH0.6wxeRoi8ZnUmX4Vu86HKx4wWaiOJm_rPhXGrFKyEvyg
VITE_SUPABASE_URL=https://rzgplzaytxronhcakemi.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJ6Z3BsemF5dHhyb25oY2FrZW1pIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjY4NzMxODAsImV4cCI6MjA4MjQ0OTE4MH0.6wxeRoi8ZnUmX4Vu86HKx4wWaiOJm_rPhXGrFKyEvygCREATE TABLE video_analyses (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
filename TEXT NOT NULL,
file_size BIGINT NOT NULL,
prediction TEXT NOT NULL CHECK (prediction IN ('real', 'fake')),
confidence DECIMAL(5,4) NOT NULL CHECK (confidence >= 0 AND confidence <= 1),
models_used TEXT[] NOT NULL DEFAULT '{}',
processing_time DECIMAL(6,2) NOT NULL DEFAULT 0,
analysis_result JSONB,
user_ip TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);Indexes:
idx_video_analyses_created_atoncreated_at DESCidx_video_analyses_predictiononpredictionidx_video_analyses_confidenceonconfidence
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
full_name VARCHAR(255),
role VARCHAR(50) DEFAULT 'analyst',
organization VARCHAR(255),
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_login TIMESTAMP
);CREATE TABLE video_evidence (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
case_id VARCHAR(255) NOT NULL UNIQUE,
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
user_email VARCHAR(255),
filename VARCHAR(255) NOT NULL,
file_size BIGINT NOT NULL,
file_hash VARCHAR(64) NOT NULL,
mime_type VARCHAR(100),
encrypted_link TEXT NOT NULL, -- AES-256-GCM encrypted Cloudinary links
cloudinary_public_id VARCHAR(255),
cloudinary_version INTEGER,
status VARCHAR(50) DEFAULT 'uploaded',
analysis_status VARCHAR(50) DEFAULT 'pending',
analysis_result JSONB,
prediction VARCHAR(50),
confidence DECIMAL(5, 4),
metadata JSONB DEFAULT '{}',
upload_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
analysis_timestamp TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE forensic_analysis (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
case_id VARCHAR(255) NOT NULL UNIQUE REFERENCES video_evidence(case_id),
analysis_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
analyst_id UUID REFERENCES users(id),
prediction VARCHAR(50) NOT NULL,
confidence DECIMAL(5, 4) NOT NULL,
preprocessing_results JSONB,
core_model_results JSONB,
postprocessing_results JSONB,
forensic_certificate TEXT,
chain_of_custody JSONB DEFAULT '{}',
legal_admissibility VARCHAR(50),
expert_recommendation TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE video_access_logs (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
case_id VARCHAR(255) NOT NULL,
user_id UUID REFERENCES users(id) ON DELETE SET NULL,
user_email VARCHAR(255),
action VARCHAR(100) NOT NULL,
ip_address VARCHAR(45),
user_agent TEXT,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);export interface VideoAnalysis {
id?: string
filename: string
file_size: number
prediction: 'real' | 'fake'
confidence: number
models_used: string[]
processing_time: number
analysis_result: any
created_at?: string
user_ip?: string
}- checkDuplicateFile(filename, fileSize) - Check if file was previously analyzed
- saveAnalysis(analysis) - Save new analysis result
- getAnalyticsStats() - Get overall statistics
- getRecentAnalyses(limit, offset, filter) - Get paginated recent analyses
- getAnalysisById(id) - Get single analysis by ID
- formatRelativeTime(dateString) - Format timestamps
- log_video_access() - Log video access for audit trail
- update_video_analysis() - Update analysis status and results
- Enabled on all sensitive tables
- Users can only access their own data
- Admin role has broader access
- Video Links: AES-256-GCM encryption for Cloudinary URLs
- Passwords: Bcrypt hashing (one-way)
- File Integrity: SHA-256 hashing for verification
- All video access logged with timestamps
- IP addresses and user agents tracked
- Actions logged: 'video_retrieved', 'video_downloaded', 'analysis_viewed'
/api/predict- Basic deepfake detection/api/predict-with-agents- Agent-enhanced analysis/api/predict-large-video- Large file processing/api/ondemand-webhook- OnDemand agent integration/api/upload-secure- Secure file upload with encryption/api/video-retrieve- Encrypted video retrieval
- Webhook URL:
https://gateway.on-demand.io/automation/public/v1/webhook/workflow/696aed8727b1bb913e89a2a9/execute - 6-Agent Workflow: 3 pre-processing + 3 post-processing agents
- Payload Format:
{"payload": data}
- Project: interceptor-4x4
- Node Version: 20.x
- Build Command:
vite build - Output Directory:
dist
VITE_SUPABASE_URL=https://rzgplzaytxronhcakemi.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJ6Z3BsemF5dHhyb25oY2FrZW1pIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjY4NzMxODAsImV4cCI6MjA4MjQ0OTE4MH0.6wxeRoi8ZnUmX4Vu86HKx4wWaiOJm_rPhXGrFKyEvyg
# Optional Security Variables:
ENCRYPTION_KEY=your_32_byte_hex_key
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
JWT_SECRET=your_jwt_secret- Primary Storage: Supabase PostgreSQL
- File Storage: Cloudinary (with encrypted links)
- Analytics: Real-time via Supabase functions
- Audit Trail: Complete access logging
- Database Schema: Preserve all table structures and relationships
- Encryption Keys: Maintain encryption compatibility for existing data
- API Compatibility: Ensure all existing endpoints continue working
- Security Policies: Maintain RLS and access controls
- Audit Trail: Preserve all historical access logs
- All video analysis results in
video_analysestable - Encrypted video links in
video_evidencetable - Complete audit trail in
video_access_logstable - User accounts and permissions in
userstable - Forensic certificates in
forensic_analysistable
- Indexed queries on frequently accessed columns
- JSONB storage for flexible analysis results
- Pagination for large result sets
- Caching for duplicate file detection
- Database can handle high concurrent reads
- Write operations are optimized for analysis results
- File storage is handled by Cloudinary CDN
- API endpoints are serverless (Vercel functions)
- End-to-end encryption for sensitive data
- Complete audit trail for legal compliance
- Row-level security for data isolation
- Secure file upload and retrieval
- Password hashing with bcrypt
- JWT-based authentication
- Chain of custody tracking
- Forensic certificate generation
- Legal admissibility assessment
- Expert recommendation documentation
- Audit log retention policies
Note: This context provides complete information for migrating the E-RAKSHA system while maintaining all security, functionality, and data integrity requirements.