Share files with anonymous users under an alias

I’m trying to build an app similar to an URL shortener service but I haven’t quite figured out if it is possible with Gaia.

Let’s say that User A, once logged in, uploads (putFile) a public file to Gaia. That file is accessible to other users who are also logged in in the same app by using something like:

(As User B, logged in in the same app)
userSession.getFile("hello.txt", { user: 'userA', decrypt: false })

Now, what I’m interested in is to be able to read the same file as an anonymous user (one that is not logged in in the same App) without going directly to the raw File URL in Gaia.

If I have the username of the User who originally uploaded the file (User A) and the name of the file (“hello.txt”), can I calculate the raw File URL to actually get the file from Gaia?

i.e. can I translate:
http://myapp.com/userA/hello_world.txt
to
https://gaia.blockstack.org/hub/dummy1234hash/hello.txt
as an anonymous user?

1 Like

Yes – see this FAQ entry.

1 Like

Awesome, thanks!