npm.io
1.0.2 • Published 7 years ago

authful

Licence
MIT
Version
1.0.2
Deps
4
Size
22 kB
Vulns
4
Weekly
0

Authful

MIT License npm version dependencies

A lightweight authentication library for Node

Summary

I find myself continously going through the process of implementing authentication for my projects and they only require a basic system to get started. This is a slightly higher level library that wraps jsonwebtoken and bcrypt and provides common methods.

1.3kB minified + gzip

Installation

npm install authful -s
import * as Authful from 'authful'

const authful = new Authful({
  secret: 'ffj3493$R#J@$f#$Jo3ofk',
  expiresIn: '1h' // default: 24hr
})

Usage

docs in progress

Hash a password

const hash = await authful.pwd.hash({ plaintext })

Check a password

const match = await authful.pwd.check({ hash, plaintext })

Create a token

const token = await authful.token.create(payload)

Decode a token

const payload = await authful.token.decode(token)

Refresh a token

const token2 = await authful.token.refresh(token)