2024-04-02 22:33:15 +03:00
|
|
|
from typing import Protocol
|
|
|
|
|
2024-04-10 00:33:31 +03:00
|
|
|
from api.domain.user.model import UserEmail, UserId
|
2024-04-02 22:33:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
class JwtTokenProcessor(Protocol):
|
2024-04-10 00:33:31 +03:00
|
|
|
def generate_token(self, user_id: UserId, user_email: UserEmail) -> str:
|
2024-04-02 22:33:15 +03:00
|
|
|
raise NotImplementedError
|
|
|
|
|
2024-04-10 00:33:31 +03:00
|
|
|
def validate_token(self, token: str) -> tuple[UserId, UserEmail] | None:
|
2024-04-02 22:33:15 +03:00
|
|
|
raise NotImplementedError
|
2024-04-08 00:31:15 +03:00
|
|
|
|
|
|
|
def refresh_token(self, token: str) -> str:
|
|
|
|
raise NotImplementedError
|