Ark.Captcha 0.0.3

dotnet add package Ark.Captcha --version 0.0.3
                    
NuGet\Install-Package Ark.Captcha -Version 0.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="Ark.Captcha" Version="0.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ark.Captcha" Version="0.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Ark.Captcha" />
                    
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 Ark.Captcha --version 0.0.3
                    
#r "nuget: Ark.Captcha, 0.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 Ark.Captcha@0.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=Ark.Captcha&version=0.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Ark.Captcha&version=0.0.3
                    
Install as a Cake Tool

ArkCaptcha

A lightweight, self-hosted CAPTCHA solution for modern web applications.

ArkCaptcha provides:

  • ๐Ÿ” Secure CAPTCHA generation via ASP.NET Core (NuGet)
  • ๐ŸŒ Reusable browser SDK (NPM / JS)
  • ๐Ÿงฉ Razor TagHelper support (server-rendered UI)
  • โšก Zero external dependencies (no third-party services)
  • ๐Ÿข Enterprise-ready (extensible, self-hosted, compliant)

๐Ÿ“ฆ Packages

Backend (NuGet)

ArkCaptcha.AspNetCore

Frontend (NPM)

ark-captcha

๐Ÿš€ Features

  • Image-based CAPTCHA with noise & distortion
  • Token-based validation (one-time use)
  • Works with ASP.NET Core MVC / Razor Pages
  • Drop-in TagHelper (<captcha>)
  • Fully customizable UI or auto-rendered UI
  • No external API calls (unlike reCAPTCHA)

๐Ÿ—๏ธ Architecture

Browser (ArkCaptcha JS)
        โ†“
ASP.NET Core API (Captcha Middleware)
        โ†“
Token + Image
        โ†“
User Input
        โ†“
Validation (Server-side)

๐Ÿ”ง Installation

1. NuGet (Backend)

dotnet add package ArkCaptcha.AspNetCore

2. NPM (Frontend)

npm install ark-captcha

Or include via script:

<script src="/js/ark-captcha.js"></script>

โš™๏ธ ASP.NET Core Setup

Register Middleware

builder.Services.AddArkCaptcha();

var app = builder.Build();

app.UseArkCaptcha();

Default Endpoints

Endpoint Description
/api/captcha Generate CAPTCHA
/api/captcha/validate Validate CAPTCHA

๐Ÿงช Usage Options


โœ… Option 1: Automatic JS Rendering

<script src="/js/ark-captcha.js"></script>

<script>
new ArkCaptcha({
    apiUrl: "/api/captcha"
});
</script>

โœ” No HTML required โœ” Auto UI injected


โœ… Option 2: Custom UI

<img id="captchaImg" />
<input id="captchaInput" />
<button id="refresh">Refresh</button>

<script>
new ArkCaptcha({
    apiUrl: "/api/captcha",
    imageElement: document.getElementById("captchaImg"),
    inputElement: document.getElementById("captchaInput"),
    refreshButton: document.getElementById("refresh")
});
</script>

โœ… Option 3: ASP.NET Core TagHelper

Razor

<captcha asp-for="Captcha" api-url="/api/captcha"></captcha>

ViewModel

public class CaptchaModel
{
    public string Token { get; set; }
    public string Value { get; set; }
}

public class FormModel
{
    public string Name { get; set; }
    public CaptchaModel Captcha { get; set; }
}

Controller

[HttpPost]
public IActionResult Submit(FormModel model)
{
    var isValid = _captchaService.ValidateCaptcha(
        model.Captcha.Token,
        model.Captcha.Value
    );

    if (!isValid)
    {
        ModelState.AddModelError("Captcha", "Invalid captcha");
        return View(model);
    }

    return Ok("Success");
}

๐Ÿ” Validation (Optional Attribute)

[ValidateCaptcha]
public CaptchaModel Captcha { get; set; }

๐ŸŽจ UI Behavior

If no elements are provided, ArkCaptcha:

  • Injects responsive HTML
  • Adds built-in CSS
  • Handles validation UI

โš™๏ธ Configuration (Optional)

new ArkCaptcha({
    apiUrl: "/api/captcha",
    container: document.getElementById("captcha"),
    autoRender: true
});

๐Ÿ”’ Security Features

  • One-time token validation
  • Case-insensitive verification
  • Noise + distortion rendering
  • No third-party tracking
  • Self-hosted (GDPR-friendly)

๐Ÿ“ Project Structure

ArkCaptcha/
 โ”œโ”€โ”€ src/
 โ”‚   โ”œโ”€โ”€ ArkCaptcha.AspNetCore/
 โ”‚   โ””โ”€โ”€ ark-captcha.js
 โ”œโ”€โ”€ LICENSE
 โ”œโ”€โ”€ THIRD-PARTY-NOTICES.txt
 โ””โ”€โ”€ README.md

โš–๏ธ Licensing

  • This project is licensed under the MIT License
  • Includes third-party components under BSD-3-Clause

See:

  • LICENSE
  • THIRD-PARTY-NOTICES.txt

๐Ÿ’ก Best Practices

  • Use distributed cache (Redis) for production
  • Enable rate limiting on CAPTCHA endpoints
  • Set token expiry (e.g. 5 minutes)
  • Avoid exposing token in query strings

๐Ÿš€ Roadmap

  • Dark mode support
  • Canvas-based CAPTCHA
  • Invisible CAPTCHA (behavior-based)
  • Blazor component
  • Multi-language support

๐Ÿค Contributing

Contributions are welcome!

  • Fork the repo
  • Create a feature branch
  • Submit a PR

โญ Support

If you find this useful, consider giving a โญ on GitHub!


โญ Author:

raj@immanuel - Immanuel R

Product Compatible and additional computed target framework versions.
.NET 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
0.0.3 111 3/24/2026
0.0.2 102 3/24/2026
0.0.1 108 3/24/2026

convinient onliner implementaiton for captcha