Skip to main content

Phzyx Auth — identity, sessions, JWT, API keys, RBAC. Docs: https://phzyx.xyz/forge/tutorials/auth

Project description

Phzyx Auth

Secure-by-default identity, sessions, JWT, API keys, and RBAC for Forge apps and AdminBoard.

This is an optional battery. Most apps start with:

uv add phzyx-forge
uv add 'phzyx-forge[auth]'
# or: uv add phzyx-auth

Full docs live on the website

PyPI is the install surface. Tutorials, production notes, and product context are on phzyx.xyz:

Auth tutorial https://phzyx.xyz/forge/tutorials/auth
Forge docs https://phzyx.xyz/forge
Getting started https://phzyx.xyz/forge/getting-started
Product home https://phzyx.xyz
Source https://github.com/phzyxyz/forge

After install → open phzyx.xyz/forge/tutorials/auth.


Install

uv add 'phzyx-forge[auth]'
# equivalent
uv add 'phzyx-auth[fastapi]'

Requires phzyx-forge (product wheel).


What you get (0.1)

Area Capability
Passwords Argon2id, policy min length
Sessions Opaque cookie sessions (hashed at rest), idle + absolute TTL
JWT HS256 access + rotating refresh
API keys phx_ prefix, scopes, list/revoke
RBAC Groups / permissions, Principal, guards
Lockout Failed-login counter + rate limits + audit log
Reset / change Forgot/reset (anti-enum), change password, revoke sessions
CSRF Double-submit cookie + X-CSRF-Token for session mutations
AdminBoard Permission bridge for staff UI
CLI phzyx-auth create-superuser

Pre-1.0: APIs may change. Prefer lockfiles.


Quick start (FastAPI)

from fastapi import Depends, FastAPI
from phzyx.auth import AuthConfig, AuthService, Principal
from phzyx.auth.adapters.fastapi import mount_auth, require_user

app = FastAPI()
svc = AuthService(
    config=AuthConfig(
        secret="use-PHZYX_AUTH_SECRET-32+bytes-in-prod!!",
        production=False,
        cookie_secure=False,
    )
)
mount_auth(app, svc)

@app.get("/private")
async def private(user: Principal = Depends(require_user)):
    return {"email": user.email}
phzyx-auth create-superuser --email admin@example.com --password 'longpassword1'

Full walkthrough: Auth tutorial.


Related

License

MIT · phzyx.xyz

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

phzyx_auth-0.1.1.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

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

phzyx_auth-0.1.1-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

Details for the file phzyx_auth-0.1.1.tar.gz.

File metadata

  • Download URL: phzyx_auth-0.1.1.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for phzyx_auth-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a13436230043b06e3361f8f64c1ad133eb6cb8e705d81fdd44c624e34209512a
MD5 73f59128d9ca4f88ca856f6107a77e34
BLAKE2b-256 82024340b3a66198ab9247c9829a9ef3399a29eabcd8de9f74e71d5a8f418159

See more details on using hashes here.

Provenance

The following attestation bundles were made for phzyx_auth-0.1.1.tar.gz:

Publisher: publish.yml on phzyxyz/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file phzyx_auth-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: phzyx_auth-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 47.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for phzyx_auth-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45358cdc1ba7f25b80e4f81ccaea6feb4ea8c138fd86e6b364fdbcbd553f44ec
MD5 9b911fa69af7b54d38c0a1a84e4b9d49
BLAKE2b-256 a54bd68e175d88b90a3136916683c1939491d5deb3659baa95f8e28dc83a8556

See more details on using hashes here.

Provenance

The following attestation bundles were made for phzyx_auth-0.1.1-py3-none-any.whl:

Publisher: publish.yml on phzyxyz/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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