-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Decrypt is rejected with message of "MetaMask DecryptMessage: User denied message decryption." even though the user clicks on "Decrypt" on Metamask #4139
Comments
I don't think this has anything to do with ethers.It looks like MetaMask returned a rejected error. I know MetaMask is deprecating the decrypt method as there are potential security vulnerabilities with it. Did you recently update and maybe they are enforcing the deprecation now? Or does it maybe need to be enabled in the MetaMask settings? Can you try adding |
Thank you for your comment. I have tried above to get more logs, but it does not seem to give me extra information, only the following:
As much as I know For reference: |
@Eric1015, I guess the api doc you read is a bit insufficient, and therefore mislead you. The first argument isn't just the encrypted string itself, but it is either a) stringified JSON of the whole encryption result (ciphertext, nonce, version, and ephemPublicKey), or roughly a JSON-Buffer-HexString encoded version of aforementioned a). (code example is provided below) The
So the first argument of eth_decypt can be like: The following link may help. |
@promet99 Thank you for your comment, yeah you are right. It seems like I was using them in the wrong way. Closing this issue. |
Ethers Version
6.5.1
Search Terms
metamask, decrypt, eth_decrypt, ethers.js
Describe the Problem
I was trying to test the encrypt and decrypt feature of ethers.js with the public and private keys from the metamask wallet and built a really simple application that will retrieve the public key and encrypt the user's provided string, then decrypt the encrypted message to see if it will go back to the original message. When I clicked on "Decrypt" after initiating decryption, it throws the error saying the user is denying the decryption action. Screen recording attached.
Screen.Recording.2023-06-12.at.1.13.23.AM.mov
The full code can be found here too: https://github.com/Eric1015/metamask-encrypt-file-example
Code Snippet
Here is the code of how I am decrypting the message:
The
provider
inside of the state is created in the following manner and stored as state:Errors
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli)
Environment (Other)
Sepolia
The text was updated successfully, but these errors were encountered: