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

lauer

v0.1.2

Published

Local Authentication Ergo

Downloads

21

Readme

Local Authentication Ergo

Tiny user management with SQLite. Lauer performs all the usual operations: creating users, login, verification, password reset and storing data. It's lightweigt and portable.

Install

npm install lauer

Example


var lauer = require("lauer");

var users = new lauer({db: "/tmp/lauer.sqlite"});

users.create({
	username: "user1",
	email: "[email protected]",
	password: "gu3ssme!1",
	verfified: 1,
}, function(err, result){

	console.log(err, result);

	users.login("user1", "gu3ssme!1", function(err, result){
		
		console.log(err, result);

	});
	
});

API

lauer(opts, function(err, new){})

Create a new instance of Lauer. opts:

{
	iterations: 4096,   // number of iterations used by `pbkdf2`
	db: "lauer.sqlite"  // path to sqlite database
}

new is true, if an empty database was created.

lauer.salt()

Create and return a random salt.

lauer.password(username, password, salt)

Create and return a salted password hash.

lauer.slug(str)

Slugify a string.

lauer.create(user, function(err, result){})

Create a user. user:

{
	username: "user1",          // user name
	email: "[email protected]",  // email address
	password: "gu3ssme!1",      // password
	verfified: 0,               // 0 = user pending verfication, 1 = instantly active (see lauer.verify)
	level: 0,                   // level (may be used by you to dertemine wo is an admin)
	data: {}                    // user-defined data object
}

result:

{
	id: 1,                      // user id
	username: "user1",          // user name
	verification: "<hexstr>"    // verification string (see lauer.verify)
}

lauer.get(id||username, function(err, result){})

Get a user object. The first parameter may be an id or username.

result:

{
	id: 1,                      // user id
	username: "user1",          // user name
	email: "[email protected]",  // email
	verified: 0,                // verification status (0 = false, 1 = true)
	level: 0,                   // level (may be used by you to dertemine wo is an admin)
	created: 1234567890,        // time user was created
	updated: 1234567890,        // time user was last changed
	lastlogin: 1234567890,      // time of last login
	data: {}                    // user-defined data object
}

lauer.login(username||email, password, function(err, result){})

Get a user object. The first parameter may be username or email.

result:

{
	id: 1,                      // user id
	username: "user1",          // user name
	level: 0,                   // level (may be used by you to dertemine wo is an admin)
	lastlogin: 1234567890       // time of last login
}

lauer.delete(id, function(err){})

Delete user with id.

lauer.verify(verification, function(err, result){})

Verify user with verification. If verfification is successful, verified will be set to 1 and the user may log in.

result:

{
	id: 1,                      // user id
	username: "user1",          // user name
	level: 0,                   // level (may be used by you to dertemine wo is an admin)
	lastlogin: 1234567890       // time of last login
}

lauer.reset(id||username, function(err, result){})

Reset verification and create new verification string.

result:

{
	id: 1,                      // user id
	username: "user1",          // user name
	email: "[email protected]",  // email
	verification: "<hexstr>"    // verification string (see lauer.verify)
}

lauer.verification(id||username, function(err, result){})

Create new verification string without resetting verification. Useful for changing forgotten passwords.

result:

{
	id: 1,                      // user id
	username: "user1",          // user name
	email: "[email protected]",  // email
	verification: "<hexstr>"    // verification string (see lauer.verify)
}

lauer.check(username, function(err){})

Check if a username is available.

lauer.change(username||email, verification||current_password, new_password, function(err, result){})

Change password for a user identified by username or email. The second parameter may either be the users current password or a verification tring created by lauer.verification.

result:

{
	id: 1,                      // user id
	username: "user1"           // user name
}

lauer.data(id||username, data, function(err){})

Change user data.

result:

{
	id: 1,                      // user id
	username: "user1"           // user name
}

License

Public Domain.