A Flask application for handling biometric file uploads, encryption, and similarity checking.
- First Humanity Verification: Upload files, encrypt them at rest, store metadata, and notify GolemDB
- Similarity Check: Compare new files against previously stored user files using the similarity_check.sh script
- File Encryption: All uploaded files are encrypted using Fernet encryption
- GolemDB Integration: Automatic notifications to GolemDB for verification events
- Install Python dependencies:
pip install -r requirements.txt- Set environment variables (optional):
export GOLEMDB_BASE_URL=http://your-golemdb-server:8080python main.pyThe server will run on http://localhost:5000
POST /first_humanity_verification
Upload a file for first-time humanity verification.
Form Data:
file: The file to uploaduser_id: Unique user identifierexternal_kyc_document_id: External KYC document IDhumanity_score: Humanity verification score (float)
Example:
curl -X POST http://localhost:5000/first_humanity_verification \
-F "file=@profile.txt" \
-F "user_id=user123" \
-F "external_kyc_document_id=kyc456" \
-F "humanity_score=0.95"POST /similarity_check
Compare a new file against the previously stored file for a user.
Form Data:
file: The new file to compareuser_id: User identifier (must have a stored verification)
Example:
curl -X POST http://localhost:5000/similarity_check \
-F "file=@new_profile.txt" \
-F "user_id=user123"GET /verification_status/<user_id>
Get verification status for a specific user.
Example:
curl http://localhost:5000/verification_status/user123GET /health
Check server health status.
Example:
curl http://localhost:5000/health- Uploaded files: Stored temporarily in
/tmp/biometrics_uploads - Encrypted files: Stored in
/tmp/biometrics_encrypted - Metadata: Stored as JSON files alongside encrypted files
- File type validation (only .txt, .csv, .json allowed)
- File size limits (16MB maximum)
- Secure filename handling
- File encryption at rest using Fernet
- SHA-256 file hashing for integrity verification
The server automatically notifies GolemDB when:
- A first humanity verification is completed
- A similarity check is performed
Configure the GolemDB endpoint using the GOLEMDB_BASE_URL environment variable.
The server includes comprehensive error handling for:
- Missing files or parameters
- Invalid file types
- File size limits
- Encryption/decryption errors
- Similarity check script failures
- GolemDB communication errors
For development, the server runs in debug mode with auto-reload enabled.
- Flask 3.0.0
- Werkzeug 3.0.1
- cryptography 41.0.7
- requests 2.31.0
- python-dotenv 1.0.0