Unexpected format of encode_auth_req response

I have now compiled safe_client_libs and have got safe_app.dll 0.4.0 which I access in my .NET port.
(I went through the rustup installation for win10, then cloned safe_client_libs, and ran cargo build --all --release)

So, the request to EncodeAuthReq returns some string.But it seems to not contain a base64 encoded part, it looks like this:
(i.e. likely not base64 since it does not match this:

String regex =

Also, it does not contain the clear text parts that class UrlFormat (from the mobile library) seems to be expecting, i.e.:

code snippet

if (toNativeLibs)
inputUrl = inputUrl.Replace("://maidsafe.net/", “:”);
switch ((inputUrl.Length - inputUrl.IndexOf(":", StringComparison.Ordinal) - 1) % 4)
case 2:
inputUrl += “==”;
case 3:
inputUrl += “=”;
if (!inputUrl.StartsWith(“safe-auth”))
var base64Pfx = inputUrl.Substring(5, inputUrl.IndexOf(’:’) - 5);
var bytes = System.Convert.FromBase64String(base64Pfx);
var normalPfx = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
inputUrl = inputUrl.Replace($"{base64Pfx}:", $"{normalPfx}:");
inputUrl = inputUrl.Replace(":", “://maidsafe.net/”).TrimEnd(’=’);
return inputUrl;

So, according to GenerateAppRequestAsync method in AppSession.cs in SafeMessages project, it should go like this:

var encodedReq = await Session.EncodeAuthReqAsync(authReq);
var formattedReq = UrlFormat.Convert(encodedReq, false);

which means false is passed in … and we expect “safe-auth” or something else unwanted (5 chars) and a ‘:’, or the ‘:’ only, to be present in the string.

But I just get some string (which seems to not even be base64), nothing else.

And then, when try to decode the supposed base64 string, I get something like this:

“\0\0\0\0"�mk\0\0\0\0\u001b\0\0\0\0\0\0\0oetyng.apps.safe.myapp\u0001\0\0\0\0\0\0\0\0\u000f\0\0\0\0\0\0\0My App\u0006\0\0\0\0\0\0\0Oetyng\u0001\0\0\0\0\0\0\0\0”

Is it related to this?

Not sure what I should do or what I might be doing wrong. Any ideas?

1 Like

I solved this btw. I had the wrong branch compiled :thinking: (where is face palm-smiley when you need it :slight_smile: )
I did however get some other error after that, but I guess I’ll do a new post if I cannot solve it this weekend.

1 Like

This topic was automatically closed after 60 days. New replies are no longer allowed.