Files
ERitors-Scribe-Desktop/electron.d.ts
natreex d018e75be4 Remove DataService and OfflineDataService, refactor book and character operations to use streamlined handlers in LocalSystem
- Delete `data.service.ts` and `offline-data.service.ts`, consolidating functionality into `LocalSystem`.
- Refactor book, character, and conversation operations to adopt unified, multilingual, and session-enabled IPC handlers in `LocalSystem`.
- Simplify redundant legacy methods, enhancing maintainability and consistency.
2025-11-18 21:02:38 -05:00

45 lines
1.4 KiB
TypeScript

/**
* TypeScript declarations for window.electron API
* Must match exactly with electron/preload.ts
*
* Usage:
* - Use invoke<T>(channel, ...args) for all IPC calls
* - Shortcuts are provided for common operations (tokens, lang, encryption)
*/
export interface IElectronAPI {
// Platform info
platform: NodeJS.Platform;
// Generic invoke method - use this for all IPC calls
invoke: <T = any>(channel: string, ...args: any[]) => Promise<T>;
// Token management (shortcuts for convenience)
getToken: () => Promise<string | null>;
setToken: (token: string) => Promise<void>;
removeToken: () => Promise<void>;
// Language management (shortcuts for convenience)
getLang: () => Promise<'fr' | 'en'>;
setLang: (lang: 'fr' | 'en') => Promise<void>;
// Auth events (one-way communication)
loginSuccess: (token: string, userId: string) => void;
logout: () => void;
// Encryption key management (shortcuts for convenience)
generateEncryptionKey: (userId: string) => Promise<string>;
getUserEncryptionKey: (userId: string) => Promise<string | null>;
setUserEncryptionKey: (userId: string, encryptionKey: string) => Promise<void>;
// Database initialization (shortcut for convenience)
dbInitialize: (userId: string, encryptionKey: string) => Promise<boolean>;
}
declare global {
interface Window {
electron: IElectronAPI;
}
}
export {};