Skip to main content

eth_getEncryptionPublicKey

MetaMaskRestrictedDeprecated

This method is deprecated and may be removed in the future.

Requests that the user share their public encryption key. Returns a public encryption key, or rejects if the user denies the request. The public key is computed from entropy associated with the specified user account, using the NaCl implementation of the X25519_XSalsa20_Poly1305 algorithm.

Params

(1)

1. Address (required)

The address of the Ethereum account that can decrypt the message.

string
Match pattern:
^0x[0-9a-fA-F]{40}$

Result

(EncryptionKey)
string

Example

Request

await window.ethereum.request({
"method": "eth_getEncryptionPublicKey",
"params": [
[
"0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7"
]
]
});

Result

"0x04bfcab3b7ca7e8b3f3b62b2f7f77e9e4b68080bbf8f0f4a1c8f890864d2c7c1d3c45d8b2e3f5f1c27dfeea4c2f5733e90bfc7484e2a690aa9b8ac4559d2e6a8d7"

Params

Address


Request

await window.ethereum.request({
"method": "eth_getEncryptionPublicKey",
"params": [
null
]
});