Skip to content

Dj Waanverse Auth

PyPI version License Python Django

Overview

dj_waanverse_auth is a Django authentication package designed for modern applications, providing passwordless authentication using:

  • Magic login codes via email
  • Passkeys (WebAuthn)

It simplifies user authentication while maintaining enterprise-grade security.

Installation

Install the package via pip:

pip install dj-waanverse-auth

Add it to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "dj_waanverse_auth",
]

Add the middleware:

MIDDLEWARE = [
    ...
    "dj_waanverse_auth.middleware.auth.AuthCookieMiddleware",
]

Authentication Backends

Configure Django to use the custom authentication backends:

AUTHENTICATION_BACKENDS = [
    "django.contrib.auth.backends.ModelBackend",
    "dj_waanverse_auth.backends.AuthenticationBackend",
]

Django REST Framework Configuration

Set the default authentication classes:

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": (
        "dj_waanverse_auth.authentication.JWTAuthentication",
    ),
}

Waanverse Auth Config

Add Waanverse-specific configuration:

WAANVERSE_AUTH_CONFIG = {
    "PLATFORM_NAME": "My Platform",
    "BASIC_ACCOUNT_SERIALIZER": "path.to.BasicAccountSerializer",
    "PUBLIC_KEY_PATH": "path/to/public_key.pem",
    "PRIVATE_KEY_PATH": "path/to/private_key.pem",
    "WEBAUTHN_DOMAIN" = "example.com"
    "WEBAUTHN_RP_NAME" = "My App",
    "WEBAUTHN_ORIGIN" = "example.com",

}

More detailed configuration options are available in the Configuration Guide.

Email Backend (Required for Magic Codes)

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.example.com"
EMAIL_PORT = 587
EMAIL_HOST_USER = "your-email@example.com"
EMAIL_HOST_PASSWORD = "your-password"
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = "noreply@example.com"

Getting Started

After installation and configuration:

  1. Users can log in using magic codes sent to their email.
  2. Users can register and authenticate with passkeys for stronger security.

Built with ❤️ by Waanverse Labs Inc.

```