1.0.2 • Published 6 years ago
authful v1.0.2
Authful
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.
:sparkles: 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
:hash: Hash a password
const hash = await authful.pwd.hash({ plaintext })
:check: Check a password
const match = await authful.pwd.check({ hash, plaintext })
:lock: Create a token
const token = await authful.token.create(payload)
:closed_lock_with_key: Decode a token
const payload = await authful.token.decode(token)
:arrows_counterclockwise: Refresh a token
const token2 = await authful.token.refresh(token)