Skip to content

Commit

Permalink
Minor fixes to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
pderose committed Jul 18, 2023
1 parent 4798a1c commit 7e1a16b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion eudi_wallet_python/satosa/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import base64
import satosa.util as util

from six import text_type
from satosa.context import Context
from satosa.exception import SATOSAAuthenticationError
from satosa.response import Response
from six import text_type
from satosa.backends.base import BackendModule

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions eudi_wallet_python/tools/jwk.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ class KeyType(Enum):
RSA = 2

class JWK():
def __init__(self, key: str = None, keyType: KeyType = KeyType.EC, hash_func: str = None) -> None:
def __init__(self, key = None, keyType: KeyType = KeyType.EC, hash_func: str = 'SHA-256') -> None:
if key:
self.key = key
elif keyType == KeyType.EC:
self.key = new_ec_key()
else:
self.key = new_rsa_key()

self.thumbprint = key.thumbprint(hash_function=hash_func or 'SHA-256')
self.thumbprint = key.thumbprint(hash_function=hash_func)
self.jwk = key.to_dict()
self.jwk["kid"] = self.thumbprint.decode()

Expand Down
4 changes: 3 additions & 1 deletion eudi_wallet_python/tools/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def __init__(self, plain_dict: Union[dict, str, int, None], jwk: JWK, **kwargs):
JWE_CLASS = JWE_RSA
elif isinstance(_key, cryptojwt.jwk.ec.ECKey):
JWE_CLASS = JWE_EC


_payload: str | int | bytes = ""

if isinstance(plain_dict, dict):
_payload = json.dumps(plain_dict).encode()
elif not plain_dict:
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ def readme():
_pkg_name = 'eudi_wallet_python'

with open(f'{_pkg_name}/__init__.py', 'r') as fd:
VERSION = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
VERSION = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE)
assert VERSION is not None
VERSION.group(1)

setup(
name=_pkg_name,
Expand Down Expand Up @@ -41,6 +42,6 @@ def readme():
]
},
install_requires=[
"cryptojwt>=1.8.2",
"cryptojwt>=1.8.2"
],
)

0 comments on commit 7e1a16b

Please sign in to comment.