-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/multitarget #89
Conversation
@ektrah Could you please allow CI runs for this PR for me to know if I got it right or wrong? edit: Tested here: https://github.com/MartyIX/libsodium-core/actions/runs/3383999101/jobs/5620456128 |
c7391ec
to
737576f
Compare
… / net6.0-android
72490b9
to
043aba4
Compare
@ektrah Does the PR make sense to you? Or do you think the approach is wrong? |
Thanks a lot for tackling this! The PR looks quite good so far. A few comments:
|
I've been slowly researching this but it does not seem to be as simple as adding
Not an expert on this. It would be great if the original author could give a hand :) |
/cc @enclave-alistair (who seems to be working on iOS support for another libsodium binding) |
So I have been struggling with testing this:
|
So I have found out that .NET 7 console application on macOS works OK: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>libsodium_core_console</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Sodium.Core" Version="1.3.1" />
</ItemGroup>
</Project> using Sodium;
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine(SecretAeadAes.IsAvailable);
}
} The program above does not crash. However, a similar .NET 7 MacCatalyst application crashes because it cannot find the libsodium DLL: namespace libsodium_core_maccatalyst;
using Sodium;
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate {
public override UIWindow? Window {
get;
set;
}
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow (UIScreen.MainScreen.Bounds);
// create a UIViewController with a single UILabel
var vc = new UIViewController ();
vc.View!.AddSubview (new UILabel (Window!.Frame) {
BackgroundColor = UIColor.SystemBackground,
TextAlignment = UITextAlignment.Center,
Text = SecretAeadAes.IsAvailable.ToString(), // MODIFIED LINE.
AutoresizingMask = UIViewAutoresizing.All,
});
Window.RootViewController = vc;
// make the window visible
Window.MakeKeyAndVisible ();
return true;
}
} So the problem is clear. The solution is not. :| edit: I have asked a question here: dotnet/runtime#79502 |
@MartyIX, thanks a lot for looking into this! Your findings show that there really should be some tests 🙂 I'm afraid I can't provide much help here, as I've never done any .NET ios/android/maccatalyst development. |
Asked here jedisct1/libsodium#1235 as the issue is in |
@ektrah So now we wait until libsodium releases (jedisct1/libsodium#1238 (comment)) so that this package can be modified to provide support for mac catalyst. But given jedisct1/libsodium#1136 there is no estimate I guess. |
Fixes #80 (?)
Introduction
Attempts to bring back support for Android, iOS and MacCatalyst, removed in 954f936.
How to compile?
To compile code in this branch, one has to call:
Now ideally restart Visual Studio, if that is your IDE.
Testing
I have run unit tests and they pass for me. I'm not sure how to test further. Any ideas?
Any feedback is much appreciated.