Skip to main content

Wallet API documentation

Directly integrate your dapp with the MetaMask extension.

MetaMask
Restricted
Deprecated

eth_getEncryptionPublicKey

Summary: Gets a public key used for encryption.

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.

Parameters

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

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

Returns

EncryptionKey
string

Customize request
Parameter
Value
string

Connect your MetaMask wallet to run requests successfully.

Request

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

Example response

"0x04bfcab3b7ca7e8b3f3b62b2f7f77e9e4b68080bbf8f0f4a1c8f890864d2c7c1d3c45d8b2e3f5f1c27dfeea4c2f5733e90bfc7484e2a690aa9b8ac4559d2e6a8d7"