Uplink-nodejs - how to create a sharable URL for an object in a bucket?

I can create shareable links to objects using the WEB interface, but how can it be done programmatically in nodejs?

Here, I can see that a shared URL has a structure like:

https://link.us1.storjshare.io/” + accessKey+ “/” + bucket_name + “/” + object_name

But I can’t find what this accessKey is and how I can retrive it from an “access”. In the links that I create in the web interface, this accessKey has 28 characters.

Basically, what I need is a link to the object that can be used in NFT metadata.

Have your read this ? :point_down:

1 Like

You need to generate an access grant and register it on auth service to get an S3 credentials with public access.
With CLI it is an equivalent of the command:

uplink share --url --not-after=+1h sj://my-bucket/my-prefix/my-object.txt


uplink share --register --public --not-after +1h --readonly sj://my-bucket/my-prefix/my-object.txt

As result you will get an access grant, S3 credentials and linkshare URL. Where Access Key is a key what you need to form this URL.
Please note --public option, without it these S3 credentials will not register an Access Key as public.

So, you need a share and register functions in uplink-nodejs.
Share: Document

Unfortunately, I didn’t find an analogue for storj/cmd_access_register.go at ea1408f7a842c0314f7a0064bfa325fb7faf3a6e · storj/storj · GitHub


Yes. I looked at the docs, but they only refer to CLI and I need to do this programmatically.
Obviously, I can always execute a shell command programmatically, but this is often not reliable and I would prefer to do it via code.

1 Like

Access part, I know how to do it. There is also an example in HelloStorj.
Unfortunatelly, the “register” part does no seem to be available in uplink-nodejs.

I would like to wait for developers (they are available on workdays) to confirm that.

If C# and .Net are an Option for you, you may take a look at uplink.net - it includes the register-functionality.

Not an option for me. But if a solution exist using python3, then I can use that as a temporary solution. The core development is in nodejs.

I concur with @Alexey- it looks like there is no code in uplink-nodejs to perform the RegisterAccess api. It also looks like there is no code for that in uplink-python, either.

I don’t think there is any fundamental reason why either library couldn’t provide that functionality.

I’ve gotten the topic onto a meeting agenda at Storj, so hopefully we’ll be able to get that work on the roadmap at least.


Thank you for the respose. For a PoC, I will try to get something running using one of the languages that support this feature.
Is this roadmap public?

I don’t believe we have any official public roadmap information right now, but we should be able to give you some idea of how it’s prioritized and/or scheduled.

I think shelling out to the uplink CLI might be the best thing for now.