Securing Mac application with Touch ID

This Monday I got a shiny new Macbook Pro with Touchbar. There few things I don’t like about it but one thing I absolutely love is TouchID integration.

I wanted to check how easy it is to integrate with Xamarin.Mac app. Surprisingly, the APIs are exactly same as what are available on iOS, I used the code from Mike James’ blog post about securing iOS apps with TouchID


All you need is below code snippet in your Xamarin.Mac app to secure it with all new Thouch ID

LAContextReplyHandler replyHandler;

// ...

void UseTouchID()
    var contex = new LAContext();
    NSError authError;
    if (contex.CanEvaluatePolicy (LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out authError))
        replyHandler = new LAContextReplyHandler((success, error) =>
            if (success)
                InvokeOnMainThread(() => ShowMessage());

    contex.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, "authenticate", replyHandler);

Note that we do need to have a fallback mechanism for legacy Macbook Pros (i.e without Touchbar), you can download complete source code
on Github here

JSON Copy version 1.0 for Xamarin Studio

UPDATE: JSON Copy now available in Xamarin Studio’s Add-in Manager, under IDE Extensions

Few months back I published an Addin for MonoDevelop and Xamarin Studio to allow developer to paste JSON string as C# classes. The functionality was primitive and experimental, we did not have any control over the code formatting or class structure.

In v1.0 I have fixed most of those limitations in the Addin, now we have more control over how C# structured. You can find download and installation instruction here.

Here is what’s new in version 1.0:

  1. Choose between Pascal Casing and default lowercase letters
  2. Mark classes as internal or public
  3. Create Properties or Fields for JSON properties.
  4. New Preferences Panel


I would love to hear your feedback, please create an issue in Github repo or leave a comment