989 B
989 B
ETH Enclave
Enclave is the communication layer between hardware wallets and the Electron web view. This layer is necessary if you've disabled node integration, and enabled context isolation on your webview (Which is something you should do.)
Enclave uses Electron's Protocol API to open up an HTTP-like communication layer between Electron and the web view. You can read more about this approach here.
Setup
// Electron main js
import { registerServer } from 'enclave/server';
registerServer(app);
// Electron preload js
import { registerProtocol } from 'enclave/preload';
registerProtocol();
Usage
import EnclaveAPI, { WalletTypes } from 'enclave/client';
EnclaveAPI.getChainCode({
walletType: WalletTypes.LEDGER,
dpath: "m/44'/60'/0'/0"
}).then(({ publicKey, chainCode }) => {
// ...
});