diff --git a/authx/schema.py b/authx/schema.py index 0de95645..2cea37b3 100644 --- a/authx/schema.py +++ b/authx/schema.py @@ -38,7 +38,7 @@ def _additional_fields(self): @property def extra_dict(self): - return self.dict(include=self._additional_fields) + return self.model_dump(include=self._additional_fields) @property def issued_at(self) -> datetime.datetime: @@ -108,13 +108,11 @@ def decode( cls, token: str, key: str, - algorithms: Sequence[AlgorithmType] = None, + algorithms: Sequence[AlgorithmType] = ["HS256"], audience: Optional[StringOrSequence] = None, issuer: Optional[str] = None, verify: bool = True, ) -> "TokenPayload": - if algorithms is None: - algorithms = ["HS256"] payload = decode_token( token=token, key=key, @@ -135,7 +133,7 @@ class RequestToken(BaseModel): def verify( self, key: str, - algorithms: Sequence[AlgorithmType] = None, + algorithms: Sequence[AlgorithmType] = ["HS256"], audience: Optional[StringOrSequence] = None, issuer: Optional[str] = None, verify_jwt: bool = True, @@ -143,8 +141,6 @@ def verify( verify_csrf: bool = True, verify_fresh: bool = False, ) -> TokenPayload: - if algorithms is None: - algorithms = ["HS256"] # JWT Base Verification try: decoded_token = decode_token(