Platform-Agnostic Security Tokens for Python
Project description
python-paseto
Platform-Agnostic Security Tokens for Python
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={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.
Code formatting is managed by black. To format run
black .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python-paseto-0.2.0.tar.gz
.
File metadata
- Download URL: python-paseto-0.2.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-63-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdee8b3c4c5b39cc898a9a05c7cbf7dc32d0953da166fcf12430d33f64d10f9d |
|
MD5 | 827c281b701324b521611ae9fd68e832 |
|
BLAKE2b-256 | 2ac7a5bace44866a49ad222268632b2aa412897ed5708c07ea020555a5f07d7b |
File details
Details for the file python_paseto-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: python_paseto-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.8.0-63-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f65184930f33ce6364952b82cfbd88ac5d5856e04cc296f8e17ec592e5530dc |
|
MD5 | c2019613319ae821123f343a91a91001 |
|
BLAKE2b-256 | d1c51cd190e09214e6463bb07f560f29056f557d991c2016a1599c325c3c4d64 |