-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
gh-pages: Add method to share connection status #147
base: gh-pages
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍 I can await the await this.cleanUp()
before approving
ledger-bridge.js
Outdated
} | ||
catch(e) { | ||
console.log('LEDGER:::Transport check error', e) | ||
this.sendConnectionMessage(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.onDisconnect()
below also appears to call this.sendConnectionMessage(false)
. Maybe we don't need this line? Same comment applies to similar logic added in bundle.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
ledger-bridge.js
Outdated
// Ensure the correct (Ethereum) app is open; if not, immediately kill | ||
// the connection as the wrong app is open and switching apps will call | ||
// a disconnect from within the Ledger API | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block needs to be skipped for Firefox because the U2F library throws on the await this.transport.send(0xb0, 0x01, 0x00, 0x00)
line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with my ledger and everything worked well. I switched between the various connection types as well just to ensure that I was testing the various code branches.
963e99f
to
1218a25
Compare
1218a25
to
94dce64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
tested with Chrome x macOS
catch(e) { | ||
console.log('LEDGER:::Transport check error', e) | ||
// A race condition for checking connection status isn't a sign that | ||
// connection status has changed, so don't disconnect on this type of error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional] It might be helpful if we add a link to the error name
@see {@link https://github.com/LedgerHQ/ledgerjs/blob/master/packages/hw-transport/src/Transport.ts#L276}
for more context of the 'TransportRaceCondition' error. This is subject to change.
This PR adds a method for the Ledger to ensure the correct app is open during connection, as well as share track and share connectivity for the Hardware Connectivity UI (MetaMask/metamask-extension#12725)