FLASH-4/Authcorp
GitHub: FLASH-4/Authcorp
基于 AI 视觉分析与区块链锚定技术的一站式文档真伪验证与反欺诈取证平台。
Stars: 0 | Forks: 0
# AuthCorp — AI 驱动的文档验证平台





**在线演示:** [authcorp.vercel.app](https://authcorp.vercel.app)
## 什么是 AuthCorp?
AuthCorp 是一个下一代取证文档验证平台,利用 AI 视觉、区块链锚定和多检测器取证分析,实时检测伪造、篡改和 AI 生成的文档。
本项目为 B.Tech 毕业设计项目。
## 功能
| 功能 | 描述 |
|---------|-------------|
| 🔍 **AI 取证分析** | GPT-4o-mini Vision 分析每个上传的文档 — 返回真实性评分、热力图区域、元数据线索 |
| 📸 **实时 AR 文档扫描仪** | WebRTC 摄像头实时画面 + 实时帧捕获 + 带 AR 叠加框的即时 AI 分析 |
| 🔗 **区块链锚定** | 通过 Infura 将文档 SHA-256 哈希锚定到 Ethereum/Polygon — 创建防篡改的时间戳证明 |
| 🗺️ **篡改热力图** | 可视化网格,按类型(文本修改、复制移动、压缩异常)以颜色编码显示可疑区域 |
| 📋 **元数据取证** | EXIF 数据提取、编辑软件检测、字体不一致分析 |
| 🤖 **AI 取证助手** | 由 OpenAI GPT-3.5-turbo 提供支持,具备完整文档上下文感知的聊天功能 |
| 🛡️ **风险情报** | 制裁筛选、欺诈模式检测、带有证据链的风险评分 |
| 📊 **实时仪表盘** | 实时深度伪造计数器、真实性比率、近期活动动态 |
| 🔐 **安全认证** | JWT 会话 + Google OAuth 2.0 |
| 🚨 **威胁模拟** | 使用模拟攻击场景测试系统 |
## 技术栈
```
Frontend: Next.js 14 · React 18 · TypeScript · Tailwind CSS · Framer Motion
AI: OpenAI GPT-4o-mini Vision · GPT-3.5-turbo
Blockchain: Ethereum + Polygon via Infura JSON-RPC
Auth: JWT · Google OAuth 2.0
Database: PostgreSQL (Neon) · Redis (Upstash)
Deployment: Vercel (serverless)
Camera: WebRTC · HTML5 Canvas API
```
## 快速开始
### 1. 克隆并安装
```
git clone https://github.com/YOUR_USERNAME/authcorp.git
cd authcorp
npm install
```
### 2. 设置环境变量
```
cp .env.local .env.local.bak
```
使用你的 API 密钥编辑 `.env.local`:
```
# 安全 (生成方式: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))")
JWT_SECRET=your_64_char_secret
ENCRYPTION_KEY=your_32_char_key
SESSION_SECRET=your_random_secret
# Google OAuth — console.cloud.google.com
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_client_id.apps.googleusercontent.com
# OpenAI — platform.openai.com (免费 $5 额度)
OPENAI_API_KEY=sk-your_key
# Infura/MetaMask — developer.metamask.io (免费套餐)
ETHEREUM_RPC_URL=https://mainnet.infura.io/v3/YOUR_PROJECT_ID
POLYGON_RPC_URL=https://polygon-mainnet.infura.io/v3/YOUR_PROJECT_ID
# Database — neon.tech (免费套餐)
DATABASE_URL=postgresql://user:pass@host/authcorp?sslmode=require
# Redis — upstash.com (免费套餐)
REDIS_URL=rediss://default:password@host.upstash.io:6379
# Feature flags
ENABLE_BLOCKCHAIN_ANCHORING=true
ENABLE_AI_ASSISTANT=true
ENABLE_REAL_TIME_MONITORING=true
NODE_ENV=development
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:3000/api
```
### 3. 运行
```
npm run dev
```
打开 [http://localhost:3000](http://localhost:3000)
**演示凭据:** `admin@authcorp.com` / `admin123`
## 免费 API 密钥设置
| 服务 | URL | 免费额度 |
|---------|-----|-----------|
| OpenAI | [platform.openai.com](https://platform.openai.com) | $5 免费额度 |
| Google OAuth | [console.cloud.google.com](https://console.cloud.google.com) | 永久免费 |
| Infura (Blockchain) | [developer.metamask.io](https://developer.metamask.io) | 每月 300 万次请求 |
| Neon (PostgreSQL) | [neon.tech](https://neon.tech) | 512MB 免费 |
| Upstash (Redis) | [upstash.com](https://upstash.com) | 每月 50 万条命令 |
## 项目结构
```
authcorp/
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ ├── assistant/ask/ # AI assistant (OpenAI GPT-3.5)
│ │ │ ├── auth/ # Login, logout, Google OAuth
│ │ │ ├── blockchain/ # Blockchain anchoring (Infura)
│ │ │ └── documents/
│ │ │ ├── analyze/ # Document analysis pipeline
│ │ │ └── vision-analyze/ # GPT-4o-mini Vision API
│ │ ├── ar-forensics/ # Live document scanner page
│ │ ├── login/ # Auth page
│ │ └── page.tsx # Main dashboard
│ ├── components/
│ │ ├── forensics-provider.tsx # Global analysis state
│ │ ├── forensic-analysis.tsx # Forensic tabs (Overview/Heatmap/Metadata/Text)
│ │ ├── risk-intelligence.tsx # Risk screening
│ │ ├── dashboard.tsx # Main dashboard
│ │ ├── document-upload.tsx # Upload interface
│ │ ├── futuristic-features.tsx # AR Scanner, Blockchain, AI Assistant
│ │ └── header.tsx # Live stats header
│ └── lib/
│ ├── blockchain-config.ts # Network definitions
│ ├── document-classifier.ts # Document type detection
│ ├── security.ts # JWT, encryption, audit logging
│ └── ai-detection.ts # AI detection engine
├── services/ # Python microservices (Docker)
│ ├── detectors/ela/ # Error Level Analysis
│ ├── detectors/metadata/ # EXIF metadata analysis
│ ├── detectors/quantization/ # DCT quantization analysis
│ ├── fusion/ # Multi-detector result fusion
│ ├── ingest/ # File ingestion service
│ ├── ocr/ # Tesseract OCR
│ └── risk/ # Risk intelligence service
├── sql/init.sql # PostgreSQL schema
├── docker-compose.yml # Full stack Docker setup
└── vercel.json # Vercel deployment config
```
## 文档分析的工作原理
```
User uploads document
↓
FileReader converts to base64
↓
GPT-4o-mini Vision API analyses image
↓
Returns: authenticity score, document type,
heatmap regions, metadata clues,
extracted text, reasoning
↓
Results displayed across 5 tabs:
Overview · Heatmap · Metadata · Text Analysis · Comparison
↓
If score < 60% → Deepfake counter increments
If blocked → Security alert shown
↓
Optional: Anchor SHA-256 hash to blockchain
```
## 区块链锚定
AuthCorp 使用**基于见证者的锚定**方法:
1. 在客户端计算文档的 SHA-256 哈希值
2. 在 Infura 上调用 `eth_blockNumber` 获取最新区块
3. 通过 `eth_getBlockByNumber` 获取区块哈希和时间戳
4. 创建确定性锚定 ID:`SHA256(network:docHash:blockHash)`
5. 可在 [Etherscan](https://etherscan.io) / [Polygonscan](https://polygonscan.com) 上验证区块号
这证明了该文档在特定时间点存在并已被验证,而无需在链上存储任何个人数据。
## 部署
[](https://vercel.com/new/clone?repository-url=https://github.com/YOUR_USERNAME/authcorp)
在 Vercel → Project → Settings → Environment Variables 中添加所有环境变量,然后进行部署。
## 演示凭据
| 角色 | 电子邮箱 | 密码 |
|------|-------|----------|
| 管理员 | admin@authcorp.com | admin123 |
| 调查员 | investigator@authcorp.com | investigator123 |
| 分析师 | analyst@authcorp.com | analyst123 |
或者使用 **Continue with Google**(需在设置 Google OAuth 之后)。
## 许可证
MIT 许可证 — 出于教育目的构建的 B.Tech 毕业设计项目。标签:AI文档验证, CCPA, EXIF数据分析, GDPR, GNU通用公共许可证, GPT-3.5, GPT-4, HIPAA, Infura, Node.js, OCR取证, OpenAI, Polygon, PostgreSQL, React, SaaS平台, SHA-256, Syscalls, TypeScript, WebRTC, 人工智能视觉, 以太坊, 元数据分析, 内存规避, 区块链存证, 合规, 增强现实(AR), 安全插件, 搜索引擎查询, 数字取证, 文件篡改检测, 欺诈检测, 毕业设计, 测试用例, 深度伪造检测, 综合情报, 网络摄像头, 自动化攻击, 自动化脚本, 计算机视觉, 请求拦截, 逆向工具, 防伪, 防御绕过, 风险控制