Skip to main content

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

json-encrypted-token-0.0.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

json_encrypted_token-0.0.6-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

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

Hashes for json-encrypted-token-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c91bdc81e906c593e242331794613adcde1163982220eaf847b23f385ac567e7
MD5 9f718a6911a8c133cdb0a85a931eb6b5
BLAKE2b-256 b791f0111e6585bf15a49362ef9280463c6349bedb53a3fd8a66d7a98c91c8d6

See more details on using hashes here.

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

Hashes for json_encrypted_token-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 83147008ff7485c9b52efe59ade02df82222b9376968693ed000c1c1e34892f7
MD5 00c898372ff9fe6371b75f01cb756035
BLAKE2b-256 7785f8cce65d268c354c09d21d58d096e4dbdebd111b35abed60ac436097e2a7

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