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 🙏

© 2025 – Pkg Stats / Ryan Hefner

hex-authn-passport

v1.0.6

Published

Middleware implementating various login strategies. Written hastily, but used regularly (Twilio SMS plugin, anyway).

Downloads

14

Readme

hex-authn-passport

Middleware implementating various login strategies. Written hastily, but used regularly (Twilio SMS plugin, anyway).

See express-hex for a general explanation of how this type of middleware works.

A running Redis server is currently required for token expiry bookkeeping and for account storage with the local plugin.

Provided middleware

  • base - Basic behaviors including Passport initialization, a /login page listing available plugins, log-out, session serialization. Not necessary to include directly, pulled in by all plugins
  • standalone - There are two modes of operation: as the /login component of an application containing other stuff, or include this for a standalone mode that only does authentication, and communicates back sessions to other services via JSON web tokens. See middleware/standlone.js for more info.
  • plugins:
    • local - Authenticate against a Redis database. (Could be trivially changed to other stores)
    • shibboleth - Barely-working example of how Shibboleth could work, only currently works with TestShib. Should actually be done through the SAML plugin.
    • sms - Log in with an SMS code, caveat emptor
    • google - Log in with Google. See middleware/google.js for info about how to set up your Google API account
    • hex - Log in by redirecting to another server that is running this library with the standalone mode engaged. This shows what other software would have to do to interface with a standalone server running independently. Namely, do key exchange, sign a token with the URL you would like the session JWT returned to, redirect, and listen for that callback. The callback should then attempt to prevent double spends and token expiry.

Test app

Run yarn testapp to bootstrap the test application, then in the testapp path run:

DEBUG=hex:* node consumer-server and, in other terminal or having sent that to the background: DEUB=hex:* node standalone-server

In this setup, the consumer server on :4000 will redirect attempts at /login to the standalone server on :4001.

http://localhost:4000/ will print your session information.

The standalone server has all the plugins enabled, though most require API keys to be added to the configuration.

cd testapp && node ../scripts/add-redis-user will let you put in a test account that will work for the purposes of the local plugin.