Zero-dependency Flask session decoder.
Project description
flask-session-decoder
Zero-dependency Flask session decoder.
This is a small library without any dependencies. It works with close to default Flask session security configurations, but obviously does not provide the full cookie decoding and verification capabilities of flask
/ werkzeug
/ itsdangerous
. If your project already depends on these libraries, use the official tooling instead.
Installation and Usage
You can install the library from PyPI with pip install flask-session-decoder
.
Once installed, you can import and instantiate the decoder like this:
from flask_session_decoder import FlaskSessionDecoder
decoder = FlaskSessionDecoder(secret_key="the-secret-key-of-the-flask-app-that-created-the-cookie")
FlaskSessionDecoder
provides three methods for cookie verification and loading:
decoder.load(cookie)
returns the (by default verified) decoded string representation of the cookie.decoder.json(cookie)
returns the (by default verified) decoded cookie as adict
.verify(cookie)
returns whether the cookie signature is valid, without actually loading the value.
Development
Use black
for code formatting and mypy
for static code analysis.
License - MIT
The library is open-sourced under the conditions of the MIT license.
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 flask-session-decoder-0.1.0.tar.gz
.
File metadata
- Download URL: flask-session-decoder-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a4ad4df12207b61f14ce33c0962c39d322d7aba19153a0f577b80ecfbd448c6 |
|
MD5 | 68e0492033ab09fefc19b8f433a24c37 |
|
BLAKE2b-256 | bee74b02f984c9122171f070a843971b16a05e4cf2ae8f9b4e894a1dde92181b |
File details
Details for the file flask_session_decoder-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: flask_session_decoder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54cc21e59a2713a2834cdf07c1cb7e43bdae3551a1142220ea5e398069ee9000 |
|
MD5 | d28f115486d95a2170e6cd97260470d5 |
|
BLAKE2b-256 | f8d2fc813899cea0a54ad3452fb26b0810e6b486a06c0b214ab29a35cdb22ad8 |