Skip to main content

A library for password hashing and JWT encoding

Project description

Pytography

A Python library that provides secure password hashing and JSON Web Token (JWT) functionality.

Installation

pip install pytography

Quick Start

Password Hashing with Scrypt (Default)

from pytography import PasswordHashLibrary

encoded_password = PasswordHashLibrary.encode(password="password")
is_valid = PasswordHashLibrary.verify(password="password", encoded_password=encoded_password)

Password Hashing with PBKDF2

from pytography import PasswordHashLibrary

encoded_password = PasswordHashLibrary.encode(password="password", algorithm="pbkdf2")
is_valid = PasswordHashLibrary.verify(password="password", encoded_password=encoded_password)

JSON Web Token (JWT)

from pytography import JsonWebToken
from datetime import datetime, timedelta, UTC

now = datetime.now(UTC)
exp = (now + timedelta(seconds=7200)).timestamp()

# Create a token
token = JsonWebToken.encode(payload={"exp": exp, "user_id": 123}, key="key")

# Decode token to get payload
header, payload, signature = JsonWebToken.decode(token=token)

# Verify token
is_valid = JsonWebToken.verify(token=token, key="key")

License

This project is licensed under the terms of the LICENSE file included in the repository.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

pytography-0.1.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

pytography-0.1.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytography-0.1.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytography-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7d8ed7b513d7413c3494e9bbf2b0152c8bc7699110dab26301df96c4f74b9e53
MD5 2c5072ee2fca619556bb8c6c41c993fc
BLAKE2b-256 550af6bff783f362e13497395882331b87580481d22ab0b4819791516a507148

See more details on using hashes here.

Provenance

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

Publisher: deploy.yml on TalentGate/pytography

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

File details

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

File metadata

  • Download URL: pytography-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytography-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2d959987c97a7c9a008a9c466c76c0a707185ae227d140bc6a6a3dc689deb513
MD5 ff6d3751758c54e8d59134e4c50e581a
BLAKE2b-256 02bdabe4e0f0c8337c9edb3e9e8daf16fe032ebd386e54883a5193415789cef2

See more details on using hashes here.

Provenance

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

Publisher: deploy.yml on TalentGate/pytography

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