22 lines
1.1 KiB
JavaScript
22 lines
1.1 KiB
JavaScript
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
||
|
|
|
||
|
|
contextBridge.exposeInMainWorld('api', {
|
||
|
|
// Vault operations
|
||
|
|
getVaults: () => ipcRenderer.invoke('db:getVaults'),
|
||
|
|
addVault: (vault) => ipcRenderer.invoke('db:addVault', vault),
|
||
|
|
updateVault: (id, vault) => ipcRenderer.invoke('db:updateVault', id, vault),
|
||
|
|
deleteVault: (id) => ipcRenderer.invoke('db:deleteVault', id),
|
||
|
|
|
||
|
|
// Account operations
|
||
|
|
getAccounts: (page, limit, vaultId) => ipcRenderer.invoke('db:getAccounts', page, limit, vaultId),
|
||
|
|
getAccountCount: (vaultId) => ipcRenderer.invoke('db:getAccountCount', vaultId),
|
||
|
|
addAccount: (account) => ipcRenderer.invoke('db:addAccount', account),
|
||
|
|
updateAccount: (id, account) => ipcRenderer.invoke('db:updateAccount', id, account),
|
||
|
|
deleteAccount: (id) => ipcRenderer.invoke('db:deleteAccount', id),
|
||
|
|
moveAccountToVault: (accountId, vaultId) => ipcRenderer.invoke('db:moveAccountToVault', accountId, vaultId),
|
||
|
|
searchAccounts: (query, vaultId) => ipcRenderer.invoke('db:searchAccounts', query, vaultId),
|
||
|
|
|
||
|
|
// Clipboard
|
||
|
|
copyToClipboard: (text) => ipcRenderer.invoke('clipboard:write', text)
|
||
|
|
});
|