Files
macu-wallet/preload.js
T

17 lines
979 B
JavaScript
Raw Normal View History

2026-08-27 18:27:44 +00:00
const { contextBridge, ipcRenderer } = require('electron');
// Only these specific calls are exposed to the renderer (webpage) side.
// Nothing here touches the filesystem or private keys directly — every
// call is proxied through main.js, which is the only place that ever
// holds a decrypted mnemonic or private key.
contextBridge.exposeInMainWorld('macu', {
hasKeystore: () => ipcRenderer.invoke('wallet:hasKeystore'),
generateMnemonic: () => ipcRenderer.invoke('wallet:generateMnemonic'),
createWallet: (mnemonic, password) => ipcRenderer.invoke('wallet:create', { mnemonic, password }),
importWallet: (mnemonic, password) => ipcRenderer.invoke('wallet:import', { mnemonic, password }),
unlock: (password) => ipcRenderer.invoke('wallet:unlock', { password }),
lock: () => ipcRenderer.invoke('wallet:lock'),
getBalances: () => ipcRenderer.invoke('wallet:balances'),
sendEth: (to, amountEth) => ipcRenderer.invoke('wallet:sendEth', { to, amountEth }),
});