ApiKeyGenerator 0.9.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ApiKeyGenerator --version 0.9.1
NuGet\Install-Package ApiKeyGenerator -Version 0.9.1
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="ApiKeyGenerator" Version="0.9.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ApiKeyGenerator --version 0.9.1
#r "nuget: ApiKeyGenerator, 0.9.1"
#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 ApiKeyGenerator as a Cake Addin
#addin nuget:?package=ApiKeyGenerator&version=0.9.1

// Install ApiKeyGenerator as a Cake Tool
#tool nuget:?package=ApiKeyGenerator&version=0.9.1

GitHub Workflow Status SonarCloud Coverage SonarCloud Bugs SonarCloud Vulnerabilities

API Key Generator

A DotNet library for generating and validating API keys. Although there are lots of libraries out there that help you implement API key logic using middleware, this library attempts to isolate exactly the code that does API key generation and validation using relatively safe practices.

The goal of this library is to strike the right balance between usability and reliability.

This library implements encryption of API keys as follows:

  • Encryption uses SHA256 on key + salt.
  • Keys and salts are 512 bits of randomness.

The library is intended to support future generations of algorithms while still being compatible with previously generated API keys.

For usability, this library works on a few basic principles:

  • API key validation should be able to give clear error messages if the key is malformed.
  • An API key is in the form <prefix><key ID>:<client secret><suffix>.
  • The prefix and suffix values determine if the client is sending the wrong API key, or if the key has been truncated.
  • The prefix and suffix also determine which generation of algorithm your key uses.
  • The Key ID is a GUID that can be used to uniquely identify the key in your storage system.
  • Keys can be stored in a database, REDIS, filesystem, or any other persistence mechanism.
  • The validation and key generation logic are as general purpose as possible so you can fit this library anywhere.

Using the API Key Generator

Still working on this documentation

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

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
0.9.5 156 9/24/2023
0.9.4 111 9/22/2023
0.9.3 179 7/14/2023
0.9.2 145 7/14/2023
0.9.1 160 7/13/2023

# 0.9.1
July 13, 2023

First release to NuGet; still in development.