Skip to main content

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

Metadata

Release files for phzyx-auth 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phzyx-auth 0.1.2
File Size Uploaded
phzyx_auth-0.1.2.tar.gz 43.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phzyx-auth 0.1.2
File Interpreter ABI Platform
phzyx_auth-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 90.5 kB

Release files / phzyx_auth-0.1.2.tar.gz

Download URL phzyx_auth-0.1.2.tar.gz
Size 43.1 kB
Tags Source
SHA-256 checksum
How to use checksums
497c60575bb24ecc08b00c1a07a990e69a69d4d3f610936a662dbe4394e3c3b3
BLAKE2b-256 checksum
How to use checksums
9fa2b322732d9cca24128ec1f1d2fe09977fe3d1d7f9e14b3cc4d72e74e518d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / phzyx_auth-0.1.2-py3-none-any.whl

Download URL phzyx_auth-0.1.2-py3-none-any.whl
Size 47.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88dc2326fba1517c57b871a577693d5632c8a7f5c6e2f0f13ad162ccbabc53d9
BLAKE2b-256 checksum
How to use checksums
ffbe18f7abc266188717b4bd01f9ae86b073cd42790fc4e1783b5b37b37091ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page