Skip to main content

Platform-Agnostic Security Tokens for Python

Project description

python-paseto

Platform-Agnostic Security Tokens for Python

Build Status test-workflow PyPI version Coverage Status Language grade: Python Code style: black

Installation

pip install python-paseto

Check installation

python -m paseto

libsodium is required, this will check if it is installed on your system. On Ubuntu 20.04 you can get it with sudo apt install libsodium23.

Low level API

Implements PASETO V2 encrypt / decrypt / sign / verify functions, supports both v2.local and v2.public messages. Low level API is focuses on solid, high quality, production ready primitives as specified directly in the PASETO protocol. See paseto-spec for protocol details.

Example use

from paseto.protocol.version2 import Version2

message = b"foo" # your data
key = b"0" * 32  # encryption key

token = Version2.encrypt(message, key)
plain_text = Version2.decrypt(token, key)

assert plain_text == message
print(f"token={token}")
print(f"plain_text={plain_text}")
print(f"message={message}")

With optional footer

from paseto.protocol.version2 import Version2

message = b"foo" # your data
key = b"0" * 32  # encryption key
optional_footer = b"sample_footer" # authenticated but not encrypted metadata

token = Version2.encrypt(message, key, optional_footer)
plain_text = Version2.decrypt(token, key, optional_footer)

assert plain_text == message
print(f"token={token}")
print(f"plain_text={plain_text}")
print(f"message={message}")

High level API

In the future a high level API will provide developer friendly access to low level API and support easy integration into other projects.

Development

Typical dev workflow operations are automated in Makefile, including testing, linting, code quality checks, benchmarks and dev environment setup.

Contributing

This library is under active development and maintenance. For any feedback, questions, comments or if you would like to request a feature, please raise an issue!

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

python-paseto-0.4.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

python_paseto-0.4.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file python-paseto-0.4.0.tar.gz.

File metadata

  • Download URL: python-paseto-0.4.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1039-azure

File hashes

Hashes for python-paseto-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f1ccb62c0272227773b7396b9182f2ad60c628b18f76a7bed56e51f1fb124073
MD5 878553f86f18e91b02376f4eac8d98fe
BLAKE2b-256 c9ae3a1febc43c6138454c24da216677f1bed0fd77b659ac3cb615b9dda0c9d3

See more details on using hashes here.

File details

Details for the file python_paseto-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: python_paseto-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-1039-azure

File hashes

Hashes for python_paseto-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0edaabcaf01ca3e318c8b5c1a6006dd7aba2b37647d5a6f63fa13d964c17838b
MD5 b75fa0a813c65b9c3cd357a511bf320e
BLAKE2b-256 99f5e1bc3e44f5936e4cf7d0be15921d2e4c503646b61415fa0f43dbbab56c26

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page