Say I have a hash of a file which is stored on IPFS.I want to encrypt the hash with public keys of few people.
How can I do the encryption of the hash (encrypted hash should be stored on smart contract) using react web application.
And can others decrypt the encrypted hash ,to get the actual IPFS document ,using their private key (Asking a user to enter their private key in a web app can be a bad practice) ,can we do this using decryption using Metamask or any?
Best Answer
eth-crypto will do the job for you, you just need the list of the public keys of the people who are allowed to decrypt the encrypted content.
Here is example how you encrypt content with public key:
And example how to decrypt the encrypted text via private key: