Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron TREZOR Support #1946

Merged
merged 7 commits into from
Jun 15, 2018
Merged

Electron TREZOR Support #1946

merged 7 commits into from
Jun 15, 2018

Conversation

wbobeirne
Copy link
Contributor

Builds off of #1836, finishes the other half of #1621.

Description

Implements the TREZOR side of hardware wallet integration in Electron using the enclave library introduced in #1621. Similar to that PR, there's an unfortunate amount of code duplication between the two wallet implementations. Any feedback on how to better unite those would be appreciated.

See "Steps to Test" for note about pending PR. I have personally tested that this all works.

Changes

  • Implemented TREZOR on Enclave side
  • Re-enabled TREZOR wallet in Electron environment
  • Typed up all TREZOR libraries (including the vendor'd TrezorConnect.)

Steps to Test

NOTE: This is still pending on trezor/trezor-link#9. If you wish to test this PR locally, you will have to manually make the changes proposed their to node_modules/trezor-link/lib/http.js.

  1. Start electron app
  2. Unlock a TREZOR wallet address
  3. Display the address on your device
  4. Sign a transaction, confirm it looks good
  5. Repeat those steps in the web app

@wbobeirne wbobeirne added the status: ready for review Open PR's that are ready for technical review. Replaced with "changes needed" or "ready to merge". label Jun 13, 2018
const { chainId, ...strTx } = getTransactionFields(tx);
const txFields = getTransactionFields(tx);

if (process.env.BUILD_ELECTRON) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to make a class that extends HardwareWallet that does this for you. @HenryNguyen5 how would you suggest this best be done?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably just make a utility HOF instead that does the branching for you

package.json Outdated
@@ -89,6 +91,7 @@
"@types/webpack-env": "1.13.4",
"@types/zxcvbn": "4.4.0",
"autodll-webpack-plugin": "0.3.9",
"bchaddrjs": "0.2.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self, this was fixed with trezor/trezor.js#58 so I can remove this.

@coveralls
Copy link

coveralls commented Jun 14, 2018

Coverage Status

Coverage increased (+0.04%) to 54.99% when pulling 826e5bf on enclave-trezor into e360b90 on enclave-willo-protocol.

@dternyak dternyak merged commit c9d2a9f into enclave-willo-protocol Jun 15, 2018
dternyak pushed a commit that referenced this pull request Jun 15, 2018
* 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
@ConnorBryan ConnorBryan deleted the enclave-trezor branch August 22, 2018 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready for review Open PR's that are ready for technical review. Replaced with "changes needed" or "ready to merge".
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants