Pular para o conteúdo principal

Biometric sessions - Rest PKI Core - .NET/C# Client Lib

Before exploring the use cases, you need to set up the Rest PKI Core library in your application. The Lacuna.RestPkiCore.Client library is compatible with .NET Standard 2.0. The examples below use ASP.NET Core, like the backend sample (.NET), which uses .NET 8.

1. Environment setup​

In your appsettings.json file, add the credentials obtained on the Rest PKI Core dashboard:

{
...,
"RestPki": {
"Endpoint": "YOUR_ENDPOINT_HERE",
"ApiKey": "YOUR_API_KEY_HERE"
}
}

In the Program.cs file, register the service before the call to builder.Build():

// Registers the Rest PKI Core client using the appsettings section
builder.Services.AddRestPki().Configure(builder.Configuration.GetSection("RestPki"));

var app = builder.Build();

2. Dependency injection​

To use the biometric features in your controllers, inject the IRestBioService interface through the constructor.

note

The IRestBioService interface is the one responsible for all biometric session operations (liveness, enrollment, authentication, etc.).

using Lacuna.RestPki.Client;
using Microsoft.AspNetCore.Mvc;

[ApiController]
[Route("api/sessions")]
public class MyController : ControllerBase {

private readonly IRestBioService _restBioService;

public MyController(IRestBioService restBioService) {
_restBioService = restBioService;
}

// The sample methods go here...
}

See also​

View as Markdown