FenKeysManagement
Simple key management. Generate tokens for any usage.
FenKeysManagement is a simple tool for manage and generate tokens that can be used in different applications. Like for example a flask API.
Usage
Key management
For managing your keyfile you have a command fenkm where you can add, see and revoke tokens.
usage: fenkm [-h] [genkey ...] [revokekey ...] [listkeys ...]
Simple key management. Generate tokens for any usage.
positional arguments:
genkey Generate a new key. Optional argument comment in the format comment=<comment>
revokekey Revoke a key. The format should be <key>=<value> where <key> cant be the id or the key directly
listkeys List all the key available
options:
-h, --help show this help message and exit
Module usage
As an example, here is a snippet of how I use this in some flask applications. This is not a working flask application, don't copy past without understanding it.
import json
from fenkeysmanagement import KeyManager
# ... more imports and flask related code
key_manager = KeyManager()
# .. more flask related code
def check_perms(request):
data_str = request.data.decode('utf-8')
try:
data_json = json.loads(data_str)
if "auth_key" in data_json.keys():
key_manager.reload_keys()
if not key_manager.key_revoked(data_json['auth_key']):
return True
return False
except json.decoder.JSONDecodeError:
return False
# ... more flask related code
@app.route("/", methods=["POST"])
def home():
if not check_perms(request):
# ... code for handle the failed auth verification
# ... code for handle the real request after correct auth verification
# ... more flask related code
Metadata
Release files for fenkeysmanagement 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fenkeysmanagement-1.0.1.tar.gz | 16.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fenkeysmanagement-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.7 kB
Release files / fenkeysmanagement-1.0.1.tar.gz
| Download URL | fenkeysmanagement-1.0.1.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20443ffc96f5631ac0f97fda392f0e03dac79f99ce7c5179f6e506329c1a8a45
|
|
BLAKE2b-256 checksum How to use checksums |
5bcb7b2bf34d084313afc0ce3ef3f1505f36086d0cfaf3dff251935826548456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / fenkeysmanagement-1.0.1-py3-none-any.whl
| Download URL | fenkeysmanagement-1.0.1-py3-none-any.whl |
|---|---|
| Size | 28.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57459b815c355576864d939a22341a19c5db648bb2e98e2747ea7a14050a0c93
|
|
BLAKE2b-256 checksum How to use checksums |
90edef7ab207226358fc22d6ead1a20049507dcec8b84536df63786a64b533b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|