Skip to content

Commit

Permalink
feat: Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jan 24, 2024
1 parent 836e40c commit e9d8127
Show file tree
Hide file tree
Showing 69 changed files with 2,548 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
all:
patterns:
- "*"
40 changes: 40 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build, test and publish
on:
push:
branches:
- main
paths:
- 'src/**'
- '.github/workflows/**'

jobs:
buind-test-publish:
name: Build, test and publish
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install workloads
run: dotnet workload install maui

- name: Install Tizen workload on macOS / Linux
if: runner.os != 'Windows'
run: curl -sSL https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.sh | sudo bash

- name: Install Tizen workload on Windows
if: runner.os == 'Windows'
run: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
./workload-install.ps1
- name: Build
run: dotnet build src/libs/Maui.Biometric
--configuration Release

- name: Publish
run: dotnet nuget push
**.nupkg
--skip-duplicate
--source https://api.nuget.org/v3/index.json
--api-key ${{ secrets.NUGET_KEY }}
33 changes: 33 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and test
on:
pull_request:
branches:
- main
paths:
- 'src/**'
- '.github/workflows/**'

jobs:
buind-test:
name: Build, test and publish
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install workloads
run: dotnet workload install maui

- name: Install Tizen workload on macOS / Linux
if: runner.os != 'Windows'
run: curl -sSL https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.sh | sudo bash

- name: Install Tizen workload on Windows
if: runner.os == 'Windows'
run: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
./workload-install.ps1
- name: Build
run: dotnet build src/libs/Maui.Biometric
--configuration Release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,4 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml
/.idea
31 changes: 31 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
To help us fix your issue, please provide the information in the below template. If something causes a crash, provide as much information as you can gather.
Just imagine: we do not know what you are doing!

> Note: There is often little we can do without a minimal reproducible sample of the issue, so please provide that in a **standalone git repository** and link it here.

## Steps to reproduce

1.

2.

3.

## Expected behavior
Tell us what should happen

## Actual behavior
Tell us what happens instead

### Crashlog

If something causes an exception paste full stack trace + Exception here

## Configuration

**Version of the Package:** e.g. 1.0.0 / 1.0.1-alpha3

**Platform:** e.g. iOS 10.1 / Android 4.4 / ... (including version!!! e.g. Android 5.1 / i0S 10)

**Device:** e.g. HTC Sensation /i Phone 7 ...
8 changes: 8 additions & 0 deletions ISSUE_TEMPLATE_CHECK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Steps to reproduce
## Expected behavior
## Actual behavior
### Crashlog
## Configuration
**Version of the Package:**
**Platform:**
**Device:**
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Oscore
Copyright (c) 2024 Oscore Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
57 changes: 57 additions & 0 deletions Maui.Biometric.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32314.265
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{94FE90BF-FA05-46C6-A207-6E454A236659}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
README.md = README.md
LICENSE = LICENSE
.github\dependabot.yml = .github\dependabot.yml
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{928D4422-05CE-4AC2-89B0-31060889AE6A}"
ProjectSection(SolutionItems) = preProject
src\libs\Directory.Build.props = src\libs\Directory.Build.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maui.Biometric", "src\libs\Maui.Biometric\Maui.Biometric.csproj", "{8E7AE677-AD62-4FFE-ACBF-0F1A947ACDDB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{4746EB5B-E37C-40F0-8CA6-7D03185F5370}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{8DEF204E-ED5E-45A8-B021-47F6588890F4}"
ProjectSection(SolutionItems) = preProject
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
.github\workflows\pr.yml = .github\workflows\pr.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maui.Biometric.SampleApp", "sample\Maui.Biometric.SampleApp.csproj", "{49D331B7-7DCE-4470-8EFA-4D140AAF003F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8E7AE677-AD62-4FFE-ACBF-0F1A947ACDDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E7AE677-AD62-4FFE-ACBF-0F1A947ACDDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E7AE677-AD62-4FFE-ACBF-0F1A947ACDDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E7AE677-AD62-4FFE-ACBF-0F1A947ACDDB}.Release|Any CPU.Build.0 = Release|Any CPU
{49D331B7-7DCE-4470-8EFA-4D140AAF003F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49D331B7-7DCE-4470-8EFA-4D140AAF003F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49D331B7-7DCE-4470-8EFA-4D140AAF003F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49D331B7-7DCE-4470-8EFA-4D140AAF003F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8E7AE677-AD62-4FFE-ACBF-0F1A947ACDDB} = {928D4422-05CE-4AC2-89B0-31060889AE6A}
{8DEF204E-ED5E-45A8-B021-47F6588890F4} = {94FE90BF-FA05-46C6-A207-6E454A236659}
{49D331B7-7DCE-4470-8EFA-4D140AAF003F} = {4746EB5B-E37C-40F0-8CA6-7D03185F5370}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1493AEE4-9211-46E9-BFE6-8F629EAC5693}
EndGlobalSection
EndGlobal
22 changes: 22 additions & 0 deletions ORIGINAL_LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Microsoft Public License (MS-PL)

This license governs use of the accompanying software. If you use the software, you
accept this license. If you do not accept the license, do not use the software.

1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.

2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.

3. Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
93 changes: 92 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,93 @@
# Maui.Biometric
Continuation of the abandoned Plugin.Fingerprint in the MAUI ecosystem.

[![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
<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](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
<key>NSFaceIDUsageDescription</key>
<string>Need your face to unlock secrets!</string>
```

- Android - Request the permission in `AndroidManifest.xml`
```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:
```diff
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:
```csharp
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

![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 (<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-&lt;emulator-id&gt;")
- `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.
Binary file added assets/ios_simulator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/nuget_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions sample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Application
x:Class="Maui.Biometric.SampleApp.App"
xmlns="http:https://schemas.microsoft.com/dotnet/2021/maui"
xmlns:local="clr-namespace:Maui.Biometric.SampleApp"
xmlns:x="http:https://schemas.microsoft.com/winfx/2009/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
11 changes: 11 additions & 0 deletions sample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Maui.Biometric.SampleApp;

public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
15 changes: 15 additions & 0 deletions sample/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
Shell.FlyoutBehavior="Disabled"
Title="Maui.Biometric.SampleApp"
x:Class="Maui.Biometric.SampleApp.AppShell"
xmlns="http:https://schemas.microsoft.com/dotnet/2021/maui"
xmlns:local="clr-namespace:Maui.Biometric.SampleApp"
xmlns:x="http:https://schemas.microsoft.com/winfx/2009/xaml">

<ShellContent
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage"
Title="Home" />

</Shell>
9 changes: 9 additions & 0 deletions sample/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Maui.Biometric.SampleApp;

public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
Loading

0 comments on commit e9d8127

Please sign in to comment.