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

giz

v0.3.1

Published

A bunch of auth functions for web applications.

Readme

giz

"You can't trust code that you did not totally create yourself." --Ken Thompson

giz is a bunch of auth functions for web applications.

Current status of the project

The current version of giz, v0.3.1, is considered to be somewhat stable and somewhat complete. Suggestions and patches are welcome. Future changes planned are:

  • Add annotated source code.

Installation

The dependencies of giz are two:

  • bcryptjs, which is used to hash passwords and password recovery tokens.
  • redis, which is used as the default datastore.

To install, type npm i giz.

giz should work with any version of node. However, if you use the default db (redis), you'll need 0.10.0 or newer, plus a redis server available.

Usage

Functions

  • giz.auth: takes a session token and a callback. If successful, the callback receives as its second argument an object with the form {id: ..., pass: ...}.
  • giz.logout: takes a session token and a callback.
  • giz.login: takes an user, a password and a callback. If successful, the callback receives as its second argument a session.
  • giz.signup: takes an user, a password and a callback.
  • giz.signlog: takes an user, a password and a callback. It attempts to signup the user and then immediately log them in.
  • giz.recover: takes an user and a callback. If successful, the callback receives as its second argument a token for resetting the user's password.
  • giz.reset: takes an user, a password recovery token (generated with giz.recover), a new password and a callback.
  • giz.destroy: takes an user and a callback. Deletes the user.

Config & using a different db

The keys used by giz are: users:ID, session:ID and token:ID (for changing password). First is hash, other two are strings. First one only is {password: PASSEQUIVALENT}.

giz.config is an object that accepts the following keys:

  • giz.config.expires: the number of seconds of inactivity before a token or session expires. By default this value is 3600.
  • giz.config.redis: if you want giz to use redis by default and to create its own connection, this should be an array of the arguments you want to pass to redis.createClient. By default this value is an empty array.

You can also pass an existing redis client to giz, simply by setting giz.redis = yourRedisClient.

If you want to avoid using redis altogether (or doing it in your own way), you need to override the six functions in giz.db - all of them are used from all parts of the code, except for giz.db.init which is used by the other functions in giz.db. These functions are quite straightforward, comprising about 25 lines in total. If you need help implementing your own version of these functions, please open an issue and I will be glad to help you.

Source code

The complete source code is contained in giz.js. It is about 170 lines long.

Annotated source code will be forthcoming when the library stabilizes.

License

giz is written by Federico Pereiro ([email protected]) and released into the public domain.