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

@nice2dev/auth

v1.4.64

Published

Nice2Dev Auth — Login, registration, OAuth, 2FA, captcha, password strength, token management for React

Readme

@nice2dev/auth

Authentication & authorization UI components for React — login, registration, OAuth, 2FA, captcha, password management, and token handling.

npm License: MIT TypeScript


Installation

npm install @nice2dev/auth

Peer dependencies: react >= 17.0.0, react-dom >= 17.0.0

Import the stylesheet once, e.g. in your app's entry — the components' JavaScript does not load it:

import '@nice2dev/auth/style.css';

Components

| Component | Description | | ----------------------- | -------------------------------------------------------------------------------------- | | NiceLoginForm | Login form with email/password, validation, remember me | | NiceRegistrationForm | Registration form: fields required / optional / hidden, custom fields, password policy | | NiceTwoFaSetup | TOTP 2FA setup with QR code display | | NiceChangePassword | Change/reset password with strength meter and generator icons | | NiceCaptcha | Captcha widget (pluggable providers) | | NicePasswordStrength | Password field with an eye and a strength bar as wide as the input (or the bar alone) | | NicePasswordGenerator | Password generator; iconsOnly dice + copy icons, bindTo fills any number of fields | | NiceOAuthButtons | OAuth provider login buttons (Google, GitHub, Microsoft, etc.) | | NiceAuthGuard | Protected route/section wrapper | | NiceTokenManagement | API token CRUD management |

Password strength

scorePassword(password) returns { score, entropyBits, label, hints } — one scale for the meter, the generator and the forms' minPasswordStrength. The score comes from the estimated entropy (length × character pool), with common passwords, years, sequences (abc, 123, qwerty) and repeats discounted:

| score | level | bits | random characters of all four kinds | | ----- | ----------- | ------- | ----------------------------------- | | 0 | Very weak | < 28 | | | 1 | Weak | 28 – 39 | 5 – 6 | | 2 | Fair | 40 – 55 | 7 – 8 | | 3 | Strong | 56 – 71 | 9 – 10 | | 4 | Very strong | 72 – 99 | 11 – 15 | | 5 | Excellent | ≥ 100 | 16 and more |

minPasswordStrength (default 2, Fair) takes this scale; levels 0 – 4 keep their old names. calcPasswordStrength() (0 – 4) is deprecated: it is scorePassword with Excellent folded into 4.

Since 1.4.60 scorePassword, checkPasswordPolicy and their types live in @nice2dev/ui-core (this package re-exports them), so NicePasswordInput (@nice2dev/ui, showStrength) and NicePassphraseInput (@nice2dev/ui-security, minStrength) rate on the same scale.

Hooks

| Hook | Description | | --------- | --------------------------------------------------- | | useAuth | Auth state management (JWT, roles, refresh, logout) |

Usage

import { NiceLoginForm, useAuth } from '@nice2dev/auth';

function LoginPage() {
  const { login, user } = useAuth({
    loginFn: async (credentials) => {
      const res = await fetch('/api/auth/login', {
        method: 'POST',
        body: JSON.stringify(credentials),
      });
      return res.json();
    },
  });

  if (user) return <div>Welcome, {user.name}</div>;

  return <NiceLoginForm onLogin={login} />;
}

Types

Key TypeScript types exported: AuthUser, AuthTokens, AuthState, AuthActions, UseAuthConfig, CaptchaProvider, OAuthProvider, PasswordStrengthLevel.

License

MIT © NiceToDev