A Discord bot that provides secure identity verification for Veyra. This system ensures only ID verified users enter Veyra with a unique method and flag.
- User Initiation: User runs
/verify <ckey>command in Discord - Limit Check: System checks if daily verification limit has been reached
- Session Creation: If under limit, creates iDenfy verification session
- Identity Verification: User completes document scan and facial recognition via iDenfy
- Webhook Processing: iDenfy sends verification result to webhook endpoint which is also hosted on this bot
- User Notification: User receives confirmation via Discord response.
- Data Deletion: Data is deleted from iDenfy's system leaving only a scanRef which we can use as proof of identification in the future.
- APPROVED: Document and facial verification passed all checks
- DENIED: Verification failed due to document or facial recognition issues
- EXPIRED: User did not complete verification within time limit
- SUSPECTED: Potential fraud detected, requires manual review
- Role Validation: Admin commands verify Discord role membership before execution
- Command Isolation: Regular users cannot access administrative functions
- Audit Logging: All admin actions logged to designated Discord channel
- Data Minimization: Only necessary identity data processed through iDenfy
- User Consent: Clear verification process with user-initiated actions
- Data Retention: iDenfy verification data is deleted immediately after processing
- Access Control: Admin commands restricted by Discord role permissions
- Node.js 16.0 or higher
- Discord bot token with appropriate permissions
- iDenfy API credentials (API key and secret)
- Setup instance of Veyra
- Public webhook endpoint accessible by iDenfy set in .env file
-
Clone and Install Dependencies
git clone https://github.com/Monkestation/Veyra-Bot/ cd veyra-bot npm install -
Create Required Directories
mkdir data
-
Configure Environment
- Create a copy of
.env.exampleand rename it to.env. Fill in the required values. - Ensure webhook endpoint is publicly accessible
- Configure Discord bot permissions (Send Messages, Use Slash Commands)
- Create a copy of
-
Start the Application
# Production mode npm start # Development mode with auto-restart npm run dev
/verify <ckey>: Initiates identity verification process for specified BYOND key/check-verification: Displays current verification status and processes completed verifications
/verify-debug <ckey>: Creates debug verification without iDenfy (admin only)
/test-verify <ckey> [status]: Creates dummy verification that auto-completes with specified result/simulate-webhook <scan_ref> [status]: Manually triggers webhook for existing pending verification/list-pending: Displays all currently pending verifications
The bot includes comprehensive testing utilities for development:
# Interactive testing menu
npm run test-idenfy
# Specific test scenarios
npm run test-approved # Test successful verification
npm run test-denied # Test failed verification
npm run test-webhook # Test webhook simulation only
# Command line testing
node test/standaloneTest.js approved <discord_id> <ckey>- Dummy Sessions: Creates real iDenfy sessions that auto-complete with specified results
- Webhook Simulation: Directly simulates iDenfy webhook calls to test processing
- End-to-End Testing: Complete verification flow with automated result processing
The bot expects these endpoints on veyra to be working API:
- POST
/api/auth/login: Authentication endpoint returning JWT token - GET
/api/analytics: Returns verification statistics including daily counts - POST
/api/v1/verify: Stores completed verification data - GET
/api/v1/verify/{discord_id}: Retrieves existing verification for user
- Endpoint:
POST /webhook/idenfy(configurable port via WEBHOOK_PORT) - Authentication: iDenfy webhook signatures (automatically handled)
- Processing: Real-time verification result processing with user notifications
DAILY_VERIFICATION_LIMIT: Maximum automatic verifications per day (default: 25)- Behavior: When exceeded, new verifications require manual admin approval
- Bypass: Admin debug commands ignore daily limits
WEBHOOK_PORT: Port for Express webhook server (default: 3001)- Public Access: Must be accessible by iDenfy servers for callbacks
- SSL: Recommended for production deployments
DEBUG: Enables detailed logging and test commands (default: false)- Test Commands: Additional slash commands for development testing
- Signal Handling: Responds to SIGINT and SIGTERM for clean shutdown
- Data Persistence: Forces final save of all pending verifications
- Connection Cleanup: Properly closes Discord and webhook connections
Bot fails to start
- Verify Discord token validity and bot permissions
- Check all required environment variables are set
- Ensure API credentials authenticate successfully
Verifications not processing
- Confirm webhook endpoint is publicly accessible
- Validate iDenfy API credentials and service status
- Check webhook server port configuration and firewall rules
Data not persisting
- Verify
data/directory exists and is writable - Check available disk space and file system permissions
- Review application logs for specific error messages
Users not receiving notifications
- Confirm bot has permission to send direct messages
- Check user privacy settings allow messages from server members
- Verify Discord client connection stability
- Logs are located in the
logsfolder, - Veyra uses a json file to keep track of pending verifications across bot restarts, so data isn't lost, @
data/pending_verifications.json