@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
57 lines (56 loc) • 2.03 kB
TypeScript
/**
* Token Storage for OAuth 2.1 authentication
* Provides implementations for storing OAuth tokens
*/
import type { OAuthTokens, TokenStorage } from "../../types/index.js";
/**
* In-memory token storage implementation
* Suitable for development and single-session use
* Tokens are lost when the process terminates
*/
export declare class InMemoryTokenStorage implements TokenStorage {
private tokens;
getTokens(serverId: string): Promise<OAuthTokens | null>;
saveTokens(serverId: string, tokens: OAuthTokens): Promise<void>;
deleteTokens(serverId: string): Promise<void>;
hasTokens(serverId: string): Promise<boolean>;
clearAll(): Promise<void>;
/**
* Get the number of stored token sets
*/
get size(): number;
/**
* Get all server IDs with stored tokens
*/
getServerIds(): string[];
}
/**
* File-based token storage implementation
* Persists tokens to disk for cross-session use
*/
export declare class FileTokenStorage implements TokenStorage {
private filePath;
private tokens;
private loaded;
constructor(filePath: string);
private loadTokens;
private saveToFile;
getTokens(serverId: string): Promise<OAuthTokens | null>;
saveTokens(serverId: string, tokens: OAuthTokens): Promise<void>;
deleteTokens(serverId: string): Promise<void>;
hasTokens(serverId: string): Promise<boolean>;
clearAll(): Promise<void>;
}
/**
* Check if tokens are expired or about to expire
* @param tokens - OAuth tokens to check
* @param bufferSeconds - Buffer time in seconds before expiration (default: 60)
* @returns True if tokens are expired or will expire within buffer time
*/
export declare function isTokenExpired(tokens: OAuthTokens, bufferSeconds?: number): boolean;
/**
* Calculate token expiration timestamp from expires_in value
* @param expiresIn - Token lifetime in seconds
* @returns Expiration timestamp (Unix epoch in milliseconds)
*/
export declare function calculateExpiresAt(expiresIn: number): number;