UNPKG

@jeanmemory/node

Version:

Node.js SDK for Jean Memory - Power your Next.js and other Node.js backends with a perfect memory

61 lines 1.55 kB
/** * Jean Memory Node.js SDK Authentication * OAuth 2.1 PKCE authentication for Node.js applications */ interface AuthConfig { apiKey: string; oauthBase?: string; redirectPort?: number; } interface AuthResult { email: string; name?: string; access_token: string; created_at: string; } export declare class JeanMemoryAuth { private apiKey; private oauthBase; private redirectPort; private redirectUri; constructor(config: AuthConfig); /** * Generate PKCE code verifier and challenge */ private generatePKCEPair; /** * Generate secure random state parameter */ private generateState; /** * Create authorization URL for OAuth flow */ createAuthorizationUrl(): { url: string; state: string; verifier: string; }; /** * Exchange authorization code for access token */ exchangeCodeForToken(code: string, verifier: string): Promise<AuthResult>; /** * Start local server for OAuth callback */ private createCallbackServer; /** * Perform complete OAuth 2.1 PKCE authentication flow * This method requires user interaction (opening browser) */ authenticate(timeout?: number): Promise<AuthResult>; /** * Validate an existing access token */ validateToken(accessToken: string): Promise<boolean>; /** * Get user info from access token */ getUserInfo(accessToken: string): Promise<AuthResult>; } export {}; //# sourceMappingURL=auth.d.ts.map