Oscore.Maui.Biometric 2.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Oscore.Maui.Biometric --version 2.0.0                
NuGet\Install-Package Oscore.Maui.Biometric -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oscore.Maui.Biometric" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Oscore.Maui.Biometric --version 2.0.0                
#r "nuget: Oscore.Maui.Biometric, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Oscore.Maui.Biometric as a Cake Addin
#addin nuget:?package=Oscore.Maui.Biometric&version=2.0.0

// Install Oscore.Maui.Biometric as a Cake Tool
#tool nuget:?package=Oscore.Maui.Biometric&version=2.0.0                

Maui.Biometric

Nuget package CI/CD License: MIT

Provides a cross-platform implementation of biometric authentication.
Supports iOS, macOS, Android and Windows.
This repository has been rewritten taking into account the API of the xamarin-fingerprint and Plugin.Maui.Biometric libraries

Supported Platforms

Platform Minimum Version Supported
iOS 12.2+
macOS 15+
Android 5.0 (API 21)
Windows 11 and 10 version 1809+ (build 17763)

Usage

  • Add NuGet package to your project:
<PackageReference Include="Oscore.Maui.Biometric" Version="2.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>This app requires Face ID for secure authentication and to provide a personalized experience.</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:
if (await BiometricAuthentication.Current.IsAvailableAsync())
{
    var result = await BiometricAuthentication.Current.AuthenticateAsync(
        new AuthenticationRequest(
            title: "Authenticate",
            reason: "Please authenticate to proceed"));
    if (result.IsSuccessful)
    {
        // User authenticated
    }
}

Testing on Simulators

iOS

Controlling the sensor on the iOS Simulator

With the Hardware menu you can

  • Toggle the enrollment status
  • Trigger valid (<kbd>⌘</kbd> <kbd>⌥</kbd> <kbd>M</kbd>) and invalid (<kbd>⌘</kbd> <kbd>⌥</kbd> <kbd>N</kbd>) 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

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android35.0 is compatible.  net9.0-ios18.0 is compatible.  net9.0-maccatalyst18.0 is compatible.  net9.0-tizen8.0 is compatible.  net9.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 293 12/5/2024
2.0.0 105 12/3/2024
1.0.1 9,557 2/23/2024
1.0.0 1,103 1/24/2024
0.0.0-dev 64 12/5/2024