|
1 | 1 | # FileShotZKE |
2 | 2 | ZKE method |
| 3 | + |
| 4 | +# FileShot Zero-Knowledge Encryption |
| 5 | + |
| 6 | +**Open-source zero-knowledge encryption implementation using Web Crypto API** |
| 7 | + |
| 8 | +This repository contains the client-side encryption code that powers FileShot.io's zero-knowledge encryption feature. Files are encrypted entirely in your browser before upload, ensuring that even FileShot's servers cannot decrypt your files. |
| 9 | + |
| 10 | +## 🔒 What is Zero-Knowledge Encryption? |
| 11 | + |
| 12 | +Zero-knowledge encryption means that **we cannot decrypt your files**, even if we wanted to. The encryption happens entirely in your browser using the Web Crypto API, and we never receive your encryption key or password. |
| 13 | + |
| 14 | +### Key Features |
| 15 | + |
| 16 | +- ✅ **AES-256-GCM encryption** - Industry-standard encryption algorithm |
| 17 | +- ✅ **PBKDF2 key derivation** - 100,000 iterations for password-based key derivation |
| 18 | +- ✅ **Client-side only** - All encryption happens in your browser |
| 19 | +- ✅ **No server access** - We cannot decrypt your files, even with a court order |
| 20 | +- ✅ **Open source** - Review the code yourself |
| 21 | + |
| 22 | +## 🚀 Quick Start |
| 23 | + |
| 24 | +### Try the Demo |
| 25 | + |
| 26 | +1. Open `demo.html` in your browser |
| 27 | +2. Select a file and encrypt it |
| 28 | +3. Download the encrypted file |
| 29 | +4. Decrypt it with the same password |
| 30 | + |
| 31 | +### Use in Your Project |
| 32 | + |
| 33 | +```html |
| 34 | +<script src="zero-knowledge.js"></script> |
| 35 | +<script> |
| 36 | + // Encrypt a file |
| 37 | + const fileInput = document.getElementById('fileInput'); |
| 38 | + const file = fileInput.files[0]; |
| 39 | + const password = 'your-secure-password'; |
| 40 | + |
| 41 | + const result = await window.zeroKnowledgeEncrypt(file, password); |
| 42 | + // result.encryptedBlob - encrypted file ready to upload |
| 43 | + // result.metadata - file metadata (name, size, type) |
| 44 | + |
| 45 | + // Decrypt a file |
| 46 | + const decryptedBlob = await window.zeroKnowledgeDecrypt( |
| 47 | + encryptedBlob, |
| 48 | + password, |
| 49 | + originalFileName, |
| 50 | + originalFileType |
| 51 | + ); |
| 52 | +</script> |
| 53 | +``` |
| 54 | + |
| 55 | +## 📖 How It Works |
| 56 | + |
| 57 | +1. **Key Generation**: Your browser generates a random salt and derives an encryption key from your password using PBKDF2 |
| 58 | +2. **Encryption**: Your file is encrypted using AES-256-GCM before upload |
| 59 | +3. **Upload**: Only the encrypted data is sent to FileShot's servers |
| 60 | +4. **Storage**: We store encrypted blobs that we cannot decrypt |
| 61 | +5. **Download**: Recipients decrypt files in their browser using the password you shared |
| 62 | + |
| 63 | +## 🔐 Security Details |
| 64 | + |
| 65 | +- **Algorithm**: AES-256-GCM (Galois/Counter Mode) |
| 66 | +- **Key Derivation**: PBKDF2 with SHA-256 |
| 67 | +- **Iterations**: 100,000 (recommended for 2025) |
| 68 | +- **Salt Length**: 16 bytes (128 bits) |
| 69 | +- **IV Length**: 12 bytes (96 bits) for GCM |
| 70 | +- **Key Length**: 256 bits |
| 71 | + |
| 72 | +## 📁 File Structure |
| 73 | + |
| 74 | +``` |
| 75 | +fileshot-zke/ |
| 76 | +├── zero-knowledge.js # Main encryption implementation |
| 77 | +├── demo.html # Interactive demo page |
| 78 | +├── README.md # This file |
| 79 | +└── LICENSE # MIT License |
| 80 | +``` |
| 81 | + |
| 82 | +## 🧪 Testing |
| 83 | + |
| 84 | +Open `demo.html` in a modern browser to test the encryption implementation. The demo allows you to: |
| 85 | + |
| 86 | +- Encrypt files with a password |
| 87 | +- Download encrypted files |
| 88 | +- Decrypt files with the correct password |
| 89 | +- Verify that incorrect passwords fail |
| 90 | + |
| 91 | +## 📝 API Reference |
| 92 | + |
| 93 | +### `zeroKnowledgeEncrypt(file, password)` |
| 94 | + |
| 95 | +Encrypts a file in the browser. |
| 96 | + |
| 97 | +**Parameters:** |
| 98 | +- `file` (File/Blob): The file to encrypt |
| 99 | +- `password` (string): Encryption password |
| 100 | + |
| 101 | +**Returns:** Promise resolving to: |
| 102 | +```javascript |
| 103 | +{ |
| 104 | + encryptedBlob: Blob, // Encrypted file data |
| 105 | + metadata: { // File metadata (not encrypted) |
| 106 | + originalName: string, |
| 107 | + originalSize: number, |
| 108 | + originalType: string, |
| 109 | + encryptedSize: number |
| 110 | + } |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +### `zeroKnowledgeDecrypt(encryptedBlob, password, originalName, originalType)` |
| 115 | + |
| 116 | +Decrypts a file in the browser. |
| 117 | + |
| 118 | +**Parameters:** |
| 119 | +- `encryptedBlob` (Blob): Encrypted file data |
| 120 | +- `password` (string): Decryption password |
| 121 | +- `originalName` (string): Original filename |
| 122 | +- `originalType` (string): Original MIME type |
| 123 | + |
| 124 | +**Returns:** Promise resolving to a Blob containing the decrypted file. |
| 125 | + |
| 126 | +## ⚠️ Important Security Notes |
| 127 | + |
| 128 | +1. **Password Strength**: Use a strong, unique password for each file |
| 129 | +2. **Password Sharing**: Share passwords through a secure channel (not via FileShot) |
| 130 | +3. **Password Loss**: If you lose your password, the file cannot be recovered |
| 131 | +4. **Browser Security**: Ensure your browser and system are secure and up-to-date |
| 132 | +5. **HTTPS Only**: Only use this on HTTPS connections in production |
| 133 | + |
| 134 | +## 🔍 Verification |
| 135 | + |
| 136 | +This code is used by FileShot.io. You can verify: |
| 137 | + |
| 138 | +1. The code served on FileShot.io matches this repository |
| 139 | +2. Encryption happens client-side (check Network tab in DevTools) |
| 140 | +3. The encryption key never leaves your browser |
| 141 | + |
| 142 | +## 📄 License |
| 143 | + |
| 144 | +MIT License - See [LICENSE](LICENSE) file for details. |
| 145 | + |
| 146 | +## 🤝 Contributing |
| 147 | + |
| 148 | +We welcome security reviews and improvements! Please: |
| 149 | + |
| 150 | +1. Fork the repository |
| 151 | +2. Review the code |
| 152 | +3. Submit issues or pull requests |
| 153 | +4. Report security vulnerabilities responsibly |
| 154 | + |
| 155 | +## 🔒 Security Policy |
| 156 | + |
| 157 | +If you discover a security vulnerability, please email **fileshot.adm@gmail.como** instead of opening a public issue. |
| 158 | + |
| 159 | +## 📞 Contact |
| 160 | + |
| 161 | +- **Website**: [FileShot.io](https://fileshot.io) |
| 162 | +- **Verification Page**: [Verify Encryption](https://fileshot.io/verify-encryption.html) |
| 163 | + |
| 164 | +## ✅ Browser Support |
| 165 | + |
| 166 | +This implementation uses the Web Crypto API, which is supported in: |
| 167 | + |
| 168 | +- Chrome 37+ |
| 169 | +- Firefox 34+ |
| 170 | +- Safari 11+ |
| 171 | +- Edge 12+ |
| 172 | +- Opera 24+ |
| 173 | + |
| 174 | +## 🙏 Acknowledgments |
| 175 | + |
| 176 | +Built using the Web Crypto API, which provides secure cryptographic primitives in modern browsers. |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +**Remember**: This is client-side encryption code. The security of your files depends on: |
| 181 | +- Using a strong password |
| 182 | +- Keeping your password secret |
| 183 | +- Using a secure browser and system |
| 184 | +- Verifying you're on the real FileShot.io domain (check SSL certificate) |
| 185 | + |
0 commit comments