@jeanmemory/react
Version:
React SDK for Jean Memory - Build personalized AI chatbots in 5 lines of code
51 lines (50 loc) • 1.26 kB
TypeScript
/**
* Jean Memory React SDK - OAuth 2.1 PKCE Utilities
* Robust authentication flow with session persistence
*/
export interface OAuthConfig {
apiKey: string;
redirectUri?: string;
scopes?: string[];
}
export interface JeanUser {
email: string;
name?: string;
access_token: string;
}
export interface OAuthSession {
codeVerifier: string;
state: string;
clientId: string;
redirectUri: string;
apiKey: string;
timestamp: number;
}
/**
* Store user session with persistence options
*/
export declare function storeUserSession(user: JeanUser): void;
/**
* Retrieve stored user session
*/
export declare function getUserSession(): JeanUser | null;
/**
* Clear all user session data
*/
export declare function clearUserSession(): void;
/**
* Initiate OAuth 2.1 PKCE flow
*/
export declare function initiateOAuth(config: OAuthConfig): Promise<void>;
/**
* Handle OAuth callback and exchange authorization code for token
*/
export declare function handleOAuthCallback(): Promise<JeanUser | null>;
/**
* Check if user is currently authenticated
*/
export declare function isAuthenticated(): boolean;
/**
* Get current user token for API requests
*/
export declare function getUserToken(): string | null;