Using Ethereum public and private keys to encrypt and decrypt message (metamask client)

by James Shih   Last Updated July 23, 2018 14:28 PM

I am trying to use Ethereum private and public keys for message encryption like PGP and I found out this npm module on github, https://github.com/pubkey/eth-crypto#encryptwithpublickey, which it lets you get public key from private key, encrypt message with public key, and decrypt message with private key. I am using MetaMask as the web3 interface for my dapp and I am trying make the message encryption works seamlessly. However, I cannot find a way to automatically pass in MetaMask default account's private key to the npm modules rather than manually clicking export private key from MetaMask's extension UI.



Related Questions


ReferenceError: window is not defined

Updated July 10, 2020 19:28 PM


web3 and web3 provider engine

Updated July 28, 2018 08:28 AM