Hey Folks, I am trying to encrypt my file before uploading it on ipfs using metamask, then I want to decrypt this file using metamask.

Can any one has idea how can I achieve this.

1 Answer 1


To encrypt: https://github.com/MetaMask/eth-sig-util -> encrypt()

Encryption won't require a Metamask interaction, only the publicKey value.

To decrypt, you can use the code:

const decrypt = await window.ethereum.request({
    method: 'eth_decrypt',
    params: [ct, account],

You can check the references and explanation here.

  • Thank you, but I got the answer for that, same answer I found for the question. Commented Jul 20, 2023 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.