Create "Access Grant" with "Storj API"

Does a way exist to use the “Storj API/ SDK” to pragmatically create a “Access Grant/Token” and assign it to a bucket ?

I can not find a way to do this but it is such a normal operation so surly it does exist.

Never mind Can an Access Grant (token, name, permissions, buckets, etc.) be created programatically? - #2 by Erikvv

Hello @scottie ,
Welcome to the forum!

You can also take a look on: Storj - Third Party · GitHub

1 Like

Thank you but can you tell me the equivalent of GO’s " func (*Access) [Share]" in JS / nodeJS ?
The documentation seems to not be very explanative.
(GitHub - storj-thirdparty/uplink-js: ES9+ compatible Storj bindings, for use with Tardigrade.)

How would one create a new “Access key” , create a new bucket and grant it permission’s ?

Looks like it’s not implemented yet. Unfortunately the JS bindings are lacking.

I see uplink-nodejs/access.ts at e9a49b4df93663a5461535adbb469e037baa4301 · storj-thirdparty/uplink-nodejs · GitHub in the other library.

1 Like

That library is extremely convoluted but I will give it a go thank you :frowning:

Matter of fact its near impossible to install on windows:

  λ npm --version
  8.3.1
  
  λ node --version
  v16.14.0
  
  λ make --version
  GNU Make 4.3
  Built for x86_64-pc-cygwin
  Copyright (C) 1988-2020 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  
  λ go version
  go version go1.18.1 windows/amd64

  λ python --version
  Python 3.10.2

I wonder why do companies pretend they offer library’s for other languages when its just a wrapper around the GO implementation, why not a native JS implementation ?

I guess I have no choice but to change my entire project to GO if I would like to use Storj.

That library is extremely convoluted but I will give it a go thank you

Maybe you can add the function binding to the uplink-js library.

I wonder why do companies pretend they offer library’s for other languages when its just a wrapper around the GO implementation, why not a native JS implementation ?

The libraries are community contributed. I do hope more people step up as maintainers, especially for JS. I’m trying to do my part as far as bindings go.

1 Like

@scottie - Mainly because it’s easier to maintain. If a project had to support independent implementations in every language(and OS) it increases the surface area for vulnerabilities, bugs, and overhead. The downside is the tool-chain for building introduces complexity which causes challenges.

Check out:

and let me know if you don’t see what you’re after - we can look to get it added. There is also a HelloStorj.js example to refer to.

Regarding the windows builds - we have validated the pinned versions work on windows:

* Windows
    * Version: 10 Pro
    * Processor: Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz 2.00GHz
    * Node version : v10.18.1

though the binding is a bit old.

Thanks!

-K

1 Like

Thank you yes that is exactly what I require in your links, but I am sorry to say it does not work on windows and I am not alone in this.

Maybe you can assist me, all paths are set and my tool versions are posted above.

Whilst doing a npm install, I receive the error:

(cd uplink-c) && (go build -o ../libuplinkcv1.2.4.dll -buildmode=c-shared) && (move *.h ../)
no Go files in C:\Users\scott\OneDrive\Desktop\work\code\latency\storj-api\uplink-nodejs
make: *** [Makefile:30: build] Error 1

Technically you guys did answer my question maybe I should open a new post in regards to the above I am not sure on the protocol for asking questions.

1 Like

Thank you I understand, you guys did answer my question and for that I am much appreciative.

That indicates the build process for uplink-c failed for some reason. I’m actually downloading a windows 11 virtualbox image to my mac(which is crying) right now to dabble with it.

Just spent some time getting it setup and I can confirm the binding works on windows 11 enterprise (dev2204eval):

I did run into an error where some files were missing:

C:\Users\User\Downloads\test\uplink-nodejs\libUplink_win.cc(4,10): fatal error C1083: Cannot open include file: libUplink_win.h: No such file or directory [C:\Users\User\Downloads\test\uplink-nodejs\build\uplink.vcxproj]

for some reason the build process seems to be removing some headers, on windows 11 at-least.

What I did - Pre-reqs:

  • install go
  • install node
  • choco install make
  • choco install mingw

From instructions at GitHub - storj-thirdparty/uplink-nodejs: NodeJS / typescript bindings for libuplink

npm install -g node-gyp
git clone https://github.com/storj-thirdparty/uplink-nodejs.git
npm install
git reset --hard origin/master  (yea - I don't know why the build script is removing some headers)
npm install
npm test

It’s important to keep in mind these bindings were made a few years ago with only a few wonderful community contributions since then. I would like to give a great shout-out to all the repo contributors that volunteered, and continue to contribute, their efforts. If there is a desire to update the bindings I’m sure the community can rally to submit PRs as they have in the past.

*note: I don’t know why the git reset changed the behavior of the build as everything should be under version control, though something that was built likely is untracked. It shouldn’t take someone more than a few days to debug and document if anyone wants to pick it up.

mate I did everything you did, but tomorrow I will try again and let you know. I assume you did a CD in your instructions above?

thank you for taking the time to time to test on a VM much appreciated !!
I truly do appreciate your effort !

1 Like

You suggest it is a C error yet it is clearly a go error ??0_o ?? neither the less I really appreciate what you did with the VM to test and now I know regardless I to can replicated your results <3 !! I assume you did a cd into the git dir in the instructions above you forgot to include ?

1 Like

No worries - happy to help.

It looks like you got a different error - I cannot comment on what other configs you have in your environment that may cause your particular error. Your error looks like an issue with the PATH the build script ends up using.

If you can try with a fresh install of go that may be best. Also when installing node be sure to run as administrator and include the additional build tools - nodejs’s installer runs a powershell script to install several visual studio build environment tools that are required.

1 Like

Thanks mate, I still had issues so I just installed linux, sorted :slight_smile:

2 Likes