Skip to content

Fayelicious/KeyVerify_Discord_Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

101 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KeyVerify

A Secure Discord Bot for License Verification via Payhip

Python Version Discord Bot Ready

Invite bot to your Server

What is KeyVerify?

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.

Features

  • 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 RotationNew! Safely rotate encryption keys without losing data access.
  • Async CoreNew! 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).

Slash Command Overview

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.

Security Practices

  • 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.

Installation & Setup

  1. Clone the repo:
    git clone https://github.com/Fayelicious/KeyVerify/Discord/Bot.git

  2. Install dependencies:
    pip install -r requirements.txt

Generating the Encryption Key

KeyVerify uses secure encryption (Fernet) to store license keys. You must generate a secure key before running the bot.

Step-by-step (Beginner Friendly)

  1. 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=

  2. Set it in your .env file (see below).

Configuration (.env)

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

  1. Run the bot:
    python bot.py

Make sure your bot has required permissions: Manage Roles, Send Messages, and Read Message History.

🔄 Key Rotation (Security)

If you ever need to change your encryption key (e.g., for security reasons), you can do so without breaking your database.

  1. Generate a NEW key using the python command above.

  2. Add it to the front of your .env list, separated by a comma:
    ENCRYPTION_KEYS=NEW_KEY,OLD_KEY

  3. 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.

  4. Once the console says ✅ SECURITY ROTATION: Re-encrypted X records, you can safely remove the OLD_KEY from your .env file.

Project Status

KeyVerify is actively in development and used in live communities like Poodle's Discord. Feedback, contributions, and issue reports are always welcome!

Support & Contact

For help or to suggest a feature:

Discord: Fayelicious_

Built With:

  • disnake
  • aiohttp
  • asyncpg
  • cryptography
  • Python 3.11+

Legal for Hosted Bot

Link to hosted Bot

About

Keyverify is a Payhip License activation manager for Discord

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages