(self, token: str, check_expiration: bool = True)
| 107 | ) |
| 108 | |
| 109 | def verify_token(self, token: str, check_expiration: bool = True) -> Token | None: |
| 110 | try: |
| 111 | payload = jwt.decode( |
| 112 | token, |
| 113 | self.jwt_public_key, |
| 114 | algorithms=[self.jwt_algorithm], |
| 115 | options={"verify_signature": True, "verify_expiration": check_expiration}, |
| 116 | ) |
| 117 | return Token.from_payload(token=token, payload=payload) |
| 118 | except jwt.ExpiredSignatureError as e: |
| 119 | print(e) |
| 120 | return None |
| 121 | except jwt.InvalidTokenError as e: |
| 122 | print(e) |
| 123 | return None |
| 124 | |
| 125 | @staticmethod |
| 126 | def random_string( |
no test coverage detected