Succes in registering with rust :)

I just managed to register a rust program to the launcher and thought I’d share my joy !

ok, so far, it does… nothing :wink:

But the door is open ! Muhaaaahaahaaaa

EDIT – a work in progress of the code is available here : GitHub - wrnice/rsafe: rust Safe client library


Can you share how you did that and where the sourcecode can be found?

Muhaaaahaahaaaa :stuck_out_tongue:


Sure I am just trying to translate the nodjs example from /auth into rust

Here is the ugly code :

EDIT – link removed,
a work in progress of the code is available here : GitHub - wrnice/rsafe: rust Safe client library


Your smoke test is very exciting to me. Thanks for posting this. Developers developing services: It’s an exciting time indeed!


Very cool.
I was initially surprised that the demo application and launcher is NodeJS, not Rust. But I guess that’s explained at least partially by the difficulty of doing GUI in Rust.


Yup, GitHub - rust-unofficial/awesome-rust: A curated list of Rust code and resources. is a bit limited. IMO that goes for any non-C++ project that wants GUI (unless you want to use wxwidgets’ python lib or something like SWT). I did read in This Week in Rust 123 · This Week in Rust that Forget everything you knew (gtk 0.0.7) – gtk-rs has gotten a facelift.


GitHub - PistonDevelopers/conrod: An easy-to-use, 2D GUI library written entirely in Rust. looks cool and promizing too

1 Like

Also there is this ^^ made a bunch of things with it until major api changes,

though now very much going the direction of nodejs for GUI since rust has the ffi for javascript, makes sense to use it.

1 Like

I have been struggling with creating a dir, I keep getting a 401, not sure which when reading the launcher code.

The auth GET ( line 181 ) does return a nice 200, so I guess my handling of the token is fine.

Is the “Content-Type: text/plain” header mandatory ? I wonder if it could be because of not including it, but I don’t see it in the launcher code, and its not in the nodejs example either. GitHub - alexcrichton/curl-rust: Rust bindings to libcurl doesn’t seem to want to send more than one header field.

Any rusty angel by my side ?

I guess you can add multiple headers in the code that you have linked. I am not able to get your code compiled on my windows machine (curl-sys fails).
Can you please try adding .header("Content-Type", "text/plain") after line 227 in your code. It is supporting chained syntax, my guess should work hopefully.

1 Like

Mmmm, it does compile and run fine, but still I get the 401.

Thank you anyways for the idea. I will try to think differently !

1 Like

maybe you need both headers, the authorization token and the content-type headers @nice did you try both together/

yes, I did try with both as per Krishna_Kumar suggestion, but it seems to not change anything.
Right now I am trying to make sure what I am sending. I wish the laucher would be a bit more verbose :slight_smile:

@nice - Please do not create directories with metadata right now…there are issues, ref: Log in with Atlassian account but that doesn’t explain the 401. The error could be several things, I have not debugged a ton. One of the things to review is make sure your shared key and nonce extraction appear right. Can you get a sniff of the HTTP traffic exactly?

Thank you for the hints - I changed the metadata to an empty string, ( still 401 ), and captured the dialog with wireshark :

I am not sure I am sending the correct body, though. From what I understand in the API example and SAFE rust nfs example , I have to :

-serialize the payload structure as a JSON
-change it to bytes
-encrypt the bytes with sodiumoxide
-encode the encrypted bytes as a base64 string
-send this in a POST request to http://localhost:8100/nfs/directory, with the correct headers
-make a prayer

What I did is here :

( sorry pastecode messes with long lines )

1 Like

I can only speculate. 401’s are a result of a bad auth header or even failed decryption in a catch all it appears. I can only speculate that the shared key and nonce being used are not extracted right somehow. But I’m afraid you’ll only know where it breaks if you compile the launcher yourself and debug. You can use other clients listed at SAFE API Client Libraries (Go, Ruby, ...) (and even use their shared keys yourself) to test on your end as well.

yes, I spent enough time on this 401 today that now this seem to become profitable :slight_smile:

Maybe a crypto_box versus crypto_box_easy distinction? I had some trouble with that in Python (edit: unlikely, as you manage to open the first box).

Also are you sure this is correct:

        for it in vec_decrypted_symm_key_nonce.iter().take(sodiumoxide::crypto::secretbox::NONCEBYTES).enumerate() {
            symm_nonce.0[it.0] = *it.1;
        for it in vec_decrypted_symm_key_nonce.iter().skip(sodiumoxide::crypto::secretbox::NONCEBYTES).enumerate() {
            symm_key.0[it.0] = *it.1;

The layout of the decrypted key is

data[0:crypto_secretbox_KEYBYTES] -> key
data[crypto_secretbox_KEYBYTES:] -> nonce

You may have them swapped.


ooooh MAN I OW YOU A BEER ! :beer:

    for it in vec_decrypted_symm_key_nonce.iter().take(sodiumoxide::crypto::secretbox::KEYBYTES).enumerate() {
        symm_key.0[it.0] = *it.1;
    for it in vec_decrypted_symm_key_nonce.iter().skip(sodiumoxide::crypto::secretbox::KEYBYTES).enumerate() {
        symm_nonce.0[it.0] = *it.1;

code=200; :dizzy: :boom: :tada:


@nice the pastebin 404’s could you repost it?