mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 11:05:47 +00:00
cb92f59e57
* Initial scaffold of enclave * Cleanup types * Add comments * Do not truncate errors, pretty output * Introduce helpers for sagas * Update yarn lock * Convert enclave into its own lib. Implement client and server. * Check in progress * Initial types * Remove unused lib * Finish types * cleanup * Switch over to using electron protocol, remove code thats no longer necessary * Refactor Ledger and Trezor wallets to provide all functionality via libs. Run chain code generation thru Enclave. * Check in trezor work * Transaction signing * Message signing * Display address * Fix deallocation of trezor * Adjust API * Remove unused getAddresses * Fix imports and filenames to cooperate with internal typings * Fix type uncertainty * Add persistent message to Ledger unlock. * Update ledger help link to kb * Convert ledger over to updated libs * Fix jest config * Enclave README * Unnecessary assertion * Adjust tip * Type ledger errors * Reduce enclave client code. * No default exports * l18n user facing enclave errors * Reduce repeated enclave code by splitting it into its own wallet lib. Fix some types * tslint * Reduce repeated enclave code by splitting it into its own wallet lib. Fix some types and error messages. * Electron TREZOR Support (#1946) * Type trezor connect. * Check in trezor code * Implement TREZOR wallet * Convert TREZOR to use enclave class like Ledger. * Switch to mycrypto fork of trezor lib. Remove unused dependencies. * remove unnecessary window attachment * tslint
35 lines
989 B
Markdown
35 lines
989 B
Markdown
# 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.](https://github.com/electron/electron/blob/master/docs/tutorial/security.md))
|
|
|
|
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](https://gist.github.com/wbobeirne/ec3e52b3db1359278c19f29e1bbfd5f1).
|
|
|
|
## Setup
|
|
|
|
```js
|
|
// Electron main js
|
|
import { registerServer } from 'enclave/server';
|
|
registerServer(app);
|
|
```
|
|
|
|
```js
|
|
// Electron preload js
|
|
import { registerProtocol } from 'enclave/preload';
|
|
registerProtocol();
|
|
```
|
|
|
|
## Usage
|
|
|
|
```js
|
|
import EnclaveAPI, { WalletTypes } from 'enclave/client';
|
|
EnclaveAPI.getChainCode({
|
|
walletType: WalletTypes.LEDGER,
|
|
dpath: "m/44'/60'/0'/0"
|
|
}).then(({ publicKey, chainCode }) => {
|
|
// ...
|
|
});
|
|
```
|