JET - JSON Encrypted Token
Project description
jet-python
JSON Encrypted Token - Python module
from jet import JET
from jet.utils import hmac_sha256
GLOBAL_JET = JET(
SECRET = 'my-secret-string'
)
user_secret = hmac_sha256('user-password', 'user-password', 'ascii')
payload = {
'id': 1,
'message': "Hola"
}
# Generate token
token = GLOBAL_JET.encrypt(user_secret, payload)
# Get info on token
decrypted_meta, decrypted_payload = GLOBAL_JET.decrypt(user_secret, token)
# Get info on token without user_secret
decrypted_meta, decrypted_payload = GLOBAL_JET.decrypt_from_PK(token)
# Verify token
verified_sign = GLOBAL_JET.is_valid_token(token)
print("Token is valid? ", verified_sign)
# Refresh token
new_token = GLOBAL_JET.refresh_token(token)
print("Token == New Token ", token == new_token)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file json-encrypted-token-0.0.6.tar.gz.
File metadata
- Download URL: json-encrypted-token-0.0.6.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c91bdc81e906c593e242331794613adcde1163982220eaf847b23f385ac567e7
|
|
| MD5 |
9f718a6911a8c133cdb0a85a931eb6b5
|
|
| BLAKE2b-256 |
b791f0111e6585bf15a49362ef9280463c6349bedb53a3fd8a66d7a98c91c8d6
|
File details
Details for the file json_encrypted_token-0.0.6-py3-none-any.whl.
File metadata
- Download URL: json_encrypted_token-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83147008ff7485c9b52efe59ade02df82222b9376968693ed000c1c1e34892f7
|
|
| MD5 |
00c898372ff9fe6371b75f01cb756035
|
|
| BLAKE2b-256 |
7785f8cce65d268c354c09d21d58d096e4dbdebd111b35abed60ac436097e2a7
|