Oscore.Maui.Biometric
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Oscore.Maui.Biometric --version 1.0.0
NuGet\Install-Package Oscore.Maui.Biometric -Version 1.0.0
<PackageReference Include="Oscore.Maui.Biometric" Version="1.0.0" />
paket add Oscore.Maui.Biometric --version 1.0.0
#r "nuget: Oscore.Maui.Biometric, 1.0.0"
// Install Oscore.Maui.Biometric as a Cake Addin #addin nuget:?package=Oscore.Maui.Biometric&version=1.0.0 // Install Oscore.Maui.Biometric as a Cake Tool #tool nuget:?package=Oscore.Maui.Biometric&version=1.0.0
Maui.Biometric
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 usingIBiometricAuthentication
from DI:
var request = new AuthenticationRequestConfiguration ("Prove you have fingers!", "Because without it you can't have access");
var result = await BiometricAuthentication.Current.AuthenticateAsync(request);
if (result.Authenticated)
{
// do secret stuff :)
}
else
{
// not allowed to do secret stuff :(
}
Testing on Simulators
iOS
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
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 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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios17.2 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst17.2 is compatible. net8.0-macos was computed. net8.0-tizen8.0 is compatible. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows10.0.19041 is compatible. |
-
net8.0
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-android34.0
- Microsoft.Maui.Controls (>= 8.0.3)
- Xamarin.AndroidX.Biometric (>= 1.1.0.18)
- Xamarin.AndroidX.Collection (>= 1.3.0.2)
- Xamarin.AndroidX.Collection.Ktx (>= 1.3.0.2)
-
net8.0-ios17.2
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-maccatalyst17.2
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-tizen8.0
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 8.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.