trading/shared/schemas/auth.py

28 lines
725 B
Python
Raw Normal View History

"""Authentication Pydantic schemas for API request/response payloads."""
from pydantic import BaseModel, Field
class RegisterRequest(BaseModel):
"""Sent by the dashboard to begin passkey registration."""
username: str = Field(min_length=1, max_length=100)
display_name: str | None = None
class LoginRequest(BaseModel):
"""Sent by the dashboard to begin passkey authentication."""
username: str = Field(min_length=1, max_length=100)
class TokenResponse(BaseModel):
"""Returned after successful authentication."""
access_token: str
refresh_token: str
token_type: str = "bearer"
expires_in: int = Field(
description="Access token lifetime in seconds", default=900
)