@yogesh0333/yogiway
Version:
YOGIWAY Format - Ultra-compact, nested-aware data format for LLM prompts. Handles deeply nested JSON efficiently, 10-15% more efficient than TOON.
54 lines • 1.4 kB
TypeScript
/**
* Authentication System for YOGIWAY Library
* Handles user login, registration, and token management
*/
export interface AuthUser {
id: string;
email: string;
wallet_balance: number;
}
export interface AuthResponse {
success: boolean;
user: AuthUser;
access_token: string;
refresh_token: string;
expires_at: number;
message?: string;
}
/**
* Logout user (alias for clearAuth)
*/
export declare function logout(): void;
/**
* Clear stored auth tokens
*/
export declare function clearAuth(): void;
/**
* Register a new user
*/
export declare function register(email: string, password: string): Promise<AuthResponse>;
/**
* Login with email and password
*/
export declare function login(email: string, password: string): Promise<AuthResponse>;
/**
* Refresh access token
*/
export declare function refreshToken(): Promise<string | null>;
/**
* Get current access token (with auto-refresh if needed)
*/
export declare function getAccessToken(): Promise<string | null>;
/**
* Get current authenticated user
*/
export declare function getCurrentUser(): AuthUser | null;
/**
* Check if user is authenticated
*/
export declare function isAuthenticated(): Promise<boolean>;
/**
* Make authenticated API request
*/
export declare function authenticatedFetch(url: string, options?: RequestInit): Promise<Response>;
//# sourceMappingURL=auth.d.ts.map