mirror of
https://github.com/bitwarden/mobile
synced 2026-01-04 17:43:17 +00:00
test
This commit is contained in:
@@ -183,6 +183,9 @@ namespace Bit.iOS
|
||||
}
|
||||
});
|
||||
|
||||
var sdkClient = new BitwardenClient();
|
||||
var test = sdkClient.Fingerprint();
|
||||
|
||||
return base.FinishedLaunching(app, options);
|
||||
}
|
||||
|
||||
|
||||
31
src/iOS/BitwardenClient.cs
Normal file
31
src/iOS/BitwardenClient.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace Bit.iOS
|
||||
{
|
||||
public class BitwardenClient : IDisposable
|
||||
{
|
||||
private readonly BitwardenClientSafeHandle handle;
|
||||
|
||||
public BitwardenClient()
|
||||
{
|
||||
handle = BitwardenClientWrapper.init("");
|
||||
}
|
||||
|
||||
public string Fingerprint()
|
||||
{
|
||||
return BitwardenClientWrapper.run_command("{}", handle.Ptr);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (handle != null && !handle.IsInvalid)
|
||||
handle.Dispose();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
src/iOS/BitwardenClientSafeHandle.cs
Normal file
18
src/iOS/BitwardenClientSafeHandle.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace Bit.iOS
|
||||
{
|
||||
internal class BitwardenClientSafeHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||||
{
|
||||
public BitwardenClientSafeHandle() : base(true) { }
|
||||
|
||||
public IntPtr Ptr => this.handle;
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
BitwardenClientWrapper.free_mem(handle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/iOS/BitwardenClientWrapper.cs
Normal file
23
src/iOS/BitwardenClientWrapper.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Bit.iOS
|
||||
{
|
||||
internal static class BitwardenClientWrapper
|
||||
{
|
||||
#if Android
|
||||
const string DllName = "libBitwardenC.so";
|
||||
#else
|
||||
const string DllName = "__Internal";
|
||||
#endif
|
||||
|
||||
[DllImport(DllName, EntryPoint = "init")]
|
||||
internal static extern BitwardenClientSafeHandle init(string settings);
|
||||
|
||||
[DllImport(DllName, EntryPoint = "free_mem")]
|
||||
internal static extern void free_mem(IntPtr clientPtr);
|
||||
|
||||
[DllImport(DllName, EntryPoint = "run_command")]
|
||||
internal static extern string run_command(string loginRequest, IntPtr clientPtr);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<OptimizePNGs>true</OptimizePNGs>
|
||||
<MtouchExtraArgs>--nodevcodeshare --http-message-handler=NSUrlSessionHandler -gcc_flags "-L${ProjectDir}/../../lib/ios -largon2 -force_load ${ProjectDir}/../../lib/ios/libargon2.a"</MtouchExtraArgs>
|
||||
<MtouchExtraArgs>--nodevcodeshare --http-message-handler=NSUrlSessionHandler -gcc_flags "-L${ProjectDir}/../../lib/ios -largon2 -force_load ${ProjectDir}/../../lib/ios/libargon2.a -lbitwarden_c -force_load ${ProjectDir}/../../lib/ios/libbitwarden_c.a.a"</MtouchExtraArgs>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
@@ -144,6 +144,9 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="BitwardenClient.cs" />
|
||||
<Compile Include="BitwardenClientSafeHandle.cs" />
|
||||
<Compile Include="BitwardenClientWrapper.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="Services\iOSPushNotificationHandler.cs" />
|
||||
<Compile Include="Services\iOSPushNotificationService.cs" />
|
||||
|
||||
Reference in New Issue
Block a user