Files
template
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
<p align="center"> <a href="https://fingerprint.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://fingerprintjs.github.io/home/resources/logo_light.svg" /> <source media="(prefers-color-scheme: light)" srcset="https://fingerprintjs.github.io/home/resources/logo_dark.svg" /> <img src="https://fingerprintjs.github.io/home/resources/logo_dark.svg" alt="Fingerprint logo" width="312px" /> </picture> </a> </p> <p align="center"> <a href="https://github.com/fingerprintjs/fingerprint-pro-server-api-dotnet-sdk/actions/workflows/release.yml"><img src="https://github.com/fingerprintjs/fingerprint-pro-server-api-dotnet-sdk/actions/workflows/release.yml/badge.svg" alt="CI badge" /></a> <a href="https://github.com/fingerprintjs/fingerprint-pro-server-api-dotnet-sdk/actions/workflows/tests.yml"><img src="https://github.com/fingerprintjs/fingerprint-pro-server-api-dotnet-sdk/actions/workflows/tests.yml/badge.svg" alt="CI badge" /></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/:license-mit-blue.svg?style=flat"/></a> <a href="https://discord.gg/39EpE2neBg"><img src="https://img.shields.io/discord/852099967190433792?style=logo&label=Discord&logo=Discord&logoColor=white" alt="Discord server"></a> </p> # Fingerprint Server API Dotnet SDK [Fingerprint](https://fingerprint.com) is a device intelligence platform offering 99.5% accurate visitor identification. {{#appDescription}} {{{appDescription}}} {{/appDescription}} This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: {{appVersion}} - SDK version: {{packageVersion}} {{^hideGenerationTimestamp}} - Build date: {{generatedDate}} {{/hideGenerationTimestamp}} - Build package: {{generatorClass}} {{#infoUrl}} For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} <a name="requirements"></a> ## Requirements - .NET 8.0 or later (we keep the [Microsoft support policy](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core)) <a name="how-to-install"></a> ## How to install We recommend installing the package from [NuGet](https://docs.nuget.org/consume/installing-nuget): ```shell dotnet add package FingerprintPro.ServerSdk ``` <a name="getting-started"></a> ## Getting Started ```csharp // See https://aka.ms/new-console-template for more information // Example usage of our SDK // Import namespaces using FingerprintPro.ServerSdk.Api; using FingerprintPro.ServerSdk.Client; // Initialize configuration and add your api key var configuration = new Configuration(Environment.GetEnvironmentVariable("API_KEY")!); var api = new FingerprintApi( configuration ); var requestId = Environment.GetEnvironmentVariable("REQUEST_ID")!; var visitorId = Environment.GetEnvironmentVariable("VISITOR_ID")!; var visits = api.GetVisits(visitorId); var events = api.GetEvent(requestId); var eventsFound = api.SearchEvents(20, bot: "bad"); Console.WriteLine(visits); Console.WriteLine(events); Console.WriteLine(eventsFound); var tag = new Tag { ["key"] = "value" }; var body = new EventsUpdateRequest() { Suspect = false, Tag = tag, LinkedId = "<linked_id>" }; api.UpdateEvent(body, requestId); ``` You can also access the raw HTTP response by using the `WithHttpInfo` methods: ```csharp // See https://aka.ms/new-console-template for more information // Example usage of our SDK // Import namespaces using FingerprintPro.ServerSdk.Api; using FingerprintPro.ServerSdk.Client; // Initialize configuration and add your api key var configuration = new Configuration(Environment.GetEnvironmentVariable("API_KEY")!); var api = new FingerprintApi( configuration ); var requestId = Environment.GetEnvironmentVariable("REQUEST_ID")!; var visitorId = Environment.GetEnvironmentVariable("VISITOR_ID")!; var visits = api.GetVisitsWithHttpInfo(visitorId); // HttpResponseMessage Console.WriteLine(visits.Response); // Response data Console.WriteLine(visits.Data); ``` You can view more examples in [src/FingerprintPro.ServerSdk.Examples/Program.cs](src/FingerprintPro.ServerSdk.Examples/Program.cs). ### Region If your subscription is in region other than US, you need to change the region in the configuration: ```csharp using FingerprintPro.ServerSdk.Client; var configuration = new Configuration(Environment.GetEnvironmentVariable("API_KEY")!) { Region = Region.Eu // or Region.Asia }; ``` ## Sealed results This SDK provides utility methods for decoding [sealed results](https://dev.fingerprint.com/docs/sealed-client-results). ```csharp using FingerprintPro.ServerSdk; var sealedResult = Environment.GetEnvironmentVariable("BASE64_SEALED_RESULT")!; var sealedKey = Environment.GetEnvironmentVariable("BASE64_KEY")!; var events = Sealed.UnsealEventResponse(Convert.FromBase64String(sealedResult), new[] { new Sealed.DecryptionKey(Convert.FromBase64String(sealedKey), Sealed.DecryptionAlgorithm.Aes256Gcm) }); Console.WriteLine(events.ToJson()); ``` To learn more, refer to example located in [src/FingerprintPro.ServerSdk.SealedResultExample/Program.cs](src/FingerprintPro.ServerSdk.SealedResultExample/Program.cs). ## Webhook signature validation This SDK provides utility method for verifying the HMAC signature of the incoming webhook request. ```csharp namespace FingerprintAspNetCore.Areas.Identity.Pages; using FingerprintPro.ServerSdk; using Microsoft.AspNetCore.Mvc; using System; using System.IO; using System.Threading.Tasks; [Route("api/[controller]")] [ApiController] public class WebhookController : ControllerBase { [HttpPost] public async Task<IActionResult> Post() { try { var secret = Environment.GetEnvironmentVariable("WEBHOOK_SIGNATURE_SECRET"); if (string.IsNullOrEmpty(secret)) { return BadRequest(new { message = "Secret key is not configured." }); } var header = Request.Headers["fpjs-event-signature"].ToString(); if (string.IsNullOrEmpty(header)) { return BadRequest(new { message = "Missing fpjs-event-signature header." }); } using var memoryStream = new MemoryStream(); await Request.Body.CopyToAsync(memoryStream); var data = memoryStream.ToArray(); // Validate webhook signature var isValid = WebhookValidation.IsValidSignature( header, data, secret); if (!isValid) { return Forbid(new { message = "Webhook signature is invalid." }); } // Process the webhook data here return Ok(new { message = "Webhook received." }); } catch (Exception e) { return StatusCode(500, new { error = e.Message }); } } } ``` To learn more, refer to example located in [src/FingerprintPro.ServerSdk.WebhookExample/Program.cs](src/FingerprintPro.ServerSdk.WebhookExample/Program.cs). <a name="documentation-for-api-endpoints"></a> ## Documentation for API Endpoints All URIs are relative to *{{{basePath}}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} <a name="documentation-for-models"></a> ## Documentation for Models {{#modelPackage}} {{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) {{/model}}{{/models}} {{/modelPackage}} {{^modelPackage}} No model defined in this package {{/modelPackage}} <a name="documentation-for-authorization"></a> ## Documentation for Authorization {{^authMethods}} All endpoints do not require authorization. {{/authMethods}} {{#authMethods}} {{#last}} Authentication schemes defined for the API: {{/last}} {{/authMethods}} {{#authMethods}} <a name="{{name}}"></a> ### {{name}} {{#isApiKey}}- **Type**: API key - **API key parameter name**: {{keyParamName}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} {{/isApiKey}} {{#isBasic}}- **Type**: HTTP basic authentication {{/isBasic}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{flow}} - **Authorization URL**: {{authorizationUrl}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#each scopes}} - {{@key}}: {{this}} {{/each}} {{/isOAuth}} {{/authMethods}} ## Documentation for sealed results - [Sealed](docs/Sealed.md) - [DecryptionKey](docs/DecryptionKey.md) ## Documentation for webhooks - [WebhookValidation](docs/WebhookValidation.md) ## Support and feedback To report problems, ask questions or provide feedback, please use [Issues](https://github.com/fingerprintjs/fingerprintjs-pro-server-api-node-sdk/issues). If you need private support, you can email us at [[email protected]](mailto:[email protected]). <a name="license"></a> ## License This project is licensed under the [MIT license](https://github.com/fingerprintjs/fingerprint-pro-server-api-dotnet-sdk/blob/main/LICENSE).