pypomes-jwt 0.8.7__py3-none-any.whl → 0.8.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pypomes-jwt might be problematic. Click here for more details.

@@ -49,15 +49,15 @@ JWT_REFRESH_MAX_AGE: Final[int] = env_get_int(key=f"{APP_PREFIX}_JWT_REFRESH_MAX
49
49
  JWT_ACCOUNT_LIMIT: Final[int] = env_get_int(key=f"{APP_PREFIX}_JWT_ACCOUNT_LIMIT")
50
50
 
51
51
  # recommended: allow the encode and decode keys to be generated anew when app starts
52
- __encoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_ENCODE_KEY",
53
- style="base64")
52
+ __encoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_ENCODING_KEY",
53
+ encoding="base64url")
54
54
  __decoding_key: bytes
55
55
  if JWT_DEFAULT_ALGORITHM in ["HS256", "HS512"]:
56
56
  if not __encoding_key:
57
57
  __encoding_key = token_bytes(nbytes=32)
58
58
  __decoding_key = __encoding_key
59
59
  else:
60
- __decoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_DECODE_KEY")
60
+ __decoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_DECODING_KEY")
61
61
  if not __encoding_key or not __decoding_key:
62
62
  __priv_key: RSAPrivateKey = rsa.generate_private_key(public_exponent=65537,
63
63
  key_size=2048)
pypomes_jwt/jwt_data.py CHANGED
@@ -1,3 +1,4 @@
1
+ import base64
1
2
  import jwt
2
3
  import requests
3
4
  import string
@@ -452,7 +453,7 @@ def _jwt_persist_token(errors: list[str],
452
453
  insert_data={JWT_DB_COL_ACCOUNT: account_id,
453
454
  JWT_DB_COL_TOKEN: jwt_token,
454
455
  JWT_DB_COL_ALGORITHM: JWT_DEFAULT_ALGORITHM,
455
- JWT_DB_COL_DECODER: JWT_DECODING_KEY.hex()},
456
+ JWT_DB_COL_DECODER: base64.urlsafe_b64encode(JWT_DECODING_KEY).decode()},
456
457
  connection=db_conn,
457
458
  logger=logger)
458
459
  if errors:
pypomes_jwt/jwt_pomes.py CHANGED
@@ -1,3 +1,4 @@
1
+ import base64
1
2
  import jwt
2
3
  from flask import Request, Response, request
3
4
  from logging import Logger
@@ -198,7 +199,7 @@ def jwt_validate_token(errors: list[str] | None,
198
199
  logger=logger)
199
200
  if recs:
200
201
  token_alg = recs[0][0]
201
- token_decoder = bytes.fromhex(recs[0][1])
202
+ token_decoder = base64.urlsafe_b64decode(recs[0][1])
202
203
  else:
203
204
  op_errors.append("Invalid token")
204
205
  else:
@@ -226,7 +227,7 @@ def jwt_validate_token(errors: list[str] | None,
226
227
  "verify_nbf": True
227
228
  },
228
229
  key=token_decoder,
229
- require=["exp", "nbf"],
230
+ require=["exp"],
230
231
  algorithms=token_alg)
231
232
  if account_id and payload.get("sub") != account_id:
232
233
  op_errors.append("Token does not belong to account")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 0.8.7
3
+ Version: 0.8.9
4
4
  Summary: A collection of Python pomes, penyeach (JWT module)
5
5
  Project-URL: Homepage, https://github.com/TheWiseCoder/PyPomes-JWT
6
6
  Project-URL: Bug Tracker, https://github.com/TheWiseCoder/PyPomes-JWT/issues
@@ -12,5 +12,5 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.12
13
13
  Requires-Dist: cryptography>=44.0.2
14
14
  Requires-Dist: pyjwt>=2.10.1
15
- Requires-Dist: pypomes-core>=1.8.4
15
+ Requires-Dist: pypomes-core>=1.8.5
16
16
  Requires-Dist: pypomes-db>=1.9.6
@@ -0,0 +1,8 @@
1
+ pypomes_jwt/__init__.py,sha256=P7rT6ZVE2BzU3ntYOr83H5iOf5JcCmjDUYakNbrRAP0,1266
2
+ pypomes_jwt/jwt_constants.py,sha256=IQV39AiZKGuU8XxZBgJ-KJZQZ_mmnxyOnRZeuxlqDRk,4045
3
+ pypomes_jwt/jwt_data.py,sha256=FU4zvFr-1ZbClM8ozt9asR2EGZe-xYX3046dxWnGays,22529
4
+ pypomes_jwt/jwt_pomes.py,sha256=XWnP4U2K5FPbP-N5npQboNdMZ-MMLpXTfd8Yf82aFls,17217
5
+ pypomes_jwt-0.8.9.dist-info/METADATA,sha256=orVERU_gL14nmPjxxNMrxyEKy3q4LLBD2vMokmyECSQ,632
6
+ pypomes_jwt-0.8.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ pypomes_jwt-0.8.9.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
+ pypomes_jwt-0.8.9.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- pypomes_jwt/__init__.py,sha256=P7rT6ZVE2BzU3ntYOr83H5iOf5JcCmjDUYakNbrRAP0,1266
2
- pypomes_jwt/jwt_constants.py,sha256=nDkOTJv1OqyQAsmyf6IVipg2MmynX2z-a75wFOJW4LQ,4035
3
- pypomes_jwt/jwt_data.py,sha256=GTLB0KcfOQAUpYWIQzQgH8n6-jJUI3xWnqw5bUvX5d8,22485
4
- pypomes_jwt/jwt_pomes.py,sha256=3YFWQpqpBHAKg8vS7RijtjgEJxTHsBkwXYu8VVnVHNU,17198
5
- pypomes_jwt-0.8.7.dist-info/METADATA,sha256=xnAR6dfgxnv6bZ56wMdQ9z1yJQt9PcF6Wobu2PJJ3NM,632
6
- pypomes_jwt-0.8.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- pypomes_jwt-0.8.7.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
- pypomes_jwt-0.8.7.dist-info/RECORD,,