YMJake.FusionCaptcha.Storage.Redis 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package YMJake.FusionCaptcha.Storage.Redis --version 1.0.0
                    
NuGet\Install-Package YMJake.FusionCaptcha.Storage.Redis -Version 1.0.0
                    
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="YMJake.FusionCaptcha.Storage.Redis" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YMJake.FusionCaptcha.Storage.Redis" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="YMJake.FusionCaptcha.Storage.Redis" />
                    
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 YMJake.FusionCaptcha.Storage.Redis --version 1.0.0
                    
#r "nuget: YMJake.FusionCaptcha.Storage.Redis, 1.0.0"
                    
#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 YMJake.FusionCaptcha.Storage.Redis@1.0.0
                    
#: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=YMJake.FusionCaptcha.Storage.Redis&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=YMJake.FusionCaptcha.Storage.Redis&version=1.0.0
                    
Install as a Cake Tool

FusionCaptcha

FusionCaptcha

FusionCaptcha is a .NET captcha toolkit built on top of the Vello rendering pipeline. It focuses on three core responsibilities—code generation, image rendering, and persistence—while leaving fonts, backgrounds, and other resources entirely in the hands of your application. This keeps the library lightweight and easy to integrate into Web API, Minimal API, or background services.

Packages

Package Description
YMJake.FusionCaptcha.Abstractions Core contracts (ICaptcha, ICaptchaRenderer, IStorage, CaptchaOptions, etc.).
YMJake.FusionCaptcha.Core Default pipeline (background → text → noise → distortion), Vello renderer, font/background providers, DI extensions.
YMJake.FusionCaptcha.Storage.Memory IMemoryCache-based storage provider.
YMJake.FusionCaptcha.Storage.Redis StackExchange.Redis-based storage provider with async APIs.
samples/YMJake.CaptchaSharp.MinimalApi Minimal API sample demonstrating DI wiring and Swagger testing.

Installation

dotnet add package YMJake.FusionCaptcha.Core
dotnet add package YMJake.FusionCaptcha.Storage.Memory
# or
dotnet add package YMJake.FusionCaptcha.Storage.Redis

Vello’s native dependencies (vello_ffi.dll, etc.) are shipped transitively via NuGet. Ensure your runtime RID is supported by Vello.

Quick Start (ASP.NET Core)

using YMJake.CaptchaSharp.Abstractions;
using YMJake.CaptchaSharp.Core;
using YMJake.CaptchaSharp.Storage.Memory;

var builder = WebApplication.CreateBuilder(args);

builder.Services
    .AddCaptcha(options =>
    {
        options.Image.Width = 160;
        options.Image.Height = 60;
        options.Image.FontSize = 36;
        options.Image.FontFamily = "ActionJ";
        options.Image.BackgroundImage = "Grid";
    })
    .UseFileResources(resources =>
    {
        resources.Fonts.BasePath = Path.Combine(builder.Environment.ContentRootPath, "Resources", "Fonts");
        resources.Fonts.AddFont("actionj.ttf", "ActionJ");

        resources.Backgrounds.BasePath = Path.Combine(builder.Environment.ContentRootPath, "Resources", "Backgrounds");
        resources.Backgrounds.AddBackground("grid.png", "Grid");
    })
    .UseVelloRenderer()
    .UseCaptchaMemoryStorage();

var app = builder.Build();

app.MapGet("/captcha", async (string id, ICaptcha captcha) =>
{
    var result = await captcha.GenerateAsync(id);
    return Results.File(result.Bytes, result.ContentType);
});

app.MapGet("/captcha/validate", (string id, string code, ICaptcha captcha) =>
{
    var success = captcha.Validate(id, code);
    return Results.Ok(new { id, code, success });
});

app.Run();

Resource Management

  • Fonts – Inject via IFontProvider. UseFileResources / UseFileFontOptions loads fonts from disk and exposes them through options.Image.FontFamily.
  • Backgrounds – Provided by IBackgroundProvider. The default is a solid color, but you can register multiple background images and pick one via options.Image.BackgroundImage.
  • Pipeline StepsBackgroundStep, TextStep, NoiseStep, DistortionStep all implement ICaptchaPipelineStep. You can replace or extend them with custom steps.

Storage Options

  • UseCaptchaMemoryStorage() – Uses IMemoryCache, ideal for single-node deployments or tests.
  • UseCaptchaRedisStorage(options => { ... }) – Backs captcha storage with Redis; configure connection string, database index, key prefix, etc.

Feature Highlights

  • Pure managed rendering pipeline powered by Vello + ImageSharp (PNG output by default).
  • Fonts/backgrounds are provided by the host application; the library ships without embedded assets.
  • DI-friendly configuration: .AddCaptcha().UseVelloRenderer().UseCaptchaMemoryStorage().
  • Memory and Redis storage providers with async validation APIs.
  • Minimal API sample with Swagger ready to debug.

Roadmap

  • Additional captcha types: Chinese, arithmetic, slider, animated variants.
  • Pluggable pipeline DSL similar to QrBuilder.
  • GIF / WebP / ImageSharp encoders.
  • Storage-level TTL strategies and hit stats for custom rate limiting.

Contributions and feature requests are always welcome!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  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 was computed.  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.1.1 691 12/3/2025
1.1.0 684 12/3/2025
1.0.0 674 12/2/2025