AuthifyPass.Client 1.0.3

dotnet add package AuthifyPass.Client --version 1.0.3
                    
NuGet\Install-Package AuthifyPass.Client -Version 1.0.3
                    
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="AuthifyPass.Client" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AuthifyPass.Client" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="AuthifyPass.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AuthifyPass.Client --version 1.0.3
                    
#r "nuget: AuthifyPass.Client, 1.0.3"
                    
#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.
#:package AuthifyPass.Client@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AuthifyPass.Client&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=AuthifyPass.Client&version=1.0.3
                    
Install as a Cake Tool

Nuget Nuget

AuthifyPass.Client Library Documentation

Overview

The AuthifyPass.Client library to consume AuthifyPass API.

Prerequisites

To use this library, you need:

Installation

  1. Install the NuGet Package:

    • Install the AuthifyPass.Client NuGet package in your project using the Package Manager or the .NET CLI:
      dotnet add package AuthifyPass.Client
      
  2. Configure Client:

    • In your appsettings, add
      "AuthifyPassOptions": {
        "ClientID": "",
        "Secret": "",
        "BaseUrl": "https://authifypass.com/",
        "UserEndpoint": "user",
        "ValidateCodeEndpoint": "user/validate-code",
        "Header": "x-authify-key"
      }
    
    • NOTE: If AuthifyPass API it's in other URL or change the endpoints, here is where can set. Also the Header key.
    • NOTE: Because AuthifyPass is opensource, you can download the code and personalize, so here can change the values.
  3. Register dependencies:

    • Add the IAuthifyPassClient to your dependencies.
    var builder = WebApplication.CreateBuilder(args); // OR any other like var builder = WebAssemblyHostBuilder.CreateDefault(args);
    [...]
    builder.Services.AddAuthifyPassClient();
    [...]
    

How to use

Create new QR

internal class Enable2FactorQRInteractor(IAuthifyPassClient client)
{
    public async Task<AuthifyPassDto> GetQR(string userId, CancellationToken token)
    {
        var response = await client.RequestUser2FactorQRAsync(userId, user.Email, token);
        var result = new AuthifyPassDto(response.Sharedkey, response.ImageSVG);
        result.Code = userId;
        return result;
    }
}

Login example

internal class UserLoginInteractor(
    IRepository<User> repository,
    IValidator<UserRequest> validator,
    IAuthifyPassClient client)
{
    public async Task Login(UserRequest login)
    {
        bool isValidated = await validator.Validate(login);
        if (isValidated)
        {
            User? user = await repository.GetAsync(u => u.Email == login.Email);
            if (user is not null && user.PasswordHash == login.Password)
            {
                var result2Factor = await client.ValidateUser2FactorAsync(user.Id.ToString(), login.DoubleFactorCode);
                if (!result2Factor)
                    throw new UnauthorizedAccessException("Two-factor authentication is enabled for this user.");
            }
        }
        throw new UnauthorizedAccessException("Invalid email or password.");
    }
}

Delete User and all QR

internal class DeleteFactorQRInteractor(IAuthifyPassClient client)
{
    public async Task DeleteUserQR(string userId, CancellationToken token)
    {
        await client.RequestDeleteUser2FactorAsync(userId, token);
    }
}
NOTES:
  • UserId It's a string, can send any identityies. This identifier it's HASH in AuthifyPass API Side, so we don't have any data from user.
  • When delete a User, delete all QR and no more validation will happen.
  • User Client App can also delete the QR and invalidate all QR generated.

Errors

When have some error client will return a ProblemDetails model.

Models

The library includes two main models:

  • AuthifyPassOptions:

    • Represents the configuration about AuthifyPass API. Check documentation https://authifypass.com/api/docs.
    • Properties:
      • SectionKey
      • ClientID
      • Secret
      • BaseUrl
      • UserEndpoint
      • ValidateCodeEndpoint
      • Header
  • AuthifyPassResponse:

    • Represents the response when request for some new QR and Shared Key.
    • Properties:
      • Sharedkey
      • ImageSVG: QR

Contributing

If you encounter issues or have suggestions for improvements, please submit an issue or pull request to the repository hosting this library.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
1.0.3 208 2/23/2026
1.0.2 237 12/4/2025
1.0.1 450 11/21/2025
1.0.0 432 11/20/2025

Target Net 9. Update dependencies.