iProov.NET.MAUI
1.1.0
See the version list below for details.
dotnet add package iProov.NET.MAUI --version 1.1.0
NuGet\Install-Package iProov.NET.MAUI -Version 1.1.0
<PackageReference Include="iProov.NET.MAUI" Version="1.1.0" />
paket add iProov.NET.MAUI --version 1.1.0
#r "nuget: iProov.NET.MAUI, 1.1.0"
// Install iProov.NET.MAUI as a Cake Addin #addin nuget:?package=iProov.NET.MAUI&version=1.1.0 // Install iProov.NET.MAUI as a Cake Tool #tool nuget:?package=iProov.NET.MAUI&version=1.1.0
iProov Biometrics .NET MAUI SDK
Table of contents
Requirements
- NET 8 (net8-android & net8-ios)
- iOS 12 and above
- Android API Level 21 (Android 5 Lollipop) and above
Introduction
The iProov .NET MAUI SDK enables you to integrate iProov into your .NET Android / iOS / MAUI projects. The iProov's native SDK for iOS (Swift) and Android (Java / Kotlin) are wrapped behind a .NET interface for their use within .NET apps. Given the differences in the implementation between these .NET interfaces, the iProov.NET.MAUI wraps both interfaces into a unified .NET version of the iProov API to ease the integration of the iProov Biometric SDKs in MAUI developments.
The full documentation on this package can be found here.
Get a Token
There are two types of tokens:
- A verify token for logging in an existing user
- An enrol token for registering a new user
See the REST API documentation for details about how to generate tokens.
TIP: In a production app you typically obtain tokens via a server-to-server back-end call.
For demos and testing, iProov provides .NET sample code for obtaining tokens via iProov API v2 with our open-source API Client.
Launch the SDK
1. Create an instance of IProovWrapper
private IProovWrapper wrapper = new IProovWrapper();
2. Listening to IProovStates
To monitor the progress of an iProov claim and receive the result you need an instance of IProovWrapper.IStateListener
interface. So, you will have to implement this interface in one of your classes, or create a new one, as shown in the following example.
public class IProovListener: IProovWrapper.IStateListener {
public void OnConnecting()
{
// Called when the SDK is connecting to the server. You could provide an indeterminate
// progress indication to let the user know that the connection is being established.
}
public void OnConnected()
{
// The SDK has connected and the iProov user interface is now displayed. You
// could hide any progress indicator at this point.
}
public void OnProcessing(double progress, string? message)
{
// The SDK updates your app with the streaming progress to the server and the user authentication.
// Called multiple times as the progress updates. You could update a determinate progress indicator.
}
public void OnCanceled(Canceler canceler)
{
// The user canceled iProov, either by pressing the close button at the top of the screen, or sending
// the app to the background. (canceler == Canceler.User)
// Or, the app canceled (event.canceler == Canceler.App) by canceling the claim.
// You should use this to determine the next step in your flow.
}
public void OnError(IProovException exception)
{
// The user was not successfully verified/enrolled due to an error (e.g. lost internet connection).
// You will be provided with an Exception (see below).
// It will be called once, or never.
// An IProovException contains a title that describes the exception, and may also contain a message.
string title = exception.title;
string? message = exception.message;
}
public void OnFailure(IProovFailureResult failure)
{
// The user was not successfully verified/enrolled as their identity could not be verified.
// Or there was another issue with their verification/enrollment.
// You might provide feedback to the user as to how to retry.
// A FailureReason value is provided to identify the reason as to why the claim failed. Some reasons also provide an optional description (as a string).
// When enabled for your service provider, failure.frame contains the bytes of an image containing a single frame of the user
FailureReason reason = failure.reason;
string? description = failure.description;
byte[]? frame = failure.frame;
}
public void OnSuccess(byte[]? frame)
{
// The user was successfully verified/enrolled.
// You must always independently validate the token server-side (using the /validate API call) before performing any authenticated user actions.
// When enabled for your service provider, frame contains the bytes of an image containing a single frame of the user
}
}
3. Launch a Claim
To launch a claim you need to provide a token
, a userId
, the websocket url of the service provider you are using and an IStateListener
instance. Additionally you can provide an instance of IProovOptions
(see below) to customize the user experience.
IProovWrapper wrapper = new IProovWrapper();
IProovListener listener = new IProovListener();
private void launchIProov(string token, string userId)
{
var options = new IProovOptions();
// Here you can customize any IProovOption
wrapper.LaunchIProov(token, userId, "wss://eu.rp.secure.iproov.me/ws", listener, options);
}
** Running on iOS
For iProov to work on iOS devices, you need to add a Privacy - Camera Usage Description
entry to your Info.plist file (<Your_App_Folder>/Platforms/iOS/Info.plist
) with the reason why your app requires camera access (e.g. "To iProov you in order to verify your identity.")
Options
The Options
class allows iProov to be customized in various ways. These can be specified by passing an instance of IProovOptions
in the LaunchIProov()
method.
Most of these options are common to both Android and iOS, however, there are some options that are platform-specific.
For full documentation, please read the respective iOS and Android native SDK documentation.
A summary of the support for the various SDK options in iProov.NET.MAUI is provided below. All options are nullable and any options not set will default to their platform-defined default value.
Option | Type | iOS | Android |
---|---|---|---|
filter |
Filter? (See filter options) |
✅ | ✅ |
titleTextColor |
Color? |
✅ | ✅ |
promptTextColor |
Color? |
✅ | ✅ |
closeButtonTintColor |
Color? |
✅ | ✅ |
closeButtonImage |
byte[]? |
✅ | ✅ |
title |
string? |
✅ | ✅ |
fontPath |
string? |
✅ | ✅ |
logoImage |
byte[]? |
✅ | ✅ |
promptBackgroundColor |
Color? |
✅ | ✅ |
promptRoundedCorners |
bool? |
✅ | ✅ |
surroundColor |
Color? |
✅ | ✅ |
certificates |
IList<string>? |
✅ | ✅ |
timeout |
int? |
✅ | ✅ |
enableScreenshots |
bool? |
✅ | |
orientation |
Orientation? |
✅ | |
camera |
Camera? |
✅ | |
headerBackgroundColor |
Color? |
✅ | ✅ |
disableExteriorEffects |
bool? |
✅ | ✅ |
stringsTable |
string? |
✅ | |
stringsBundle |
string? |
✅ | |
genuinePresenceAssurance |
GenuinePresenceAssurance? |
||
↳ readyOvalStrokeColor |
Color? |
✅ | ✅ |
↳ notReadyOvalStrokeColor |
Color? |
✅ | ✅ |
livenessAssurance |
LivenessAssurance? |
||
↳ ovalStrokeColor |
Color? |
✅ | ✅ |
↳ completedOvalStrokeColor |
Color? |
✅ | ✅ |
Filter Options
The SDK supports two different camera filters:
LineDrawingFilter
LineDrawingFilter
is iProov's traditional "canny" filter, which is available in 3 styles: .Shaded
(default), .Classic
and .Vibrant
.
The foregroundColor
and backgroundColor
can also be customized.
Example:
var options = IProovOptions();
options.filter = new IProovOptions.LineDrawingFilter(
style: LineDrawingFilterStyle.Shaded,
foregroundColor: Colors.Black,
backgroundColor: Colors.White);
NaturalFilter
NaturalFilter
provides a more direct visualization of the user's face and is available in 2 styles: .Clear
(default) and .Blur
.
Example:
var options = IProovOptions();
options.filter = new IProovOptions.NaturalFilter(style: NaturalFilterStyle.Clear);
Note:
NaturalFilter
is available for Liveness Assurance claims only. Attempts to useNaturalFilter
for Genuine Presence Assurance claims will result in an error.
Handling errors
All errors from the native SDKs are re-mapped to IProovException
exceptions:
Exception | iOS | Android | Description |
---|---|---|---|
CaptureAlreadyActiveException |
✅ | ✅ | An existing iProov capture is already in progress. Wait until the current capture completes before starting a new one. |
NetworkException |
✅ | ✅ | An error occurred with the video streaming process. Consult the message value for more information. |
CameraPermissionException |
✅ | ✅ | The user disallowed access to the camera when prompted. You should direct the user to re-enable camera access. |
ServerException |
✅ | ✅ | A server-side error/token invalidation occurred. The associated message will contain further information about the error. |
UnexpectedErrorException |
✅ | ✅ | An unexpected and unrecoverable error has occurred. These errors should be reported to iProov for further investigation. |
UnsupportedDeviceException |
✅ | ✅ | Device is not supported. |
ListenerNotRegisteredException |
✅ | The SDK was launched before a listener was registered. | |
MultiWindowUnsupportedException |
✅ | The user attempted to iProov in split-screen/multi-screen mode, which is not supported. | |
CameraException |
✅ | An error occurred acquiring or using the camera. This could happen when a non-phone is used with/without an external/USB camera. | |
FaceDetectorException |
✅ | An error occurred with the face detector. | |
InvalidOptionsException |
✅ | An error occurred when trying to apply your options. | |
UserTimeoutException |
✅ | The user has taken too long to complete the claim. |
Sample code
For a simple iProov experience that is ready to run out-of-the-box, check out the sample code available here for a .NET MAUI app that uses iProov.NET.MAUI
.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-android34.0 is compatible. net8.0-ios17.0 is compatible. net8.0-ios17.2 is compatible. |
-
net8.0-android34.0
- iProov.NET.Android (>= 9.1.1)
- Microsoft.Maui.Controls (>= 8.0.40)
- Microsoft.Maui.Controls.Compatibility (>= 8.0.40)
-
net8.0-ios17.0
- iProov.NET.iOS (>= 11.1.1)
- Microsoft.Maui.Controls (>= 8.0.40)
- Microsoft.Maui.Controls.Compatibility (>= 8.0.40)
-
net8.0-ios17.2
- iProov.NET.iOS (>= 11.1.1)
- Microsoft.Maui.Controls (>= 8.0.40)
- Microsoft.Maui.Controls.Compatibility (>= 8.0.40)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.