Loading...
Loading...
Global Username Analysis & Security Scoring Library
Global Username Analysis & Security Scoring Library
username-intelligence is an advanced, lightweight library designed to analyze usernames for modern applications. Beyond simple regex validation, it evaluates security context, bot patterns, spoofing risks, and supports hundreds of global language scripts (Unicode).
Perfect for:
xcv892nm).readability and security_risk.h4ck3r → hacker) and mathematical fonts.npm install username-intelligence
The easiest way to use the library. Simply pass a username to get a full analysis.
import { analyzeUsername } from 'username-intelligence';
// Example: Analyzing a username with leet speak
const result = analyzeUsername('h4ck3r_man');
if (result.isValid) {
console.log("Username is valid!");
} else {
console.log("Username rejected:", result.reason);
}
This is the JSON data structure returned by the analyzeUsername function.
{
"username": "h4ck3r_man",
"score": 85,
"classification": "Gamer",
"isValid": true,
"flags": ["leet_speak"],
"security": {
"risk_level": "LOW",
"is_spoofing": false,
"has_hidden_chars": false
},
"metadata": {
"script": "Latin",
"entropy": 2.5
}
}
You can customize the validation rules to fit your application needs.
const options = {
strict: true, // If true, enables stricter validation
blockProfanity: true, // Automatically blocks profane words
reservedWords: ['admin', 'support', 'mod'], // Custom list of forbidden words
checkVisual: true // Checks for visual similarity (e.g., adm1n == admin)
};
const result = analyzeUsername('admin_support', options);
Contributions are welcome! Please feel free to submit a Pull Request.
Distributed under the MIT License. See LICENSE for more information.