Does Gaia provide Public Key cryptography or similar mechanism?

I have the following scenario:

User A creates a file and would like to share it with User B. User A wants to encrypt the file, or parts of the file (content), with the public key of User B so that when User B uses multi-player storage, he can decrypt the file, or parts thereof, with his (User B) private key.

The tutorial for multi-player storage shows that in order to share data you need to be unencrypted. How can I achieve a scenario as described above? As I look through the API, I don’t see methods to get another user’s public key and then to encrypt content using another user’s public key. If public key cryptography isn’t the correct approach to this problem, then what does Blockstack propose?

Edit:

Nevermind. Looks like I can use lookupProfile and the Profile object contains the PublicKey for User B. And then I can encrypt the entire file or parts thereof using encryptContent.

3 Likes

Yep-- that’s pretty much the approach we recommend. In applications, the application doesn’t get exposed to the user’s private key directly – rather, the application receives an “application specific key.” Most applications write a user’s app-specific public key to a well-know file location like my_public_key.json — and then use the encryption support in blockstack.js to encrypt with that specific public key.

1 Like

When I do blockstack.lookupProfile on a Blockstack ID, I get back a profile object with no public key. I feel like I missed something obvious, but unsure.