An open API service indexing awesome lists of open source software.

https://github.com/oscoreio/maui.biometric

Provides a cross-platform implementation of biometric authentication. Continuation of the abandoned Plugin.Fingerprint in the MAUI ecosystem.
https://github.com/oscoreio/maui.biometric

android authentication biometric cross-platform csharp dotnet face-recognition faceid fingerprint ios iris maccatalyst macos maui oscore windows winui xamarin

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# Maui.Biometric

[![Nuget package](https://img.shields.io/nuget/vpre/Oscore.Maui.Biometric)](https://www.nuget.org/packages/Oscore.Maui.Biometric/)
[![CI/CD](https://github.com/oscoreio/Maui.Biometric/actions/workflows/dotnet.yml/badge.svg?branch=main)](https://github.com/oscoreio/Maui.Biometric/actions/workflows/dotnet.yml)
[![License: MIT](https://img.shields.io/github/license/oscoreio/Maui.Biometric)](https://github.com/oscoreio/Maui.Biometric/blob/main/LICENSE)

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:
```xml

```

- iOS - Add `NSFaceIDUsageDescription` to your Info.plist to describe the reason your app uses Face ID.
(see [Documentation](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW75)).
Otherwise the App will crash when you start a Face ID authentication on iOS 11.3+.
```xml
NSFaceIDUsageDescription
This app requires Face ID for secure authentication and to provide a personalized experience.
```

- Android - Request the permission in `AndroidManifest.xml`
```xml

```

- Add the following to your `MauiProgram.cs` `CreateMauiApp` method:
```diff
builder
.UseMauiApp()
+ .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:
```csharp
// You don't need to check if the device supports biometric authentication, the plugin does it for you
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](assets/ios_simulator.png "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
- go to Security > Fingerprint, then follow the enrollment instructions
- when it asks for touch
- open the Emulator Settings
- go to Fingerprint menu

## Links
- https://github.com/smstuebe/xamarin-fingerprint
- https://github.com/FreakyAli/Plugin.Maui.Biometric