Merge branch 'fix-unauth' into 'main'
[ProtonMail-WebClient.git] / applications / pass-desktop / src / preload.ts
bloba260c6eb3baa173eebf55bf7fd08b1bba7ee1682
1 import { contextBridge, ipcRenderer } from 'electron';
3 import type { ContextBridgeApi } from '@proton/pass/types';
4 import { disableMouseNavigation } from '@proton/shared/lib/desktop/disableMouseNavigation';
6 const contextBridgeApi: ContextBridgeApi = {
7     /* clipboard */
8     writeToClipboard: (text) => ipcRenderer.invoke('clipboard:writeText', text),
9     setClipboardConfig: (config) => ipcRenderer.invoke('clipboard:setConfig', config),
10     getClipboardConfig: () => ipcRenderer.invoke('clipboard:getConfig'),
12     /* theming */
13     getTheme: () => ipcRenderer.invoke('theming:getTheme'),
14     setTheme: (theme) => ipcRenderer.invoke('theming:setTheme', theme),
16     /* routing */
17     navigate: (href) => ipcRenderer.invoke('router:navigate', href),
19     /* secrets */
20     canCheckPresence: () => ipcRenderer.invoke('biometrics:canCheckPresence'),
21     checkPresence: (reason) => ipcRenderer.invoke('biometrics:checkPresence', reason),
22     getDecryptionKey: (challenge) => ipcRenderer.invoke('biometrics:getDecryptionKey', challenge),
23     getSecret: (key, version) => ipcRenderer.invoke('biometrics:getSecret', key, version),
24     setSecret: (key, data) => ipcRenderer.invoke('biometrics:setSecret', key, data),
25     deleteSecret: (key) => ipcRenderer.invoke('biometrics:deleteSecret', key),
27     /* install info */
28     getInstallInfo: () => ipcRenderer.invoke('installInfo:getInfo'),
29     setInstallSourceReported: () => ipcRenderer.invoke('installInfo:setInstallSourceReported'),
32 contextBridge.exposeInMainWorld('ctxBridge', contextBridgeApi);
33 disableMouseNavigation();