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

webusb and no verify xpub export #24

Merged
merged 16 commits into from
Jun 25, 2020

Conversation

humanumbrella
Copy link
Contributor

This PR mostly contains style changes and automatic fixes. However, there were a few bugs and linted errors. E.g. this PR changes several return await in async functions to return per https://eslint.org/docs/rules/no-return-await and finally fixes a couple additional typos.

Tests passing, and test suite ran locally with success.

@humanumbrella
Copy link
Contributor Author

Ledger Nano S v1.6.0 (MCU v1.12)

Trezor Model 1 v.1.8.1

Screen Shot 2020-06-22 at 11 38 58 AM
Screen Shot 2020-06-22 at 11 46 35 AM

Copy link
Contributor

@bucko13 bucko13 left a comment

Choose a reason for hiding this comment

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

Just some small nits. Nice to get all the linting fixes in though!

One question I had is where can I find the changes related to the no verify xpub export part? I'm less familiar with this library so I'm probably just not looking in the right spot.

src/hermit.js Show resolved Hide resolved
src/hermit.js Show resolved Hide resolved
src/ledger.js Outdated Show resolved Hide resolved
src/ledger.js Outdated Show resolved Hide resolved
src/ledger.js Outdated Show resolved Hide resolved
src/ledger.js Outdated Show resolved Hide resolved
src/ledger.js Outdated Show resolved Hide resolved
@bucko13
Copy link
Contributor

bucko13 commented Jun 22, 2020

I think you may need to run npm install and commit the changes to the package-lock.json file in order to make travis happy:
https://travis-ci.com/github/unchained-capital/unchained-wallets/builds/172541993

@humanumbrella humanumbrella requested a review from bucko13 June 23, 2020 01:12
@humanumbrella
Copy link
Contributor Author

forgot to respond to the other commentary, but the no verify xpub export part
is located at https://github.com/unchained-capital/unchained-wallets/pull/24/files#diff-5da93726c6b0fe6dfa4d1b76cdc3767dL593 (open diff on ledger.js for this link to do any highlighting properly)

@@ -108,7 +108,7 @@
"max-classes-per-file": "off",
"max-depth": "error",
"max-len": "off",
"max-lines": "error",
"max-lines": "off",
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the rationale for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of the files in this package are over 300 lines (arbitrary) so this causes errors that aren't actually errors. I'm open to suggestion -- this was easier than saying ignore this particular rule in each file.

Copy link
Contributor

@waldenraines waldenraines left a comment

Choose a reason for hiding this comment

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

A couple of issues I'm seeing:

  • I am still seeing the ledger instructions and images very briefly when importing an xpub. These need to be reworked and shown only during the fallback case.
  • Importing and signing doesn't work at all in firefox (in linux at least, haven't tried windows). I get navigator.usb is undefined and that's it. I thought we had a fallback for cases when webusb wasn't supported.

@humanumbrella
Copy link
Contributor Author

oops, one sec - got trigger happy on review requests.

@humanumbrella
Copy link
Contributor Author

@waldenraines - you should be able to test now. NOTE: while you can use the Bitcoin Testnet app on the ledger for the webusb transport - you still cannot sign with the u2f transport (in firefox) without switching to the main Bitcoin app.

@waldenraines
Copy link
Contributor

@waldenraines - you should be able to test now. NOTE: while you can use the Bitcoin Testnet app on the ledger for the webusb transport - you still cannot sign with the u2f transport (in firefox) without switching to the main Bitcoin app.

Nice, will have a look.

Copy link
Contributor

@waldenraines waldenraines left a comment

Choose a reason for hiding this comment

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

Here are the results of my testing.

Tested with:

  • ledger nano s: bitcoin app 1.4.2, secure element 1.6.0, mcu 1.11
  • ledger nano x: bitcoin app 1.4.2, secure element 1.2.4-1, mcu 2.8

And the results:

  • I was able to import pubkeys and xpubs in chrome, brave, and firefox in both linux and windows.
  • I was able to sign in chrome and brave on both linux and windows
  • I was able to sign in firefox on windows
  • I was unable to sign in firefox in linux (Ledger device: Internal error, please report (0x6f01))
  • For some reason the nano x didn't work for me in chrome in windows at all but worked wonderfully in linux, would be nice for someone else to confirm.

All in all I think that this is a vast improvement over the previous implementation and it falls back to u2f nicely in firefox.

@waldenraines
Copy link
Contributor

@bucko13 did you have any further comments? Looks like you're still marked as "requesting changes".

src/ledger.js Outdated
@@ -40,7 +40,7 @@ import {
DirectKeystoreInteraction,
} from "./interaction";

import IMAGES from "./images";
//import IMAGES from "./images";
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, we're not using the images at all anymore? I guess we don't use them or have them yet for signing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we were only showing images for xpubs/pubkeys at the moment

Copy link
Contributor

Choose a reason for hiding this comment

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

we were only showing images for xpubs/pubkeys at the moment

See also unchained-capital/caravan#112

@kajalkris
Copy link

kajalkris commented Jun 24, 2020

Here are the results of my testing. Tested with:

ledger nano s: bitcoin app 1.4.2, secure element 1.6.0
ledger nano x: bitcoin app 1.4.2, secure element 1.2.4-1

  • For Ledger S on Mac & Windows, I can sign on Chrome & Brave browsers. I was not able to sign on Firefox.
  • For Ledger X on Mac, I was able to sign on Chrome, Firefox, and Brave.
  • For Ledger X on Windows, I was able to sign on Firefox, but on Chrome & Brave, I was unable to see the option to connect to the Ledger X device. See screenshot below.
    IMG_5844

@humanumbrella
Copy link
Contributor Author

re: @kajalkris looks like others have reported nano X not showing up on windows ... LedgerHQ/ledgerjs#456 -- I don't know how to handle that one.

For Ledger S -- I could sign on FF on mac (u2f) but had to try multiple times sometimes to finally get it to succeed (it failed, but I just kept trying, I exited and re-launched the btc app)

@bucko13
Copy link
Contributor

bucko13 commented Jun 24, 2020

LGTM! Tested in Chrome and Safari. Safari also throws the transport error but this isn't something we claim to support either right?

@waldenraines
Copy link
Contributor

I think we should go ahead and merge this and if there is anything we can do on our side to fix ledger nano x then we can do that in a follow-up PR. Thoughts @bucko13 @humanumbrella?

@bucko13 bucko13 merged commit c4cfa44 into unchained-capital:master Jun 25, 2020
@humanumbrella humanumbrella deleted the webusb-and-no-verify branch July 16, 2020 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants