Giter Site home page Giter Site logo

oscoreio / maui.biometric Goto Github PK

View Code? Open in Web Editor NEW
21.0 3.0 3.0 383 KB

Provides a cross-platform implementation of biometric authentication. Continuation of the abandoned Plugin.Fingerprint in the MAUI ecosystem.

License: MIT License

C# 100.00%
authentication biometric cross-platform csharp dotnet face-recognition faceid fingerprint iris maui

maui.biometric's Introduction

Maui.Biometric

Nuget package CI/CD License: MIT

Provides a cross-platform implementation of biometric authentication.
Supports iOS, macOS, Android and Windows.
Continuation of the abandoned Plugin.Fingerprint in the MAUI ecosystem.

Usage

  • Add NuGet package to your project:
<PackageReference Include="Oscore.Maui.Biometric" Version="1.0.0" />
  • iOS - Add NSFaceIDUsageDescription to your Info.plist to describe the reason your app uses Face ID. (see Documentation). Otherwise the App will crash when you start a Face ID authentication on iOS 11.3+.
<key>NSFaceIDUsageDescription</key>
<string>Need your face to unlock secrets!</string>
  • Android - Request the permission in AndroidManifest.xml
<uses-permission android:name="android.permission.USE_FINGERPRINT" android:maxSdkVersion="27" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" android:minSdkVersion="28" />
  • Add the following to your MauiProgram.cs CreateMauiApp method:
builder
    .UseMauiApp<App>()
+   .UseBiometricAuthentication()
    .ConfigureFonts(fonts =>
    {
        fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
        fonts.AddFont("OpenSans-Sed:nammibold.ttf", "OpenSansSemibold");
    });
  • Use through BiometricAuthentication.Current or using IBiometricAuthentication from DI:
var result = await BiometricAuthentication.Current.AuthenticateAsync(
    new AuthenticationRequest(
        title: "Prove you have fingers!",
        reason: "Because without it you can't have access"));
if (result.Authenticated)
{
    // do secret stuff :)
}
else
{
    // not allowed to do secret stuff :(
}

Testing on Simulators

iOS

Controlling the sensor on the iOS Simulator

With the Hardware menu you can

  • Toggle the enrollment status
  • Trigger valid ( M) and invalid ( N) fingerprint sensor events

Android

  • start the emulator (Android >= 6.0)
  • open the settings app
  • go to Security > Fingerprint, then follow the enrollment instructions
  • when it asks for touch
  • open command prompt
  • telnet 127.0.0.1 <emulator-id> (adb devices prints "emulator-<emulator-id>")
  • finger touch 1
  • finger touch 1

Sending fingerprint sensor events for testing the plugin can be done with the telnet commands, too.

Note for Windows users: You have to enable telnet: Programs and Features > Add Windows Feature > Telnet Client

Links

Legal information and credits

It was forked from the xamarin-fingerprint project.
xamarin-fingerprint is a project by Sven-Michael Stübe.
It was licensed under the MS-PL license.
This fork changes the license to MIT with attribution to the original license.

maui.biometric's People

Contributors

havendv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

maui.biometric's Issues

[Feature] Support `WinUI` and `MacOS` (MAUI)

Thanks for providing this project :)

This is actually not a bug. I want to use this project to secure a maui application.
It seems to support Android and iOS, but not WinUI / macOS (macOS maybe works with fingerprint?).
Maybe it is possible to prompt for the user password if on Windows or macOS

Chrome does it this way, if entering the saved passwords. Is this something you can think about?

`AllowAlternativeAuthentication` is missing

The Plugin.Fingerprint has this property

 /// <summary>
 /// En-/Disables the use of the PIN / Password as fallback.
 /// 
 /// Supported Platforms: Android, iOS, Mac
 /// Default: false
 /// </summary>
 public bool AllowAlternativeAuthentication { get; set; } = false;

I'm assuming you omit it deliberately; how could we achieve the same behavior without this property?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.