17 lines
979 B
JavaScript
17 lines
979 B
JavaScript
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 }),
|
|
});
|