Skip to main content

PostgreSQL-native auth, permissions, versioned config, usage tracking, and job queues

Project description

postkit SDK

Python client for postkit.

Installation

pip install postkit

Usage

import psycopg
from postkit.authz import AuthzClient
from postkit.authn import AuthnClient

conn = psycopg.connect("postgresql://...")
cursor = conn.cursor()

# Authorization
authz = AuthzClient(cursor, namespace="my-app")
authz.grant("admin", resource=("repo", "api"), subject=("user", "alice"))
if authz.check(("user", "alice"), "read", ("repo", "api")):
    print("Access granted")

# Authentication
authn = AuthnClient(cursor, namespace="my-app")
user_id = authn.create_user("alice@example.com", password_hash="argon2...")
session_id = authn.create_session(user_id, token_hash="sha256...")

Requirements

  • PostgreSQL 14+
  • The postkit SQL schema installed in your database

See the main repository for SQL installation instructions.

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

postkit-0.2.0.tar.gz (184.9 kB view details)

Uploaded Source

Built Distribution

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

postkit-0.2.0-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file postkit-0.2.0.tar.gz.

File metadata

  • Download URL: postkit-0.2.0.tar.gz
  • Upload date:
  • Size: 184.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for postkit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7eb169fbd4dfd0d8a0ff2006eef7d6dccc1bbc45c52c4d1dbaca7ad2ed31dbe9
MD5 99f12a6c11bdf7f327601eca647d513e
BLAKE2b-256 e26ef40615e03d9b69c782ae12ed2a5b9113513319886b8cd00ff577b6ce9ac0

See more details on using hashes here.

Provenance

The following attestation bundles were made for postkit-0.2.0.tar.gz:

Publisher: release.yml on varunchopra/postkit

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

File details

Details for the file postkit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: postkit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for postkit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 879297a1b9a4426d24b5122ce757164edd09f2da596ef44b2903843ed9e7915b
MD5 86d50929ff3e66b22470abc1ed8740e4
BLAKE2b-256 55501acbf9346d0a75471b1d7b65ce8a050ab438a6c592c5f870a45e59361f2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for postkit-0.2.0-py3-none-any.whl:

Publisher: release.yml on varunchopra/postkit

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