Home

Awesome

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:

Installation

The dependencies of giz are two:

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

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:

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 (fpereiro@gmail.com) and released into the public domain.