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

@ninshorg/server

v0.1.1

Published

Ninsho authentication engine for Node.js — opaque or PASETO tokens, injected session store, secure by default.

Readme

@ninshorg/server

認証 — an authentication engine for Node.js.

Sessions, refresh-token rotation with reuse detection, authorization, and rate limiting. Secure by default, with one dependency (ioredis) and no framework coupling.

npm install @ninshorg/server

Setup

import { Ninsho, RedisStore } from '@ninshorg/server';

const auth = new Ninsho({ store: new RedisStore(process.env.REDIS_URL!) });

That is the complete configuration. No keys to generate, no algorithm to choose. It yields opaque tokens, fail-closed behaviour on a store outage, five-minute access tokens, and refresh rotation with reuse detection.

import { getAuth } from '@ninshorg/server';

// After verifying credentials yourself — Ninsho does not own your user model.
const pair = await auth.createSession({ userId, roles: ['user'], scopes: [] });

app.get('/me', auth.verify(), (req, res) => res.json(getAuth(req)));
app.get('/admin', auth.verify(), auth.requireRole('admin'), handler);

// Authenticated is not the same as entitled. Without this, any signed-in user
// reads anyone's orders by changing the URL — OWASP API Security #1.
app.get('/users/:id/orders',
  auth.verify(),
  auth.requireOwner((req) => req.params?.id),
  handler);

Express Request and Response satisfy the middleware types structurally, so there is no Express dependency and no global type augmentation.

Two token strategies, one API

opaque (default) — a 256-bit random token with all state in the store. Revocation is native and immediate, there are no signing keys to leak or rotate, and the token carries no claims to disclose. Correct for a single application, and ~15× faster to verify than the alternative.

paseto — PASETO v4.public, Ed25519, for services that must verify independently without a shared store. Requires issuer, audience and a key set; supports rotation with an overlap window so no one is signed out.

const auth = new Ninsho({
  store,
  strategy: 'paseto',
  issuer: 'https://id.example.com',
  audience: 'orders-api',
  keys: { active: generateKeyPair('2026-08') },
});

Refresh reuse is treated as theft

Replaying a rotated refresh token revokes the entire session family and emits refresh.reuse_detected, per RFC 9700 §4.14.2. Rejecting the replay and stopping there — the common implementation — leaves a thief holding a valid rotating chain while the victim sees one failed refresh and signs in again.

Requirements

Node 20+. Redis 6.2+ for RedisStore (GETDEL makes single-use consumption atomic). MemoryStore is available for development and refuses to construct under NODE_ENV=production.

Documentation

README · Security model and threat model · Performance · Example API

Status

Pre-release (0.1.0). Not independently audited. The API may change.

MIT