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

@oomfware/safe-idn

v0.1.2

Published

detect IDN homograph spoofing

Readme

@oomfware/safe-idn

detect IDN homograph spoofing.

npm install @oomfware/safe-idn

browsers and other user agents must decide whether to display internationalized domain names (IDN) in their decoded Unicode form or keep them as punycode. showing Unicode unconditionally enables phishing — for example, xn--80ak6aa92e.com decodes to аррӏе.com, which uses Cyrillic letters to impersonate apple.com.

this library implements Chromium's IDN display algorithm in TypeScript. it checks each label of a domain for script mixing, confusable characters, dangerous patterns, and other spoofing vectors, then returns either the safe Unicode form or the original punycode.

usage

quick check

use safeDisplay() to get the safe display form of a domain:

import { safeDisplay } from '@oomfware/safe-idn';

// safe domains decode to Unicode
safeDisplay('xn--nxasmq6b.com');
// -> "βόλος.com"

// spoofed domains stay as punycode
safeDisplay('xn--80ak6aa92e.com');
// -> "xn--80ak6aa92e.com" (Cyrillic "аррӏе" impersonating "apple")

detailed results

use checkDomain() for per-label verdicts:

import { checkDomain } from '@oomfware/safe-idn';

const result = checkDomain('xn--80ak6aa92e.com');

console.log(result.display);
// -> "xn--80ak6aa92e.com"

console.log(result.labels[0]);
// -> { input: 'xn--80ak6aa92e', unicode: 'аррӏе', result: 'unsafe' }

each label result contains:

  • input — the original label as it appeared in the domain
  • unicode — the decoded Unicode form (even if unsafe)
  • result'safe', 'unsafe', or 'invalid'

what it checks

the following safety checks are performed, matching Chromium's behavior:

  • script mixing — blocks unsafe combinations of Unicode scripts (e.g., Latin + Cyrillic)
  • whole-script confusables — detects labels where every character in a script has a Latin lookalike (e.g., Cyrillic "а" for Latin "a")
  • skeleton confusables — compares UTS #39 skeletons against a list of top domains to catch near-lookalikes
  • character blocklist — blocks characters known to cause confusion (symbols, ligatures, IPA extensions, etc.)
  • dangerous patterns — catches combining mark abuse, dot-after-i/j tricks, and RTL mark misplacement
  • mixed digit systems — prevents mixing digits from different scripts
  • digit lookalikes — detects non-digit characters that resemble ASCII digits
  • kana confusables — catches Hiragana/Katakana interchange and context violations
  • TLD-specific rules — restricts characters like þ, ð, ə, and · to their appropriate TLDs
  • deviation characters — blocks ZWNJ and ZWJ
  • IDN TLD spoofing — detects punycode TLDs whose skeletons match common ASCII TLDs