trezor / trezor-suite

Trezor Suite Monorepo

Home Page:https://trezor.io/trezor-suite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

connect-webextension proxy - revise desing

mroz22 opened this issue · comments

related to #12717

Regarding the proxy:
After talking about this with @martykan we came to the conclusion that the proxy is out of the scope of TrezorConnect and we should focus on making connect-webextension work nicely in service worker with popup with ES modules.

I believe that init should be hadled implicitly inside call

init requires settings in functions arguments and we do not have that in call method if init has not been called before.

lib/index.js does not contain inlined content-script. so simply importing from @trezor/connect-webextension forces you to use version where you have to vendorize content script.

Should be fixed by this PR #12761

add default connectSrc. it is not set and 3rd parties have to do stuff like this https://github.com/RabbyHub/Rabby/blob/59e06afc722e69c6f609654c1f5ccba1f710710f/src/background/service/keyring/eth-trezor-keyring/trezor-offscreen-bridge.ts#L30

if init was not call, and channel not set, call method throws on the first attempt to access channel, this is caught, but in the catch block later on obviously not. https://github.com/trezor/trezor-suite/blob/develop/packages/connect-webextension/src/proxy/index.ts#L95

Isn't init required in all the TrezorConnect implementation?

That part of the Rabby code is running in the service worker and using the parseConnectSettings that will add DEFAULT_DOMAIN if connectSrc is not provided, but they decided to provide it explicitly.

Can we close this one as not planned?