diff --git a/lib/ios/libbitwarden_c.a b/lib/ios/libbitwarden_c.a
new file mode 100644
index 000000000..89e177987
Binary files /dev/null and b/lib/ios/libbitwarden_c.a differ
diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs
index 284f47299..6fc420b50 100644
--- a/src/iOS/AppDelegate.cs
+++ b/src/iOS/AppDelegate.cs
@@ -183,6 +183,9 @@ namespace Bit.iOS
}
});
+ var sdkClient = new BitwardenClient();
+ var test = sdkClient.Fingerprint();
+
return base.FinishedLaunching(app, options);
}
diff --git a/src/iOS/BitwardenClient.cs b/src/iOS/BitwardenClient.cs
new file mode 100644
index 000000000..0cbef9db4
--- /dev/null
+++ b/src/iOS/BitwardenClient.cs
@@ -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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/iOS/BitwardenClientSafeHandle.cs b/src/iOS/BitwardenClientSafeHandle.cs
new file mode 100644
index 000000000..eb22ca4d6
--- /dev/null
+++ b/src/iOS/BitwardenClientSafeHandle.cs
@@ -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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/iOS/BitwardenClientWrapper.cs b/src/iOS/BitwardenClientWrapper.cs
new file mode 100644
index 000000000..2d06ad412
--- /dev/null
+++ b/src/iOS/BitwardenClientWrapper.cs
@@ -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);
+ }
+}
\ No newline at end of file
diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj
index ba4127910..58832aff4 100644
--- a/src/iOS/iOS.csproj
+++ b/src/iOS/iOS.csproj
@@ -29,7 +29,7 @@
None
true
true
- --nodevcodeshare --http-message-handler=NSUrlSessionHandler -gcc_flags "-L${ProjectDir}/../../lib/ios -largon2 -force_load ${ProjectDir}/../../lib/ios/libargon2.a"
+ --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"
Entitlements.plist
@@ -144,6 +144,9 @@
+
+
+