TheBlueSky.SwiftAuthenticator 1.0.0

A simple and straightforward HOTP and TOTP library for .NET.

There is a newer version of this package available.
See the version list below for details.
Install-Package TheBlueSky.SwiftAuthenticator -Version 1.0.0
dotnet add package TheBlueSky.SwiftAuthenticator --version 1.0.0
<PackageReference Include="TheBlueSky.SwiftAuthenticator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TheBlueSky.SwiftAuthenticator --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

The simplest way to get started is to use the API with the default parameters:

  1. Create an instance of Authenticator:
var authenticator = new Authenticator();
  1. Generate a secret (will generate a Base32 encoded 20-byte secret):
var secret = authenticator.GenerateSecret();
  1. Generate a password from the secret (will generate a 6-digit HOTP using the provided iteration and 6-digit TOTP using the current UTC time and 30-second step):
// HMAC-Based One-Time Password (HOTP)
var hotp = authenticator.GenerateCounterBasedPassword(secret, 28091977);

// Time-Based One-Time Password (TOTP)
var totp = authenticator.GenerateTimeBasedPassword(secret);

The simplest way to get started is to use the API with the default parameters:

  1. Create an instance of Authenticator:
var authenticator = new Authenticator();
  1. Generate a secret (will generate a Base32 encoded 20-byte secret):
var secret = authenticator.GenerateSecret();
  1. Generate a password from the secret (will generate a 6-digit HOTP using the provided iteration and 6-digit TOTP using the current UTC time and 30-second step):
// HMAC-Based One-Time Password (HOTP)
var hotp = authenticator.GenerateCounterBasedPassword(secret, 28091977);

// Time-Based One-Time Password (TOTP)
var totp = authenticator.GenerateTimeBasedPassword(secret);

  • .NETStandard 2.0

    • No dependencies.

Version History

Version Downloads Last updated
2.0.0 179 8/4/2018
1.1.0 139 7/21/2018
1.0.0 269 12/26/2017