fix(desktop):add auth cutover ipc

This commit is contained in:
Anish Sarkar 2026-06-24 03:55:39 +05:30
parent 766fa25ea0
commit 2fd7551d36
4 changed files with 73 additions and 16 deletions

View file

@ -80,13 +80,12 @@ contextBridge.exposeInMainWorld('electronAPI', {
ipcRenderer.invoke(IPC_CHANNELS.WRITE_AGENT_LOCAL_FILE_TEXT, virtualPath, content, searchSpaceId),
// Auth token sync across windows
getAuthTokens: () => ipcRenderer.invoke(IPC_CHANNELS.GET_AUTH_TOKENS),
setAuthTokens: (bearer: string, refresh: string) =>
ipcRenderer.invoke(IPC_CHANNELS.SET_AUTH_TOKENS, { bearer, refresh }),
getAccessToken: () => ipcRenderer.invoke(IPC_CHANNELS.GET_ACCESS_TOKEN),
refreshAccessToken: () => ipcRenderer.invoke(IPC_CHANNELS.REFRESH_ACCESS_TOKEN),
logout: () => ipcRenderer.invoke(IPC_CHANNELS.LOGOUT),
startGoogleOAuth: () => ipcRenderer.invoke(IPC_CHANNELS.AUTH_START_GOOGLE),
loginPassword: (email: string, password: string) =>
ipcRenderer.invoke(IPC_CHANNELS.AUTH_LOGIN_PASSWORD, { email, password }),
onAuthChanged: (callback: (payload: { authed: boolean; accessToken: string | null }) => void) => {
const listener = (_event: Electron.IpcRendererEvent, payload: { authed: boolean; accessToken: string | null }) =>
callback(payload);