Example code of using another peer public key

Hi,
Can someone please direct me to an example which show how to use another peer public key to encrypt some data and how to decrypt it on that other node?

I know I can get another peer public key using ipfs id <other-peer-id>.
I’m not sure how to use that key to encrypt the data, leveraging this is multikey which can be of different types?
I’m also not sure how to obtain the private key on the other node? I know it stored in IPFS_PATH/config under Identity->PrivKey but what is the public API to get it?

I don’t care if the impl will be in go or JavaScript. Also I’ll handle getting the encrypted data to the other peer.

Thank you,
Ido.

If you want that, you probably should be looking for libp2p.

Very late, but I just spent a long time trying to figure out the same thing. Got it working in JavaScript here: https://gist.github.com/npfoss/663689d74a2318c13cb8754cef295e6a