KeyVerify is a lightweight and secure Discord bot for automating license verification of Payhip digital products. It helps creators manage customer access to Discord roles in a streamlined and encrypted way.
Recently updated to be fully asynchronous, it handles multiple requests efficiently without slowing down.
- License Verification – Secure and user-friendly verification via in-server modal.
- Auto Role Reassignment – Automatically reapply roles if a verified user rejoins.
- Product Management – Add, list, or remove products with optional auto-generated roles.
- License Reset – Reset usage count of a license for reactivations.
- Key Rotation – New! Safely rotate encryption keys without losing data access.
- Async Core – New! Built on aiohttp to prevent bot lag during API calls.
- Audit Logging – Track all verification attempts and role assignments.
- Spam Protection – Rate-limiting built-in to avoid abuse.
- Encrypted Storage – License keys and product secrets are safely encrypted using AES (Fernet).
| Command | Description |
|---|---|
| /start_verification | Deploys the verification interface to a channel. |
| /add_product | Add a new product with a secret and optional role. |
| /remove_product | Remove a product from the server list. |
| /list_products | View all products and their associated roles. |
| /reset_key | Reset usage for a license key on Payhip. |
| /set_lchannel | Define the channel for verification logs. |
| /remove_user | Revoke a user's access, delete DB entries, and disable licenses. |
| /help | Shows help message and support info. |
- License keys and secrets are AES-encrypted (Fernet) before storage.
- All commands are permission-locked to server owners or admins.
- Cooldown logic prevents excessive or abusive interactions.
- Optional logging ensures traceability in any server.
-
Clone the repo:
git clone https://github.com/Fayelicious/KeyVerify/Discord/Bot.git -
Install dependencies:
pip install -r requirements.txt
KeyVerify uses secure encryption (Fernet) to store license keys. You must generate a secure key before running the bot.
Step-by-step (Beginner Friendly)
-
Generate a secure key. Run this command in your terminal:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"This will output a secure key like:
WdIf6ZfNNuHrXkVvZBMyPZr7nqSItmGqM9dWBtZsKfs= -
Set it in your .env file (see below).
Create a .env file in the bot root:
DISCORD_TOKEN=your_discord_bot_token
PAYHIP_API_KEY=your_payhip_api_key
DATABASE_URL=your_postgres_connection_url
LOG_LEVEL=INFO
# Paste the key you generated above here:
ENCRYPTION_KEYS=YOUR_GENERATED_KEY_HERE
- Run the bot:
python bot.py
Make sure your bot has required permissions: Manage Roles, Send Messages, and Read Message History.
If you ever need to change your encryption key (e.g., for security reasons), you can do so without breaking your database.
-
Generate a NEW key using the python command above.
-
Add it to the front of your .env list, separated by a comma:
ENCRYPTION_KEYS=NEW_KEY,OLD_KEY -
Restart the bot.
* The bot will automatically detect the new key.
* It will scan the database on startup and re-encrypt all old data using the new key. -
Once the console says ✅ SECURITY ROTATION: Re-encrypted X records, you can safely remove the OLD_KEY from your .env file.
KeyVerify is actively in development and used in live communities like Poodle's Discord. Feedback, contributions, and issue reports are always welcome!
For help or to suggest a feature:
Discord: Fayelicious_
Built With:
- disnake
- aiohttp
- asyncpg
- cryptography
- Python 3.11+
Link to hosted Bot