hashdrop
HashDrop is a secure, peer-to-peer file transfer application built with Next.js and WebRTC, enabling direct, end-to-end encrypted file sharing between devices with no cloud storage, no tracking, and no data retention.
HashDrop ๐
A secure, peer-to-peer file transfer application built with Next.js and WebRTC. Share files directly between devices at lightspeed. No cloud, no limits, no tracking.
โจ Features
๐ Security & Privacy
- End-to-End Encryption: WebRTC DTLS/SRTP encryption (same as Zoom, Google Meet)
- SHA-256 File Verification: Cryptographic hashing ensures file integrity
- No Cloud Storage: Files never touch our servers or any cloud storage
- Zero Data Retention: No logs, no tracking, no metadata storage
- Code-Based Access Control: Only the person with the unique code can access files
- Single Connection Limit: Prevents unauthorized access even if code is leaked
- 5-Minute Code Expiry: Transfer codes automatically expire for security
โก Performance & Reliability
- Direct P2P Transfer: Files stream directly between devices via WebRTC
- Real-time Progress: Live progress tracking with speed and ETA
- Automatic Download: Files download automatically when transfer completes
- Duplicate Chunk Protection: Ensures data integrity during transfer
- File Size Validation: Supports files up to 10GB with built-in DoS protection
- Resumable Transfers: Robust chunk-based transfer system
๐จ User Experience
- Human-Readable Codes: Easy-to-share transfer codes (e.g., "Cosmic-Falcon")
- QR Code Sharing: Instant connection via QR code scanning
- Dynamic OG Images: Beautiful link previews with transfer codes for Discord, Twitter, etc.
- Auto-Copy Toggle: Optional clipboard auto-copy (privacy-first)
- Transfer History: Track your recent transfers with statistics
- Image Preview: Preview images before downloading
- Keyboard Shortcuts: Fast navigation with keyboard commands
- Responsive Design: Works seamlessly on desktop and mobile
๐ Zero Friction
- No Account Required: Completely anonymous, no signup
- No Installation: Works directly in the browser
- Cross-Platform: Works on any device with a modern browser
- Text Sharing: Share text and links instantly
๐ก๏ธ Security Enhancements (Latest)
Critical Security Fixes
โ Multi-Connection Prevention: Only the first peer can connect, preventing unauthorized access
โ Enhanced Code Entropy: 6,400 possible combinations (80ร80) vs previous 1,600
โ Duplicate Chunk Detection: Protects against data corruption attacks
โ File Size Limits: 10GB maximum file size to prevent DoS
โ Chunk Count Limits: Maximum 1M chunks to prevent memory exhaustion
โ Input Validation: All user inputs sanitized and validated (XSS protection)
โ OG Image Security: Transfer code parameters validated in Open Graph images
Privacy-First Design
โ Auto-Copy Disabled by Default: Clipboard permission only requested when user enables it
โ Transparent Security: Detailed "How Does It Work?" section educates users
โ Warning Messages: Clear warnings about code sharing best practices
๐ Tech Stack
| Category | Technology |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack) |
| Language | TypeScript 5 |
| P2P | PeerJS 1.5.4 (WebRTC wrapper) |
| State | Zustand 5.0.2 |
| Styling | Tailwind CSS v4.1 |
| Animations | Framer Motion 12.23 |
| UI Components | Lucide React (icons), Sonner (toasts) |
| File Handling | JSZip, React Dropzone |
| Charts | Recharts 3.6 |
| Testing | Jest 29, React Testing Library 16 |
๐ฆ Getting Started
Prerequisites
- Node.js 18+ and npm
Installation
-
Clone the repository:
git clone https://github.com/metesahankurt/hashdrop.git cd hashdrop -
Install dependencies:
npm install -
Run the development server:
npm run dev -
Open in browser:
- Go to http://localhost:3000
- Open in two different browsers (e.g., Chrome and Firefox) to test file transfer locally
Build for Production
npm run build
npm run start
๐งช Testing
Run unit tests:
npm run test
Run tests in watch mode:
npm run test:watch
Generate coverage report:
npm run test:coverage
๐ Project Structure
hashdrop/
โโโ src/
โ โโโ app/ # Next.js App Router
โ โ โโโ layout.tsx # Root layout with metadata
โ โ โโโ page.tsx # Home page
โ โ โโโ api/
โ โ โ โโโ og/ # Open Graph image generation
โ โ โโโ privacy/ # Privacy policy page
โ โ โโโ terms/ # Terms of service page
โ โ
โ โโโ components/
โ โ โโโ layout/ # Layout components
โ โ โ โโโ minimal-header.tsx # Header with logo
โ โ โ โโโ hamburger-menu.tsx # Settings menu
โ โ โ
โ โ โโโ transfer/ # Core transfer logic
โ โ โ โโโ connection-manager.tsx # P2P connection & codes (730 lines)
โ โ โ โโโ transfer-status.tsx # Progress tracking (430 lines)
โ โ โ โโโ warp-dropzone.tsx # File upload
โ โ โ โโโ text-share.tsx # Text/link sharing
โ โ โ โโโ qr-code-display.tsx # QR code generation
โ โ โ
โ โ โโโ ui/ # UI components
โ โ โโโ transfer-history.tsx # Transfer history modal
โ โ โโโ statistics-dashboard.tsx # Statistics panel
โ โ โโโ image-preview-modal.tsx # Image preview
โ โ โโโ info-section.tsx # Informational content
โ โ โโโ keyboard-shortcuts-modal.tsx
โ โ
โ โโโ lib/ # Utilities
โ โ โโโ code-generator.ts # Secure code generation
โ โ โโโ file-hash.ts # SHA-256 hashing
โ โ โโโ file-utils.ts # File helpers
โ โ โโโ storage.ts # LocalStorage management
โ โ โโโ preferences.ts # User preferences
โ โ โโโ notifications.ts # Browser notifications
โ โ โโโ error-handler.ts # Error handling
โ โ โโโ animations.ts # Framer Motion configs
โ โ โโโ zip-utils.ts # Multi-file compression
โ โ
โ โโโ store/
โ โโโ use-warp-store.ts # Zustand global state
โ
โโโ __tests__/ # Jest unit tests
โโโ public/ # Static assets
โโโ package.json
๐ How It Works
Transfer Flow
1. SENDER
โ
Drops file โ Generates unique code (e.g., "Cosmic-Falcon")
โ
Code displayed with QR code
โ
Shares code via secure channel (WhatsApp, Signal, email)
โ
Waits for receiver to connect
2. RECEIVER
โ
Enters code or scans QR code
โ
Clicks "Connect"
3. PEER CONNECTION (via PeerJS)
โ
Both peers connect to signaling server (only for discovery)
โ
WebRTC establishes direct encrypted connection (DTLS/SRTP)
โ
Signaling server no longer involved
4. FILE TRANSFER
โ
Sender calculates SHA-256 hash
โ
Sends metadata (filename, size, hash)
โ
File split into 16KB chunks (base64 encoded)
โ
Chunks sent with index numbers
โ
Receiver reassembles chunks in order
โ
Receiver calculates SHA-256 hash
โ
Hash verification (match = success โ
)
โ
Auto-download triggers (if enabled)
Security Layers
| Layer | Technology | Purpose |
|---|---|---|
| Transport | WebRTC DTLS | Encrypts data in transit |
| Data Channel | SRTP | Secure real-time protocol |
| Integrity | SHA-256 | Detects tampering/corruption |
| Access Control | Unique Codes | Prevents unauthorized access |
| Connection Limit | Single Peer | Blocks multi-recipient attacks |
| Privacy | No Logging | Zero data retention |
๐ฏ Key Features Explained
1. Code Generation
- Format: Adjective-Noun (e.g., "Cosmic-Falcon", "Stellar-Phoenix")
- Entropy: 12.6 bits (6,400 combinations)
- Random Source: Web Crypto API (cryptographically secure)
- Expiry: 5 minutes automatic expiration
2. File Transfer Protocol
- Chunk Size: 16KB per chunk
- Encoding: Base64 for binary data
- Ordering: Index-based reassembly
- Verification: SHA-256 hash check
3. Security Mechanisms
- Single Connection: Only first peer accepted
- Duplicate Rejection: Chunks validated by index
- Size Limits: 10GB max file size
- Chunk Limits: 1M chunks maximum
- Hash Mismatch: Transfer rejected if hash fails
4. User Preferences
- Auto-Copy Code: Optional (default: OFF)
- Auto-Download: Optional (default: ON)
- Error Notifications: Optional (default: ON)
โ๏ธ Configuration
Environment Variables
No environment variables required! HashDrop is 100% client-side.
User Preferences
Accessible via hamburger menu (top-right):
- Auto-copy Code: Automatically copy transfer codes to clipboard
- Auto-download Files: Automatically download files when transfer completes
- Error Notifications: Show browser notifications for errors
Keyboard Shortcuts
Cmd/Ctrl + K: Toggle transfer historyCmd/Ctrl + S: Toggle statistics dashboardCmd/Ctrl + ?: Show keyboard shortcutsESC: Close all modals
๐ Known Limitations
- NAT Traversal: Some restrictive firewalls may block WebRTC connections (TURN server not configured)
- Browser Compatibility: Requires modern browser with WebRTC support
- File Size: Practical limit ~10GB (browser memory constraints)
- Connection: Both users must be online simultaneously
๐ค Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐จโ๐ป Author
Mete ลahan Kurt
- ๐ Portfolio: metesahankurt.cloud
- ๐ผ LinkedIn: linkedin.com/in/mete-sahan-kurt
- ๐ GitHub: github.com/metesahankurt
๐ Acknowledgments
- PeerJS: Simplified WebRTC wrapper
- Next.js: Amazing React framework
- Tailwind CSS: Utility-first CSS framework
- Framer Motion: Beautiful animations
- Vercel: Hosting and deployment
๐ฎ Roadmap
- End-to-end file encryption (AES-256)
- Password-protected transfers
- TURN server configuration (better NAT traversal)
- Transfer resume capability
- Mobile app (React Native)
- Batch file compression optimization
- Custom branding options
๐ Statistics
- Code Entropy: 12.6 bits (6,400 combinations)
- Max File Size: 10GB
- Chunk Size: 16KB
- Code Expiry: 5 minutes
- Encryption: DTLS/SRTP (AES-128/256)
- Hash Algorithm: SHA-256
Made with โค๏ธ by Mete ลahan Kurt
โญ Star this repo if you found it useful!
Live Demo โข Report Bug โข Request Feature