Release: SAFE Authenticator NuGet pkg


I needed a C# authenticator to be able to connect to Alpha-2 network, since the available code in MaidSafe.SafeApp C# nuget only allowed browser auth or mock auth.

The SAFE Authenticator CLI announced just now, wasn’t going to cut it for me, so I went to

…and extracted the necessary code to be able to release a NuGet package with an AuthClient that any C# application that needs to run as a background service for example, can use to connect to Alpha-2 network.

I compiled safe_authenticator from commit b8917dc and included it in the solution.
But further on, this should be fetched from{TYPE}-{TAG}-{TARGET}.zip just as the android and ios natives.
This project can also be extended for Xamarin, so that this nuget could actually be referenced in say,, instead of implementing it there.

How to use it

The crust.config file is currently connecting to Alpha-2 network, which is a test network maintained by MaidSafe.
This test network has a temporary spam-prevention mechanism, which requires some activity
on SAFENetwork Forum before you can get an invitation to use when creating an account with SAFE.AuthClient.

You can read about how to get the invitation here:

Creating a session for interacting with the network

static async Task Main()
    var credentials = new Credentials("some string", "some other string");
    var config = new AuthSessionConfig(credentials);

    using (var client = await AuthClient.InitSessionAsync(config))
        var session = await client.CreateAppSessionAsync(GetAuthReq());
        var app = new SomeApp(session);
        await app.RunAsync();

See more in AuthClientExample.cs file, in Examples folder of the solution.


:clap: Interesting stuff @oetyng!

I’m curious what’s lacking from the auth cli for you at the moment (or is it more that it doesn’t build for live at this time?) ?

What would you like to see in there to make it useful?

Or is a CLI just not fit for this purpose?


Yeah :slight_smile: , this thing has a little story to it actually.
I started out raising an issue in safe_app_csharp repo, then it hit me that all parts were there for me to implement this myself, and I got very excited to do it. This was Thursday I think. Just when I was about to start, my machine motherboard burned. Litterally burned. It sparkled and gave off nasty smoke.

So I had to confiscate our crappy laptop that we use to watch Netflix, wipe it clean and install a dev environment on it. Sat up all night watching updates and things progress sloowly and like “comoooon… I’ve got this awesome code to write…!” fingers itching as hell :joy:

Only Saturday morning I could start for real. But now I’m up and running again :slight_smile: (Not directly on the SAFE.NetworkDrive repo unfortunately, as I had uncommitted changes on my SSDs. But I have plenty of related things to develop, that will get handy there, like this Authenticator, sharing of dbs in AppendOnlyDb, and some more things… :slight_smile: )

Several things actually

  • Most of all that CLI is not fit for the purpose, since creation of accounts and logins are automatic, with derived credentials that the user doesn’t know.
  • Second, that I needed it for Alpha-2 connection (next step for the NetworkDrive now, moving on from Mock).
  • Third, I wanted an easy and convenient way to include this in any project from now on, without needing to re-implement anything.

And then also, I saw it was fairly easy to put together with existing components, so it was just very low hanging fruit. (Riding on the shoulders of giants here, since I could snip parts out of MaidSafe repos).


Also, I had a previous implementation of SAFE.AuthClient on nuget, but it was waay too specific to my usage of AppendOnlyDb (a cumbersome setup of factories, interfaces related to my Dbs), and only with Mock network.

I switched it out for this clean authenticator thing only (where we have an authenticator client, with which we can create n SafeApp Sessions), and none of my interfaces and so on. So it’s now truly a SAFE.AuthClient.

This seemed important to me because I saw it was the most popular download from nuget, so I thought it was making people curious about SAFENetwork, and I wanted to make it something really useful. (First it was there mostly to make my repositories easier to maintain).

So, here is now the new SAFE.MockAuthClient (a few minutes fresh on nuget)
with the new logo which I think @JimCollinson did for SAFE.NetworkDrive :slight_smile:

I thought it nice to separate these now. I was trying to figure out a way to put the mock in the SAFE.AuthClient, but it would have required more work with the native libs and I’m not sure it would even be better.

EDIT: So background for MockAuthClient nuget is that I needed it in the test-project of SAFE.AppendOnlyDb now that SAFE.AuthClient is for live network only.
So, now I can add SAFE.MockAuthClient from nuget, to any test project for the various solutions. SAFE.AppendOnlyDb for example has no code for initiating sessions, as it is supposed to be referenced by higher layers that deal with that. But it’s convenient to be able to test it out with a slim and focused package in the test project, and of course only mock needed there.


We call that “letting out the magic smoke” :tired_face: Used to do it as teens by soldering a wire down one side of a chip and another on the other side and putting them across 20+V Nice crater in the centre of the chip. Over the decades I’ve matured and just zap them with 240

Anyhow joking aside, that is not good. If you were close by I have a couple of “old” ones that you could have used.

Great work you are doing @oetyng and I admire you for that.