trezor / connect

:link: A platform for easy integration of Trezor into 3rd party services
Other
348 stars 262 forks source link

How to talk directly to bridge? #352

Closed floating closed 4 years ago

floating commented 5 years ago

Hi all, trezor.js is relied upon by https://frame.sh, which runs locally on the user's machine. We've been using trezor.js to talk to Trezor Bridge and support all Trezor devices after the node-hid integration also became unsupported. If trezor.js is no longer being maintained, what is the recommended way to interface directly with the bridge? Does the same api/functionality exist in connect?

We need to be able to interface to multiple devices at once and cannot support popup UI flows.

I was told to post this here via https://github.com/trezor/trezor.js/issues/96

Thank you for any info!

prusnak commented 5 years ago

We need to be able to interface to multiple devices at once

Why?

and cannot support popup UI flows

Again, why?

floating commented 5 years ago

So we can provide an experience for our users that doesn't suck.

prusnak commented 5 years ago

Ok, so popups are not a technical limitation but rather your preference.

floating commented 5 years ago

I'm just trying to figure out a supported way to maintain the same access to Trezor devices we currently have with trezor.js as we've put a lot of work into building a really nice experience around interfacing with them, that our users love.

szymonlesisz commented 5 years ago

hi @floating , Since your app is build in electron you can try to use currently developed electon integration. You can find a simple boilerplate here: https://github.com/szymonlesisz/trezor-connect-electron-boilerplate

You can choose not to use popup (described in code) and handle UI_EVENTS by your own

floating commented 5 years ago

Thanks @szymonlesisz!

Will we be able to listen to connect/disconnect events for multiple devices via transport or device events? Can we interact with and derive address info from multiple devices at once?

I will start testing with our implementation as soon as possible, thanks again for the boilerplate.

szymonlesisz commented 5 years ago

yes, you can handle device, transport and ui events when "popup" is set to false. yes, you can interact with multiple devices at once, but you need to pass "device" parameter to each call (described here)

All should be obvious from the boilerplate

floating commented 5 years ago

Hey @szymonlesisz can you provide an example using trezor-connect in a node process with no reference to window? The renderer and main processes are isolated in Frame and we connect to all signers from a pure node process.

floating commented 5 years ago

We're still using trezor.js because we need it work in node -- some of our users are starting to report Error: Missing at least one required field for Message .EthereumAddress: address possibly related to https://github.com/trezor/trezor-wallet/issues/377 but not fixed in trezor.js?

floating commented 5 years ago

More users reporting Error: Missing at least one required field for Message .EthereumAddress: address. I've tried to test against trezor.js 8.1.0 but calling session.getPublicKey now results in Error: Digest method not supported, any ideas?

What's the best way to forward? Perhaps we should maintain support for trezor.js until trezor-connect supports node.

floating commented 5 years ago

Any word on this? We need an upgrade path for node.js users.

szymonlesisz commented 5 years ago

looks like you are sending outdated message definitions to transport.configure Since FW 2.1.0 EthereumAddress is sent as checksummed string instead of bytes: https://connect.trezor.io/7/data/messages/messages.json (new definitions) https://connect.trezor.io/7/data/messages/messages-v6.json (legacy definitions)

I'm aware that nodejs version of connect is a must and i'm working hard on this for a few weeks now.

floating commented 5 years ago

Any updates on node.js support? trezor.js should have been supported until connect was ready for node users

szymonlesisz commented 5 years ago

I've added node.js support to connect v8. Youcan try it out by installing trezor-connect with "extended" tag This package has a lot more dependencies than a regular one and until i rewrite this api to monorepo structure it will be maintained with "extended" tag in npm

keraf commented 4 years ago

I guess this has been resolved as there's no activity for over a year. Closing issue, please re-open if you still need help with this.