-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Login per site onboarding #7602
Conversation
5ea1378
to
6d253ce
Compare
6bbaba4
to
516ace2
Compare
Builds ready [516ace2]
|
516ace2
to
06dd852
Compare
Builds ready [06dd852]
|
I think I may be missing something conceptually here: Marking a user as If the user doesn't have MetaMask installed yet, how would MetaMask catch an rpc message like |
The It's the same flow as in this diagram (created for #7017 ): |
Oh awesome, that's a wonderful diagram for demonstrating the flow! |
I'll need to test this out locally. @tmashuang would you mind playing around with it as well? |
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.
Read through all the code. 👍 for the solution for passing the sender and its data through to metamask-controller setup functions.
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.
I had one, really nitty nit
. I love it!
The Port `sender` has been passed down a few more layers. This allows us to get more information from the sender deeper in the stack, but also simplifies things a bit as well. For example, now the "fake" URL object with the `metamask` hostname is no longer needed.
This middleware intercepts `wallet_registerOnboarding` RPC messages. It will register the sender as an oboarding initiator if possible, and otherwise ignores the message.
06dd852
to
c31e5cc
Compare
Builds ready [c31e5cc]
|
* @param {{ location: string, tabId: number, registerOnboarding: Function }} opts - The middleware options | ||
* @returns {(req: any, res: any, next: Function, end: Function) => void} | ||
*/ | ||
function createOnboardingMiddleware ({ location, tabId, registerOnboarding }) { |
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 could pull the tabId
from the request in a world where #7695 is merged first
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.
That PR relies upon many things in this PR, but yes I agree that it might be cleaner to do it that way. That can be a follow-up PR.
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, this is a clean implementation
This PR restores the functionality required for one-click onboarding that was removed in LoginPerSite due to the provider refactor. Instead of restoring a similar "experimental" function that used an independent onboarding stream, the onboarding registration is now implemented as custom RPC message:
wallet_registerOnboarding
. This message is captured by middleware, which registers the sender's origin and tabId as being the onboarding initiator.This PR depends upon this forwarder PR and this onboarding PR being merged and published first. (Update: those have both been merged and published! 🎉 Thanks @whymarrh )
sender
through tosetupProviderEngine
The Port
sender
has been passed down a few more layers. This allows us to get more information from the sender deeper in the stack, but also simplifies things a bit as well. For example, now the "fake" URL object with themetamask
hostname is no longer needed.This middleware intercepts
wallet_registerOnboarding
RPC messages. It will register the sender as an oboarding initiator if possible, and otherwise ignores the message.