Unclaimable.AspNetCore 0.1.0

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

<p align="center"> <img src="https://raw.githubusercontent.com/Perry3Dnl/Unclaimable/main/assets/unclaimable-icon.png" alt="Unclaimable icon" width="180" /> </p>

<h1 align="center">Unclaimable</h1>

<p align="center"> Strict, fast username and identifier validation for .NET. </p>

Release status: preparing the first public NuGet release, 0.1.0.

Unclaimable answers one question: should this identifier be claimable?

It combines curated reserved-name datasets with structural identifier rules, strict impersonation matching, bounded obfuscation detection, Unicode lookalike handling, localized profanity and trusted-role filtering, application-specific blocked values, and ASP.NET Core integration.

The default policy is intentionally strict. For most applications, configuration is optional:

builder.Services.AddUnclaimable();

English localized data is enabled by default. Additional language packs are additive: add only the languages your application needs, and remove English if you deliberately do not want it.

Packages

Package Target Purpose
Unclaimable netstandard2.0 dependency-free runtime core and embedded datasets
Unclaimable.AspNetCore net8.0 ASP.NET Core dependency injection and model validation

After 0.1.0 is published:

dotnet add package Unclaimable --version 0.1.0

For ASP.NET Core:

dotnet add package Unclaimable.AspNetCore --version 0.1.0

What Unclaimable provides

Unclaimable provides a strict baseline for usernames, handles, slugs, account names, and similar claimable identifiers.

The default policy includes:

  • reserved and protected names;
  • English localized datasets by default;
  • additive Dutch, German, French, Spanish, Italian, and Portuguese localized datasets;
  • global brand and technology impersonation datasets regardless of enabled languages;
  • strict embedded/partial reserved-name matching;
  • separator and punctuation normalization for reserved-name matching;
  • common leetspeak and symbol substitutions;
  • selected Unicode-confusable and lookalike detection;
  • localized profanity filtering;
  • minimum and maximum length rules;
  • numeric-character restrictions;
  • whitespace restrictions;
  • built-in blocked characters;
  • leading and trailing separator rules;
  • application-specific reserved values;
  • application-specific blocked characters;
  • structured fail-fast results;
  • detailed multi-diagnostic results;
  • ASP.NET Core dependency injection;
  • DataAnnotations validation;
  • configurable validation messages;
  • runtime-adjustable character policy.

Strict defaults

new Options() starts with the strict baseline:

Rule Default
Enabled localized languages English
Strict reserved-name matching enabled
Compact matching enabled
Partial matching enabled through strict mode
Obfuscation / leetspeak matching enabled
Unicode-confusable matching enabled
Profanity dataset enabled for enabled language(s)
Minimum length 3
Maximum length 32
Numbers rejected
Whitespace rejected
- blocked
_ blocked
Leading separators rejected
Trailing separators rejected

The baseline is opt-out. Applications that need a more permissive identifier policy can disable individual rules.

builder.Services.AddUnclaimable(options =>
{
    options.DisabledRules =
        Rule.Numbers |
        Rule.BlockedCharacters;
});

This keeps every other Unclaimable rule active.

Language support

Localized datasets currently support:

  • Language.English — enabled by default;
  • Language.Dutch;
  • Language.German;
  • Language.French;
  • Language.Spanish;
  • Language.Italian;
  • Language.Portuguese.

Each language pack uses the same localized dataset categories:

  • roles;
  • support;
  • system;
  • profanity.

Global datasets contain language-independent proper names such as brands, companies, platforms, products, and technology ecosystems. They are always active, so disabling every localized language does not make names such as paypal, github, or nike claimable.

English only — default

builder.Services.AddUnclaimable();

No language configuration is required because English is enabled by default.

English + Dutch

builder.Services.AddUnclaimable(options =>
{
    options.AddLanguage(Language.Dutch);
});

Adding a language does not replace English. It extends the enabled localized datasets.

Dutch only

builder.Services.AddUnclaimable(options =>
{
    options.RemoveLanguage(Language.English);
    options.AddLanguage(Language.Dutch);
});

Several languages

builder.Services.AddUnclaimable(options =>
{
    options.AddLanguage(Language.Dutch);
    options.AddLanguage(Language.German);
    options.AddLanguage(Language.French);
});

There is no separate multi-language mode. The enabled language set is additive. options.Languages is read-only; use AddLanguage(...) and RemoveLanguage(...) to configure runtime selection.

The additional language data is merged into the checker's indexes when the checker is constructed. Exact and compact checks remain dictionary lookups, while enabling more languages increases memory use and the amount of work performed by strict partial, Unicode-confusable, and obfuscation matching.

Language configuration controls which built-in localized datasets are loaded, not which language the submitted identifier is allowed to contain.

Removing source language packs

Language folders are deliberately optional source data. They live below data/languages/<code>/ and are included through a wildcard rather than fixed file references.

If a source checkout or fork does not need Dutch, it can simply delete:

data/languages/nl/

The project still compiles. The same applies to German, French, Spanish, Italian, Portuguese, and even English. A missing folder contributes no embedded localized entries; it does not create a compile-time dependency or require a code change.

This is separate from AddLanguage(...) / RemoveLanguage(...): those methods select from language data that exists in the build. Physically deleting a language folder trims that language data from the build itself. If application code enables a language whose folder was removed, that language simply contributes no built-in entries.

CI explicitly builds the core and ASP.NET Core projects from a temporary checkout with the entire data/languages/ directory removed, so the removable-pack behavior is continuously verified.

Rule controls

Rules are represented by Rule flags:

MinimumLength
MaximumLength
Whitespace
BlockedCharacters
LeadingSeparator
TrailingSeparator
Numbers
CompactMatching
PartialMatching
Profanity
ObfuscationMatching
UnicodeConfusableMatching

Disable only what your application deliberately wants to relax:

var options = new Options
{
    DisabledRules =
        Rule.Numbers |
        Rule.Whitespace
};

To use conservative reserved-name behavior instead of the strict default:

var options = new Options
{
    Strictness = Strictness.Standard
};

Structural identifier rules

Length

The default accepted length is 3 through 32 characters.

builder.Services.AddUnclaimable(options =>
{
    options.MinimumLength = 4;
    options.MaximumLength = 24;
});

Length checks are fail-fast and run before the more expensive reserved-name pipeline.

They can also be disabled independently:

options.DisabledRules =
    Rule.MinimumLength |
    Rule.MaximumLength;

Numbers

Unicode decimal digits are rejected by default.

ordinary2 -> NumbersNotAllowed
user١     -> NumbersNotAllowed

Allow numbers by disabling the numeric rule:

options.DisabledRules = Rule.Numbers;

Whitespace and blocked characters

Whitespace, -, and _ are blocked by the default structural policy.

john doe -> BlockedCharacter
john-doe -> BlockedCharacter
john_doe -> BlockedCharacter

Applications can add their own blocked characters at startup:

builder.Services.AddUnclaimable(options =>
{
    options.AdditionalBlockedCharacters("^", " ", "$");
});

The character API accepts one Unicode scalar value per entry.

Leading and trailing separators

Leading and trailing separator checks are enabled by default.

.john -> LeadingSeparator
john. -> TrailingSeparator

These rules remain independent from the general blocked-character policy. For example, an application may allow - inside a name while still rejecting -john and john-.

Runtime character policy

ASP.NET Core registration exposes a live IPolicy singleton. Applications can tighten or relax the character policy without rebuilding the checker or restarting the validation pipeline.

var policy = app.Services.GetRequiredService<IPolicy>();

policy.BlockCharacters("^", "$", "@");
policy.AllowCharacter("-");

Existing injected IChecker instances immediately observe those changes.

Runtime policy changes are process-local. Applications are free to load their desired policy from their own configuration source during startup or while the application is running.

The core package supports the same pattern directly:

var options = new Options();
var policy = new Policy(options.ConfiguredBlockedCharacters);
var checker = new Checker(options, policy);

policy.BlockCharacter("^");

checker.IsClaimable("normal^name"); // false

Reserved-name matching

Exact matching

Reserved names are normalized for casing and surrounding whitespace during the reserved-name pipeline.

For the default English checker:

customersupport
CUSTOMERSUPPORT

both resolve to the same protected value.

Compact matching

Compact matching is enabled by default. Separators and punctuation can be ignored when resolving a value against the reserved-name dataset.

When structural character restrictions are relaxed, localized or global protected values can still be detected after punctuation is removed.

Strict partial matching

Strict mode is the default. It catches protected names embedded inside larger values.

For example, with English enabled:

supportive -> support
apples     -> apple
nikee      -> nike

Protected terms from every enabled localized language participate in the same matching pipeline.

PartialMatchMinimumLength defaults to 4, which keeps very short reserved values from participating in ordinary substring matching.

builder.Services.AddUnclaimable(options =>
{
    options.PartialMatchMinimumLength = 5;
});

Obfuscation and leetspeak

Common substitutions are bounded and normalized during matching, including mappings such as:

0 -> o
1 -> i / l
2 -> z
3 -> e
4 -> a
5 -> s
7 -> t
8 -> b
@ -> a
$ -> s
! -> i / l
| -> i / l
+ -> t

If the numeric structural rule is relaxed, examples include:

N1k3   -> nike
G00gle -> google

Candidate expansion is bounded so ambiguous substitutions cannot grow without limit.

Unicode-confusable matching

Unicode-confusable matching is enabled by default. Unclaimable includes a bounded mapping for common visual impersonation characters, including selected Cyrillic and Greek lookalikes plus diacritic normalization.

For example:

аpple
^ Cyrillic U+0430

resolves to protected apple because technology and brand-style impersonation datasets are global.

Profanity matching

Profanity from every enabled localized language participates in matching by default.

English is enabled by default:

fuckwaffle -> profanity

Add other profanity datasets with the same language API:

options.AddLanguage(Language.Dutch);
options.AddLanguage(Language.German);

Profanity uses the same exact, compact, obfuscation, and Unicode-aware pipeline as the other datasets.

Applications can disable it independently:

options.DisabledRules = Rule.Profanity;

Substring matching for profanity is deliberately configurable separately because it is substantially more aggressive:

builder.Services.AddUnclaimable(options =>
{
    options.ProfanityPartialMatching = true;
});

Application-specific reserved names

Use AdditionalReserved for private product names, organization identities, internal bots, tenant names, or other protected values specific to your application.

builder.Services.AddUnclaimable(options =>
{
    options.AdditionalReserved.Add("examplebrand");
    options.AdditionalReserved.Add("internalbot");
});

Application-specific values are language-independent and participate in the same normalization and strict matching pipeline as the built-in datasets.

Core .NET API

Fast yes/no checks:

using Unclaimable;

if (Checker.Default.IsClaimable(userName))
{
    // Identifier passed the strict English default policy plus global datasets.
}

English + Dutch checker:

var options = new Options();
options.AddLanguage(Language.Dutch);
var checker = new Checker(options);

Dutch-only checker:

var options = new Options();
options.RemoveLanguage(Language.English);
options.AddLanguage(Language.Dutch);
var checker = new Checker(options);

Public checker contract:

public interface IChecker
{
    bool IsReserved(string? value);
    bool IsClaimable(string? value);
    Result Check(string? value);
    DetailedResult CheckDetailed(string? value, bool includeMessages = false);
}

Structured fail-fast results

var result = Checker.Default.Check("john-doe");

Console.WriteLine(result.IsReserved);             // true
Console.WriteLine(result.MatchKind);              // BlockedCharacter
Console.WriteLine(result.OffendingCharacter);     // -
Console.WriteLine(result.OffendingCharacterIndex);// 4

Current match kinds include:

None
Exact
Compact
Obfuscated
UnicodeConfusable
InvalidCharacters
Partial
NumbersNotAllowed
TooShort
TooLong
BlockedCharacter
LeadingSeparator
TrailingSeparator

Detailed diagnostics

Check(...) returns the first failure as quickly as possible.

Use CheckDetailed(...) when UI, logging, or diagnostics benefit from seeing multiple reasons:

var result = Checker.Default.CheckDetailed(
    "support2",
    includeMessages: true);

foreach (var diagnostic in result.Diagnostics)
{
    Console.WriteLine($"{diagnostic.Kind}: {diagnostic.Message}");
}

A detailed check can report both a structural-policy violation and a protected-name match.

ASP.NET Core

Register once in Program.cs:

builder.Services.AddUnclaimable();

Or customize the policy:

builder.Services.AddUnclaimable(options =>
{
    options.AddLanguage(Language.Dutch);
    options.AddLanguage(Language.German);

    options.MinimumLength = 4;
    options.MaximumLength = 24;

    options.AdditionalReserved.Add("examplebrand");
    options.AdditionalBlockedCharacters("^", "$");

    options.DisabledRules = Rule.Numbers;
});

Inject the checker anywhere:

public sealed class UsernameService(IChecker checker)
{
    public bool CanRegister(string userName) => checker.IsClaimable(userName);
}

Or use DataAnnotations in Razor Pages / MVC:

using System.ComponentModel.DataAnnotations;
using Unclaimable.AspNetCore;

public sealed class SignupModel
{
    [Required]
    [ClaimableUsername]
    public string UserName { get; set; } = string.Empty;
}

[Required] remains useful for required-field semantics; Unclaimable focuses on whether a supplied identifier is claimable.

Validation messages

Configure one application-wide fallback:

builder.Services.AddUnclaimable(options =>
{
    options.ValidationMessage = "{FieldName} is not available.";
});

Or configure messages by rejection reason:

builder.Services.AddUnclaimable(options =>
{
    options.Messages.Reserved =
        "{FieldName} '{MatchedValue}' is reserved.";

    options.Messages.Partial =
        "{FieldName} contains protected value '{MatchedValue}'.";

    options.Messages.NumbersNotAllowed =
        "Numbers are not allowed in {FieldName}; '{Character}' was found at index {Index}.";

    options.Messages.BlockedCharacter =
        "{FieldName} contains blocked character '{Character}'.";

    options.Messages.TooShort =
        "{FieldName} has {Length} characters; at least {MinimumLength} are required.";

    options.Messages.TooLong =
        "{FieldName} has {Length} characters; at most {MaximumLength} are allowed.";
});

Supported placeholders include:

Placeholder Value
{FieldName} DataAnnotations display name
{MatchedValue} matched protected value
{Category} matched dataset category
{Character} offending character
{Index} zero-based offending-character index
{Length} supplied value length
{MinimumLength} configured minimum length
{MaximumLength} configured maximum length

Message precedence is:

  1. [ClaimableUsername(ErrorMessage = "...")];
  2. reason-specific options.Messages.* message;
  3. options.ValidationMessage fallback;
  4. Unclaimable's built-in message.

Datasets

Reserved values are stored as human-reviewable JSON below data/ and embedded into the core package.

Current scopes:

Scope Categories Behavior
languages/en profanity, roles, support, system enabled by default; folder may be removed from source builds
languages/nl profanity, roles, support, system optional, additive; folder may be removed
languages/de profanity, roles, support, system optional, additive; folder may be removed
languages/fr profanity, roles, support, system optional, additive; folder may be removed
languages/es profanity, roles, support, system optional, additive; folder may be removed
languages/it profanity, roles, support, system optional, additive; folder may be removed
languages/pt profanity, roles, support, system optional, additive; folder may be removed
global brands, technology always loaded

Localized dataset documents declare their language explicitly where possible:

{
  "schema": 1,
  "category": "support",
  "language": "de",
  "description": "...",
  "values": ["..."]
}

Language-independent data uses:

"language": "global"

The loader uses document metadata rather than hard-coded language-pack paths. The project file embeds data/**/reserved.json, so only files that actually exist are compiled into a build.

Matching pipeline

Check(...) is fail-fast. The effective order is designed to reject inexpensive policy violations before performing more expensive normalization work:

  1. minimum / maximum length;
  2. leading / trailing separator checks;
  3. numeric and character policy checks;
  4. exact reserved-name matching;
  5. compact matching;
  6. strict partial matching;
  7. Unicode-confusable matching;
  8. bounded obfuscation / leetspeak matching.

Built-in protected values for all enabled language scopes are indexed when the checker is constructed. Normal exact and compact lookups use hashed dictionaries rather than repeatedly scanning the full dataset.

Repository layout

.github/workflows/
assets/
conformance/
data/
  global/
    brands/
    technology/
  languages/
    en/
    nl/
    de/
    fr/
    es/
    it/
    pt/
platforms/dotnet/src/Unclaimable/
  Languages/
platforms/dotnet/src/Unclaimable.AspNetCore/
platforms/dotnet/tests/Unclaimable.Tests/
platforms/dotnet/smoke/Unclaimable.ConsumerSmoke/

License

MPL-2.0

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.0.0 130 10/28/2026
0.8.5 936 10/14/2026
0.8.4 177 10/12/2026
0.8.3 105 10/9/2026
0.8.2 121 10/2/2026
0.8.1 105 10/2/2026
0.8.0 5,814 9/21/2026
0.7.8 1,167 9/18/2026
0.7.7 163 9/18/2026
0.7.6 183 9/18/2026
0.7.4 131 9/17/2026
0.7.0 689 9/15/2026
0.6.0 221 9/15/2026
0.5.0 302 9/9/2026
0.4.0 122 9/9/2026
0.3.0 128 9/8/2026
0.2.0 124 9/8/2026
0.1.0 170 9/8/2026