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

MetaMask + Discord integration - with Weba-Wallet #1762

Merged
merged 43 commits into from
Nov 30, 2021
Merged

Conversation

mujabmuneeb
Copy link
Contributor

@mujabmuneeb mujabmuneeb commented Nov 9, 2021

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

@mujabmuneeb mujabmuneeb requested a review from avaer November 9, 2021 11:13
constants.js Outdated Show resolved Hide resolved
Copy link
Contributor

@avaer avaer left a 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.

src/components/modal.js Outdated Show resolved Hide resolved
@mujabmuneeb mujabmuneeb changed the title Discord integration a MetaMask + Discord integration - along with Weba-Wallet Nov 28, 2021
@mujabmuneeb mujabmuneeb changed the title MetaMask + Discord integration - along with Weba-Wallet MetaMask + Discord integration - with Weba-Wallet Nov 28, 2021
@mujabmuneeb
Copy link
Contributor Author

Is this a hardcoded password? If so it should at least be a constant.

It is now being handled by weba-wallet.

@mujabmuneeb
Copy link
Contributor Author

This PR also needs a description.

Added description and updated Title.

else {
fetchWalletData('privateKey');
}
}, [address, setAddress]);
Copy link
Contributor

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?

Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants