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:
“AAAAAIQ5wp8AAAAAFgAAAAAAAABvZXR5bmcuYXBwcy5zYWZlLm15YXBwAQAAAAAAAAAACgAAAAAAAABTQUZFIE15QXBwBgAAAAAAAABPZXR5bmcBAQAAAAAAAAAMAAAAAAAAAF9wdWJsaWNOYW1lcwEAAAAAAAAAAQAAAA”
(i.e. likely not base64 since it does not match this:
String regex = "([A-Za-z0-9+/]{4})*"+ "([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)";
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 += “==”;
break;
case 3:
inputUrl += “=”;
break;
}
}
else
{
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?