Closed marcuspuchalla closed 1 year ago
You refer to the situation where a user has already been established a connection between a dApp and its wallet in the past and revisit the dApp again?
Currently the user would have to allow the connection on every reconnect (if verifyConnection has been implemented that way) and your idea would be to introduce a possibility to automatically connect the dApp to the wallet if the autoConnect property would be set?
I just had to write it in my words to see if I understood it correctly 😊
Basically, yes 😄 It might have been too late yesterday, and my description was too lengthy.
So after the implementation, there are three use case scenarios that DApps can choose from.
This is what the DApp would have to do:
In case 1. the DApp does not have to do anything and does not implement the verifyConnection. In case 2. the DApp can provide a simple dialog in verifyConnection "Do you want to connect to Wallet X ?" In case 3. the DApp provides an extensive dialog in verifyConnection "Do you want to connect to Wallet X ? + an e.g. additional checkbox to allow the wallet to auto-connect"
I'll create a draft PR for this today.
Thx @marcuspuchalla PR reviewed & merged 🎉 😊 .. The new release has been built and published to npm
Currently, the implementing dApp can accept an incoming connection automatically if it does not specify a verifyConnection callback. Or if it specifies a callback, it can signal the connector the allowance was given.
To further extend these functions and allow DApps to more precisely determine which wallets are allowed to connect automatically and where the user shall be asked, I propose extending the current function in this way.
Add optional property
requestAutoConnect
boolean property toIWalletInfo
, indicating if the connecting wallet is requesting an auto-connect connection.Extend the interface
DAppPeerConnectParameters.callback
function to take a second parameter,allowAutoConnect
. The implementing DApp can use this parameter to signal if the user has allowed connecting using auto-connect. (Of course the DApp can still not use this and fall back to asking the user for permission every time he connects.)Add optional property
autoConnect
toIConnectMessage
, which signals the client if the user and the DApp accepted the auto-connect.Adjusting all
connect
rpc calls inDAppPeerConnect
to forwardallowAutoConnect
to theautoConnect
property.This way, the DApp can decide in
verifyConnection
callback if a connection from a specific walletIn the latter case, the DApp could also implement the user with an interface to show which wallets he has used to connect to it, which are still active, and let the user manage wallet permissions.
I would appreciate any comments on this idea and am open for discussions. If we agree on adding this, I can add a PR.