PrivateIdentity.Sdk 0.0.6

Additional Details

This package is no longer maintained.

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package PrivateIdentity.Sdk --version 0.0.6
NuGet\Install-Package PrivateIdentity.Sdk -Version 0.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PrivateIdentity.Sdk" Version="0.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PrivateIdentity.Sdk --version 0.0.6
#r "nuget: PrivateIdentity.Sdk, 0.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PrivateIdentity.Sdk as a Cake Addin
#addin nuget:?package=PrivateIdentity.Sdk&version=0.0.6

// Install PrivateIdentity.Sdk as a Cake Tool
#tool nuget:?package=PrivateIdentity.Sdk&version=0.0.6

Private Identity .NET SDK

Description

Ths NuGet package contains code to perform 1:N fully homomorphically encrypted (FHE) face recognition.

Benefits

  • Face biometric capture
  • Encrypted face recognition every 200ms
  • 1:N biometric match in 60ms constant time
  • Human age estimation
  • Unlimited users (unlimited gallery size)
  • Fair, accurate and unbiased
  • Preserves user privacy with neural network cryptography + fully homomorphic encryption (CryptoNets)
  • IEEE 2410 Standard for Biometric Privacy, ISO 27001, ISO 9001 compliant
  • Exempt from GDPR, CCPA, BIPA, and HIPAA privacy law obligations
  • Predicts in 50ms with or without network using local storage

Build

  • Verified Identity
  • Web Sign-in
  • Payments
  • Phone Unlock
  • Ticketless Access Control
  • Account Recovery
  • Face CAPTCHA

PrivateIdentity.Sdk NuGet Package

This package is main package with managed wrappers for native PrivateIdentity binaries. You need only this one for compilation but if you want to run the compiled code on any supported platform you have to install separate packages for each one:

Package Platform
PrivateIdentity.runtime.linux Linux x64
PrivateIdentity.runtime.windows Windows x64

As alternative solution you can just install the PrivateIdentity "metapackage" that includes all these packages as transitive dependencies.

How To Use Package

Prerequisite

Sign up on the waitlist on https://private.id to obtain your API Key.

How To Install

If you use a .NED SDK from console just add a package reference into your project:

dotnet add package PrivateIdentity

Of if you use any IDE like Visual Studio or Rider, just use built-in NuGet package GUI for adding the package.

Configure Local Storage

This step is optional and if you omit it each new process will have it's own unique local cache. If you want to make this cache really useful (persistent between different runs of your application) configure cache location using this call:

PrivateIdentity.LocalStorage.TryConfigureLocalStorage(...);

You applicaiton should have write permissions for the target folder instead any cache-related operations will fail.

Image Data Object

This package uses the raw bitmap data as input for most operations. The required fields are described in the IImageData interface and contains raw bitmap pointer, color format (RGB, RGBA, or BGR), image size in pixels and bytes. The package also provides the simple default implementation of this interface - ImageData struct. This record struct doesn't provide any automatic memory management features and can be used only for the fast prototyping or in cases if you already have classes that implement raw bitmap memory handling.

There is an example of helper class that converts System.Drawing.Bitmap object into IImageData instance that can be used by this SDK:

internal static class ImageHelper
{
    private readonly record struct DisposableImageData : IDisposableImageData
    {
        private readonly BitmapData _bitmapData;

        private readonly Bitmap _bitmap;

        public DisposableImageData(
            Bitmap bitmap)
        {
            _bitmap = bitmap;
            _bitmapData = bitmap.LockBits(
                new Rectangle(Point.Empty, bitmap.Size),
                ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
        }

        public ImageFormat Format => ImageFormat.Rgb;

        public IntPtr Bitmap => _bitmapData.Scan0;
        
        public Int32 Width => _bitmapData.Width;
        
        public Int32 Height => _bitmapData.Height;

        public Int64 Size => _bitmapData.Stride * _bitmapData.Height;

        public void Dispose()
        {
            _bitmap.UnlockBits(_bitmapData);
            _bitmap.Dispose();
        }
    }

    public static IDisposableImageData Convert(Bitmap bitmap)
    {
        return new DisposableImageData(bitmap.Clone(
            new Rectangle(Point.Empty, bitmap.Size), PixelFormat.Format24bppRgb));
    }
}

The PrivateIdentity.SixLabors.ImageSharp NuGet package contains helper methods for converting SixLabors.ImageSharp.Image objects into IImageData interface implementation.

In future we will probably provide helper NuGet packages or more code snippets for converting image objects from widely used libraries like Windows Forms, SkiaSharp, EmguCV, etc. into helper classes that implements the IImageData interface.

Face Module Usage

Create Face Module

For performing any operations (validation, enroll, predict, etc.) you have to obtain instance of the IFaceModule interface from the Factory class:

var module = PrivateIdentity.Factory.GetFaceModule(new ModuleSettings(api_key));

Only the ApiKey property is mandatory in the ModuleSettings class but you can also specify the custom URL for server-side calls and internal logging level. Built-in logging will use native console output so in some environment it would be hard to collect these log messages for now.

Validate Input Image

The function detects if there is a valid face in the 'IImageData` object:

var faceValidateResult = module.Validate(imageData);

Returned IFaceValidateResult interface instance contains information about validation result in the Result property.

Register A New User

The function detects if there is a valid face in the 'IImageData` object and registers a new user in back-end:

var faceEnrollResult = await module.EnrollAsync(imageData);

If enrollment operation completed successfully the returned IFaceEnrollResult interface instance contains user unique identifier in the Uuid property.

Authenticate A User

The function detects if there is a valid face in the 'IImageData` object and tries to authenticate a user on back-end:

var facePreditResult = await module.PredictAsync(imageData);

If prediction operation completed successfully the returned IFacePredictResult interface instance contains user unique identifier in the Uuid property.

Delete A User Data

If you want to delete user data from the back-end you can do it using the user identifier previously obtained from EnrollAsync or PredictAsync method:

var faceDeleteResult = await module.DeleteAsync(userIdentifier);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

- Added a way for setting a custom user identifier on enroll and reading back a list of these identifiers on predict.
- The new native binaries for both Windows and Linux with a lot of internal improvements/fixes.
- Updated the P/Invoke bindings for matching with the latest native API changes.