Skip to main content

Authentication system using Evrmore blockchain signatures

Project description

Evrmore Authentication

Evrmore Authentication

A secure wallet-based authentication system for Evrmore blockchain applications

License: MIT Python 3.7+ PyPI version

๐Ÿ“‹ Table of Contents

โœจ Overview

Evrmore Authentication is a Python package that provides wallet-based authentication using Evrmore signature verification. This allows users to authenticate to web applications using their Evrmore wallet without sharing their private keys, creating a secure and user-friendly authentication experience.

Key Features:

  • ๐Ÿ”‘ Wallet-based authentication - Users sign a challenge message with their Evrmore wallet
  • ๐Ÿ”’ JWT token management - Secure session handling with JSON Web Tokens
  • ๐Ÿ“ SQLite backend - Simple, file-based database for session and challenge storage
  • ๐Ÿ‘ค Automatic user management - Users are created on first authentication
  • ๐ŸŒ Complete API server - Ready-to-use FastAPI server for authentication endpoints
  • ๐Ÿ–ฅ๏ธ Demo web interface - Example Flask application showing the complete authentication flow

๐Ÿš€ Quick Start

Installation

pip3 install evrmore-authentication

Running the API Server

python3 -m scripts.run_api_server --host 0.0.0.0 --port 8000

Running the Web Demo

python3 -m scripts.run_web_demo --port 5000 --api-url http://localhost:8000

๐Ÿงฐ System Requirements

  • Python 3.7 or higher
  • SQLite database for session and challenge storage
  • Evrmore node (for signature verification)

๐Ÿ” Authentication Flow

1. Challenge Generation The server generates a unique challenge for the user's Evrmore address
2. Signature Creation The user signs the challenge with their Evrmore wallet
3. Verification The server verifies the signature against the challenge
4. Token Issuance Upon successful verification, a JWT token is issued
5. Authentication The token is used for subsequent API requests

๐Ÿ“˜ Usage in Your Application

Basic Authentication Flow

from evrmore_authentication import EvrmoreAuth
from evrmore_rpc import EvrmoreClient

# Initialize the authentication system with an Evrmore client
client = EvrmoreClient()
auth = EvrmoreAuth(client)

# Generate a challenge for a user's Evrmore address
challenge = auth.generate_challenge("EXaMPLeEvRMoReAddResS")

# Verify the signature provided by the user
session = auth.authenticate(
    evrmore_address="EXaMPLeEvRMoReAddResS",
    challenge=challenge,
    signature="signed_challenge_from_wallet"
)

# Use the token for authentication
token = session.token

# Validate a token
token_data = auth.validate_token(token)

# Get user from token
user = auth.get_user_by_token(token)

# Invalidate a token (logout)
auth.invalidate_token(token)

FastAPI Integration

The package includes a ready-to-use FastAPI server with the following endpoints:

Endpoint Method Description
/challenge POST Generate a challenge for a user
/authenticate POST Authenticate with a signed challenge
/validate GET Validate a JWT token
/me GET Get authenticated user information
/logout POST Invalidate a JWT token (logout)

โš™๏ธ Configuration

Configuration is done through environment variables or a .env file:

# SQLite configuration
SQLITE_DB_PATH=./data/evrmore_auth.db

# JWT configuration
JWT_SECRET=your-secure-secret-key
JWT_ALGORITHM=HS256
JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30

# Challenge configuration
CHALLENGE_EXPIRE_MINUTES=10

๐Ÿ“š Documentation

For more information, please see:

๐Ÿ’ป Development

Project Structure

evrmore-authentication/
โ”œโ”€โ”€ evrmore_authentication/    # Main package
โ”‚   โ”œโ”€โ”€ __init__.py            # Package initialization
โ”‚   โ”œโ”€โ”€ auth.py                # Core authentication logic
โ”‚   โ”œโ”€โ”€ api.py                 # FastAPI endpoints
โ”‚   โ”œโ”€โ”€ models.py              # Database models
โ”‚   โ”œโ”€โ”€ exceptions.py          # Custom exceptions
โ”‚   โ””โ”€โ”€ dependencies.py        # FastAPI dependencies
โ”œโ”€โ”€ scripts/                   # Utility scripts
โ”‚   โ”œโ”€โ”€ run_api_server.py      # API server runner
โ”‚   โ””โ”€โ”€ run_web_demo.py        # Web demo runner
โ”œโ”€โ”€ examples/                  # Example applications
โ”‚   โ”œโ”€โ”€ demo.py                # Simple CLI demo
โ”‚   โ””โ”€โ”€ web_auth_demo/         # Web application example
โ”œโ”€โ”€ tests/                     # Test suite
โ”œโ”€โ”€ docs/                      # Documentation
โ””โ”€โ”€ setup.py                   # Package setup

Setup Development Environment

git clone https://github.com/manticoretechnologies/evrmore-authentication.git
cd evrmore-authentication
pip3 install -e .

Running Tests

pytest

Building Documentation Locally

# Install MkDocs and the Material theme
pip3 install mkdocs-material

# Serve the documentation locally at http://127.0.0.1:8000
mkdocs serve

# Build the documentation
mkdocs build

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Contact

๐Ÿข Organization Manticore Technologies
๐ŸŒ Website manticore.technology
๐Ÿ“‚ GitHub github.com/manticoretechnologies
โœ‰๏ธ Email dev@manticore.technology

Built with โค๏ธ by Manticore Technologies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evrmore_authentication-0.3.0.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evrmore_authentication-0.3.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file evrmore_authentication-0.3.0.tar.gz.

File metadata

  • Download URL: evrmore_authentication-0.3.0.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for evrmore_authentication-0.3.0.tar.gz
Algorithm Hash digest
SHA256 353cafe2130fdfad2b54df60601a9090102571277e621b241522917dce916684
MD5 37d2c94142fbdbb1a618d1a936dfbdf0
BLAKE2b-256 db9bb0994bab7c3c8347379313923aa5fb20800788e858a01d3bf379659218d4

See more details on using hashes here.

File details

Details for the file evrmore_authentication-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for evrmore_authentication-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8216b0ca6e2174ab634e03e35c1ae518504d486af5ef66ca07f74555137aa95a
MD5 6f3e834a905c09c7ddd8c670c61e07e7
BLAKE2b-256 dddfbbcc80e2e6c605bb9fa31690afc8ccb326e9c3e5e0562d07b8eef2a27567

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page