MetaMask
Restricted
Deprecated
eth_decrypt
Summary: Decrypts an encrypted message.
This method is deprecated and may be removed in the future.
Requests that MetaMask decrypt the specified encrypted message.
The message must have been encrypted using the public encryption key of the specified Ethereum address.
Returns a promise that resolves to the decrypted message, or rejects if the decryption attempt fails.
Parameters
EncryptedMessage string
requiredThe encrypted message to decrypt.
Address string
hex encoded address
Pattern: ^0x[0-9a-fA-F]{40}$
Returns
PermissionsList array
PermissionsList
Errors
Code
Message
4100
The requested account and/or method has not been authorized by the user.
Customize request
Parameter
Value
Connect your MetaMask wallet to run requests successfully.
Request
await window.ethereum.request({
"method": "eth_decrypt",
"params": [
"0x7b2276657273696f6e223a227832353531392d7873616c736132302d706f6c7931333035222c226e6f6e6365223a2243533967507076467071765358704655416679726a7179774e35302b7a747766222c22657068656d5075626c69634b6579223a224372774b61456d2f4b356d6d714239764c376f5872636d6441417757764479324f784c3333527135576e553d222c2263697068657274657874223a2248347a65336e7177572b753174663956343945506167454e343872774f766b6952676244566e47587a38493d227d",
"0xD1F5279BE4B4dD94133A23deE1B23F5bfC0Db1d0"
],
});
Example response
"Hello, Ethereum!"