eth_decrypt
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.
Params
(2)1. EncryptedMessage (required)
The encrypted message to decrypt.
2. Address (required)
The address of the Ethereum account that can decrypt the message.
Result
(PermissionsList)The permission ID.
When two people communicate with one another, the conversation takes place in a shared environment, typically called 'the context of the conversation.' This shared context allows the individuals to use shortcut terms, such as the first name of a mutual friend, to communicate more quickly without losing accuracy. A context in JSON-LD works the same way: it allows two applications to use shortcut terms to communicate more efficiently without losing accuracy.
A URI of the dapp being granted this permission.
A capability document modifies the caveat property to specify usage restrictions. Capabilities inherit restrictions from the caveat properties of their parent documents and can add new caveats in addition to those inherited from their parents.
Type of caveat.
Value of the caveat.
Name of the caveat.
Errors
Code | Message |
---|---|
4100 | The requested account and/or method has not been authorized by the user. |
Example
Request
await window.ethereum.request({
"method": "eth_decrypt",
"params": [
[
"0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7",
"0xDeaDbeefdEAdbeefdEadbEEFdeadbeefDEADbEEF"
]
]
});
Result
"Hello, Ethereum!"