Overview
The Core Package provides API client modules for interacting with backend services. All API clients are built on top of the HTTP service using theky library for type-safe HTTP requests.
Authentication API
The authentication API provides methods for user authentication operations including sign-up, sign-in, sign-out, and session management.Import
Usage
Types & Schemas
AuthSessionSchema
Represents an authenticated user session.Unique session identifier
ISO 8601 date string when the session expires
Session authentication token
ISO 8601 date string when the session was created
ISO 8601 date string when the session was last updated
IP address associated with the session
User agent string from the client
ID of the user who owns this session
AuthUserSchema
Represents a user account.Unique user identifier
User’s display name
User’s email address
Whether the user’s email has been verified
URL to user’s profile image, or null if not set
ISO 8601 date string when the user was created
ISO 8601 date string when the user was last updated
API Methods
getSession
Retrieves the current authenticated session.Ky request options for customizing the HTTP request
The current session object
The authenticated user object
Response headers from the HTTP request
GET /api/auth/get-session
Access: Public
Throws: HTTPError | TimeoutError | ZodError
signInEmail
Sign in a user with email and password.Request body containing sign-in credentials
User’s email address
User’s password (minimum 8 characters)
Whether to create a persistent session
URL to redirect to after successful sign-in
Whether a redirect should be performed
Authentication token for the session
URL to redirect to, or null if no redirect
Response headers from the HTTP request
POST /api/auth/sign-in/email
Access: Public
Throws: HTTPError | TimeoutError | ZodError
signUpEmail
Register a new user with email and password.Request body containing registration details
User’s email address
User’s password (minimum 8 characters)
User’s display name (minimum 3 characters)
URL to redirect to after successful sign-up
Authentication token if registration is successful, null otherwise
Response headers from the HTTP request
POST /api/auth/sign-up/email
Access: Public
Throws: HTTPError | TimeoutError | ZodError
signOut
Sign out the current user and invalidate their session.Ky request options for customizing the HTTP request
Whether the sign-out was successful
Response headers from the HTTP request
POST /api/auth/sign-out
Access: Public
Throws: HTTPError | TimeoutError | ZodError
Query Keys
For use with TanStack Query or similar data-fetching libraries:Constants
Error Handling
All API methods can throw the following errors:- HTTPError: HTTP request failed (4xx or 5xx status codes)
- TimeoutError: Request exceeded timeout limit
- ZodError: Response validation failed
