Skip to main content

Platform-Agnostic Security Tokens for Python

Project description

python-paseto

Platform-Agnostic Security Tokens for Python

Build Status ci-workflow Coverage Status Language grade: Python Code style: black

Installation

Clone the repository, in the future a pip install will be available.

poetry is used to manage project dependencies / build / test / publish.

Install dependencies with

poetry install

Run tests

pytest

To check code coverage run

coverage run -m pytest
coverage report

Low level API

Initial implementation of the V2 encrypt / decrypt functions. Alpha version. Low level API focuses on solid, high quality, production ready primitives as specified directly in the PASETO protocol.

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=}")
print(f"{plain_text=}")
print(f"{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=}")
print(f"{plain_text=}")
print(f"{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.

Code formatting is managed by black. To format run

black .

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.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

python_paseto-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python-paseto-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-59-generic

File hashes

Hashes for python-paseto-0.1.0.tar.gz
Algorithm Hash digest
SHA256 38b6af07ea404da3f6915a23aa0111e625e83401c30ad53fc2d23cdb86438e54
MD5 796761e766e7a2158c2e5354b1d8f03a
BLAKE2b-256 e21c31d3211d1d584044d8f7b125f3dc8aac2520d600e95dbcb4541c69a2fe2c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for python_paseto-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a332792f60cb9f0e951916f1cf0aef4d161ef00a4397209bd606a119e6de76a7
MD5 03caa44483c70d83bc7a178ca40d6b21
BLAKE2b-256 b0ef26c7ac8d0409052972cf72972033e11a9d6fd028cc50a8c702a789210f90

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