uzer

uzer provides convenience functions for creating and authenticating users.

rapidly add user authentication to your app

uses sqlite or postgres

or only stores user email and password

and passwords hashed using bcrypt

Installation

yarn install --dev uzer

npm i -D uzer

Usage

Initialize the database providing the options:

Sqlite

import { SqliteUzer } from ' uzer '

Postgres

import { PostgresUzer } from ' uzer '

tableName : the name you want for your users table. Defaults to "users" Note: This is useful if you want multiple types of users. For instance, you could have customers and employees. You could have a different user of each type with the same email address.

: the name you want for your users table. Defaults to Note: This is useful if you want multiple types of users. For instance, you could have customers and employees. You could have a different user of each type with the same email address. validatePassword : function to use while creating/updating users' passwords Defaults to the passwordValidator function from validatorz

: function to use while creating/updating users' passwords Defaults to the function from db : postgres : info on the database for connection sqlite : file to store the sqlite database. defaults to ":memory:"

:

Uzer returns an object with several functions for manipulating/reading the user authentication data. These are documented in the API section.

API

All functions return a promise. Promise is rejected if there is an error.