-
Notifications
You must be signed in to change notification settings - Fork 209
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
MetaMask + Discord integration - with Weba-Wallet #1762
Conversation
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.
Overall good, but needs some tweaks.
It is now being handled by weba-wallet. |
Added description and updated Title. |
2e7ebe5
to
498fec3
Compare
else { | ||
fetchWalletData('privateKey'); | ||
} | ||
}, [address, setAddress]); |
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 think this setAddress
is probably pointless?
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.
Actually never mind, I can see how the way the code is structured it could be needed!
Added Login modal with two buttons, MetaMask, and Discord respectively.
Integrated Discord Login
Integrated Weba-Wallet storage module.
Flow:
When the user logs in, App calls the setAddress setter to set the user's address and sendDataToWallet function to save the user's privateKey in Weba-wallet secure storage.
sendDataToWallet function opens hidden iframe and sends postMessage to weba-wallet along with user's privateKey.
Weba-wallet validates the app's origin receives privateKey, encrypts it, and saves it in localStorage.
For the next time, the user doesn't have to login again because on login App will request Weba-wallet for the user's privateKey using fetchWalletData('privateKey').
If Weba-Wallet validates App origin, it will decrypt privateKey and returns it. And by using that privateKey, App will fetch the user's address and set it.
Flow Diagram