from abc import ABC, abstractmethod from typing import Any class AbstractAuthProvider(ABC): """Abstract base for authentication providers.""" @abstractmethod async def authenticate(self, email: str, password: str) -> dict[str, Any] | None: """Authenticate a user. Returns user dict or None if invalid.""" ... @abstractmethod def create_access_token(self, data: dict[str, Any]) -> str: """Create an access token for the given data.""" ... @abstractmethod def create_refresh_token(self, data: dict[str, Any]) -> str: """Create a refresh token for the given data.""" ... @abstractmethod def validate_token(self, token: str) -> dict[str, Any] | None: """Validate a token and return the claims, or None if invalid.""" ... @abstractmethod def hash_password(self, password: str) -> str: """Hash a plaintext password.""" ... @abstractmethod def verify_password(self, plain_password: str, hashed_password: str) -> bool: """Verify a plaintext password against a hash.""" ...