npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ark-captcha

v0.0.3

Published

simple library, works with the base ark server side

Readme

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