pypomes-jwt 1.3.2__tar.gz → 1.3.3__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 1.3.2
3
+ Version: 1.3.3
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
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_jwt"
9
- version = "1.3.2"
9
+ version = "1.3.3"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -21,8 +21,9 @@ class JwtAlgorithm(StrEnum):
21
21
 
22
22
  # recommended: allow the encode and decode keys to be generated anew when app starts
23
23
  _encoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_ENCODING_KEY",
24
- encoding="base64url")
25
- _decoding_key: bytes
24
+ encoding="base64")
25
+ _decoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_DECODING_KEY")
26
+ # default algorithm may cause encode and decode keys to be overriden
26
27
  _default_algorithm: JwtAlgorithm = env_get_enum(key=f"{APP_PREFIX}_JWT_DEFAULT_ALGORITHM",
27
28
  enum_class=JwtAlgorithm,
28
29
  def_value=JwtAlgorithm.RS256)
@@ -30,17 +31,16 @@ if _default_algorithm in [JwtAlgorithm.HS256, JwtAlgorithm.HS512]:
30
31
  if not _encoding_key:
31
32
  _encoding_key = token_bytes(nbytes=32)
32
33
  _decoding_key = _encoding_key
33
- else:
34
- _decoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_DECODING_KEY")
35
- if not _encoding_key or not _decoding_key:
36
- __priv_key: RSAPrivateKey = rsa.generate_private_key(public_exponent=65537,
37
- key_size=2048)
38
- _encoding_key = __priv_key.private_bytes(encoding=serialization.Encoding.PEM,
39
- format=serialization.PrivateFormat.PKCS8,
40
- encryption_algorithm=serialization.NoEncryption())
41
- __pub_key: RSAPublicKey = __priv_key.public_key()
42
- _decoding_key = __pub_key.public_bytes(encoding=serialization.Encoding.PEM,
43
- format=serialization.PublicFormat.SubjectPublicKeyInfo)
34
+ elif not _encoding_key or not _decoding_key:
35
+ __priv_key: RSAPrivateKey = rsa.generate_private_key(public_exponent=65537,
36
+ key_size=2048
37
+ if _default_algorithm == JwtAlgorithm.RS256 else 4096)
38
+ _encoding_key = __priv_key.private_bytes(encoding=serialization.Encoding.PEM,
39
+ format=serialization.PrivateFormat.PKCS8,
40
+ encryption_algorithm=serialization.NoEncryption())
41
+ __pub_key: RSAPublicKey = __priv_key.public_key()
42
+ _decoding_key = __pub_key.public_bytes(encoding=serialization.Encoding.PEM,
43
+ format=serialization.PublicFormat.SubjectPublicKeyInfo)
44
44
 
45
45
 
46
46
  class JwtConfig(Enum):
File without changes
File without changes
File without changes