Hello world safe app

It is totally unclear for me (a developer that wants to build an app with SAFE) how to do it? Is it going to be any “hello world SAFE App” tutorial in the nearest Future?

5 Likes

One should be coming at the end of this sprint. A week or two.

4 Likes

Wait weren’t the installers supposed to come out yesterday? Or are we onto a new sprint?

They extended this sprint an extra week. So next week? Or am I a week behind?

Edit: I guess I’m a week behind.

1 Like

We finished the sprint but need to catch up (API changes were bigger than anticipated), nobody said yesterday AFAIK.

6 Likes

first things first :slight_smile: i’m looking forward to the installers and will have my parents and other friends play around with them! =)
… but for them being a little bit impressed and getting as enthusiastic as i am i’m very willing to wait some days :wink: you can’t predict everything accurately … thats just how it is in life

there will be tutorials as soon as it makes sense to have them @Anton_Kulaga =) have a cup of tea+some cookies and watch awesome stuff happening in this forum :smile: too much pressure isn’t good for code quality

(ps: and MS isn’t that bad in terms of reaching goals in time :smiley: i’ve seen a project falling back 3 years in their schedule within 2 years of work xD )
(pps: ok time for a bad joke: reverse engineering just became redefined!)

2 Likes

I have been struggling in the past few days to understand how the demo app works, and this is because I am new to Nodejs, Electron and Angular. Those 3 products tied together in the application make it difficult for an inexperienced developer like me to see, behind them, how javascript talks to the SAFE Network via the safe-api.

While I am working to get better in those areas, I think newcomers and people without advance experience in web development could benefit from a very simple tutorial, stripping all the dynamic UI, only comprised of one or 2 html pages and javascript files, showcasing how to put and get a helloworld public text file.

The tutorial could come in 2 flavors:

  • One as an Electron app, because it could also present how to authenticate to the Launcher.
  • The other one could be a basic website, that the user could upload via the demo “Manage Websites”, showing how a webpage can tap into safe to put / get a text file.
3 Likes

I think it might even be easier if it’s done without Electron as that adds complexity in itself (e.g. Golang w/ the HTTP client + nacl/ directory - golang.org/x/crypto/nacl - Go Packages). But here’s an example of me authenticating and getting a key to the launcher with my own app: safe-poc-browser/api.js at master · cretz/safe-poc-browser · GitHub. Granted I don’t use the key in code, it shows how it’s done. This is the same thing that is done in the demo app. I would be very happy to explain anything from the API perspective or the Electron perspective about how the API works and how to auth and use it programmatically.

Websites cannot “tap into safe” yet, though I think instead of my POC I might just build the browser to show how this can be done.

The main reason I haven’t published any documentation or tutorials is because I fear that the APIs aren’t stable. Actually, I take that back, I hope the APIs aren’t stable because the launcher API leaves a lot to be desired (nacl whole-thing crypto instead of TLS (or nothing considering it’s localhost to localhost), not using proper HTTP headers for different pieces, some things in the path whilst some in the query string, etc).

3 Likes

Thank you for your reply, I will look at your example, which, though I do not understand yet, at least I could compile and launch :yum:

I thought only binaries were able to authenticate against the Launcher, but if this is unnecessary, this is will indeed be easier.

Anything that can speak to localhost:8100 on your system can auth as an app. But there may be some confusion when you use the word binaries…nothing has to be precompiled or anything, but that is a much nicer way to distribute software.

I don’t understand how does javascript able to connect to rust, and does things with it? I’m perplexed.

A quick rundown of the flow. My nodejs app connects over HTTP to the launcher node app which uses a node FFI lib to communicate via C ABI exposed in safe_ffi which is statically built with the other safe_* libs it talks to. And then all the way back (not even speaking of base 64 encoding and nacl encryption that is done between the two node pieces or the base 64’ing that happens between the launcher and the safe_ffi).

2 Likes

Yeah languages aside I think I’d need pictures to understand any of this.

I am hoping to have something like this working for others to play around with soon. I agree that it isn’t obvious to many folk what can be achieved already with the API. Some good examples will go a long way here.

3 Likes