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

Use WalletConnect #2962

Open
michaelfig opened this issue Apr 26, 2021 · 3 comments
Open

Use WalletConnect #2962

michaelfig opened this issue Apr 26, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request wallet

Comments

@michaelfig
Copy link
Member

What is the Problem Being Solved?

We need a more standard and robust wallet bridge. #2730 is just one of the issues we face because of our existing ad-hoc iframe/WebSocket wallet bridge implementation. Other problems include its difficulty to port to non-web-based apps as well as mobile.

Description of the Design

We should just use WalletConnect

Their @walletconnect/client package works in browser and Node.js. They also have client libraries for other languages, too, especially under mobile. Their "client" protocol is intended for both wallets and dapps, and uses a non-trusted bridge service (including allowing dapps to specify their own bridge rather than the default).

The rendezvous requires communicating a connection string. By default, they do this via a QRCode since that supports mobile best. Their default dapp connect popup also has a "copy to clipboard" option for getting the connection string. So, it would make sense for our current wallet to have an input to allow pasting such a string.

For seamless desktop wallet (such as Pledger) with HTML-based dapp integration, I plan registering the wallet as a wc:... URI handler, then extending the dapp's wallet connect dialog to include <iframe src="wc:..." width="0" height="0"></iframe>. That way, the browser will prompt for the connection.

The code at https://docs.walletconnect.org/quick-start/wallets/react-native#initiate-connection is pretty clear for how we could adapt their connection lifecycle to do the same work as the wallet-bridge handshake currently does. Then we could tunnel CapTP over the Custom Request API.

Security Considerations

We would actually tunnel the dapp-to-wallet connection over the Internet, but fortunately there is end-to-end encryption provided in the @walletconnect/client library.

Test Plan

@michaelfig michaelfig added enhancement New feature or request wallet labels Apr 26, 2021
@michaelfig michaelfig self-assigned this Apr 26, 2021
@michaelfig
Copy link
Member Author

@katelynsills, @dtribble, @warner please take a look at this proposal for portable, robust dapp-to-wallet communication.

@katelynsills
Copy link
Contributor

From what I can evaluate, this sounds like a good plan.

@dtribble
Copy link
Member

I agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wallet
Projects
None yet
Development

No branches or pull requests

4 participants