Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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: 2 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.
Continuation of the abandoned Plugin.Fingerprint in the MAUI ecosystem.

## 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
Need your face to unlock secrets!
```

- 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
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](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 app
- go to Security > Fingerprint, then follow the enrollment instructions
- when it asks for touch
- open command prompt
- `telnet 127.0.0.1 ` (`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
- https://github.com/smstuebe/xamarin-fingerprint
- https://stackoverflow.com/questions/633132/is-ms-pl-microsoft-public-license-code-allowed-in-commercial-product

## Legal information and credits

It was forked from the [xamarin-fingerprint](https://github.com/smstuebe/xamarin-fingerprint) project.
xamarin-fingerprint is a project by [Sven-Michael Stübe](https://github.com/smstuebe).
It was licensed under the [MS-PL license](https://github.com/smstuebe/xamarin-fingerprint/blob/master/LICENSE).
This fork changes the license to MIT with attribution to the original license.