Decrypting data encrypted with the user's PubKey in Snaps #313
-
Can anyone point me in the right direction to do data decryption in a Snap with the user's private key? I've tried importing @metamask/eth-sig-util but SES doesn't like that. I've tried wallet.request({ method: 'eth_decrypt' ...}); but that's not it either. I even tried passing the window.ethereum object as a param to the Snap call 😂 but again, no dice. This seems like a natural use case for Snaps and I hope I'm just being stupid and not seeing the obvious answer. I am using the ethers-js example Snap as my starting point, and it's very instructive. Thanks to the author! My Snap will take an encrypted array of user data that was used to generate a Merkle tree, the root of which was written on chain and allow the user to securely generate a Merkle proof of discrete elements of that array (user authorizes Snap to decrypt, provides discrete field(s) to share, Snap generates and returns Merkle proofs to the connected dApp). Thanks in advance and special thanks to @Montoya for the Discord invite and link to this discussion forum! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi Shawn! Thanks for reaching out. It turns out The current version of |
Beta Was this translation helpful? Give feedback.
Hi Shawn! Thanks for reaching out. It turns out
eth_decrypt
isn't working because the snap needs theeth_accounts
permission in order to use it. Please try adding that permission and see if it works.The current version of
eth-sig-util
may be incompatible with SES... @rekmarks will have to look into it to confirm.