import { CredentialStore } from "../types/server.js"; //#region src/credential-stores/nango-store.d.ts interface NangoConfig { secretKey: string; apiUrl?: string; } /** * Nango-specific credential data with additional properties */ interface NangoCredentialData { connectionId: string; providerConfigKey: string; secretKey: string; provider: string; token?: string; metadata?: Record; expiresAt?: Date | undefined; } /** * Nango-based CredentialStore that fetches OAuth credentials from Nango API * Uses connectionId and providerConfigKey from metadata to fetch live credentials */ declare class NangoCredentialStore implements CredentialStore { readonly id: string; readonly type: "nango"; private nangoConfig; private nangoClient; constructor(id: string, config: NangoConfig); private getAccessToken; private sanitizeMetadata; /** * Fetch a specific Nango integration */ private fetchNangoIntegration; /** * Create an API key credential by setting up Nango integration and importing the connection */ private createNangoApiKeyConnection; /** * Fetch credentials from Nango API using connection information * @param connectionId - The connection ID for the Nango connection * @param providerConfigKey - The provider config key for the Nango connection * @returns The credential data or null if the credentials are not found */ private fetchCredentialsFromNango; /** * Get credentials by key - implements CredentialStore interface * Key format: JSON string with connectionId and providerConfigKey */ get(key: string): Promise; /** * Set credentials - this is used to save bearer auth * Key format: JSON string with connectionId and providerConfigKey */ set(key: string, value: string, metadata?: Record): Promise; /** * Check if credentials exist by attempting to fetch them */ has(key: string): Promise; /** * Delete credentials - not supported for Nango (revoke through Nango dashboard) */ delete(key: string): Promise; /** * Check if the credential store is available and functional */ checkAvailability(): Promise<{ available: boolean; reason?: string; }>; } /** * Factory function to create NangoCredentialStore * Automatically reads NANGO_SECRET_KEY from environment and validates it */ declare function createNangoCredentialStore(id: string, config?: Partial): NangoCredentialStore; //#endregion export { NangoConfig, NangoCredentialData, NangoCredentialStore, createNangoCredentialStore };