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" />
<PackageReference Include="Ark.Captcha" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=Ark.Captcha&version=0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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:
LICENSETHIRD-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 | Versions 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.
-
net10.0
- SkiaSharp (>= 3.119.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
convinient onliner implementaiton for captcha