# authful

> A lightweight authentication library for Node

Latest version **1.0.2** (published 2019-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install authful
pnpm add authful
yarn add authful
bun add authful
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-04-15 |
| First published | 2019-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 22.4 KB |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| Author | o8e |
| Maintainers | o8e |

## Links

- npm: https://www.npmjs.com/package/authful
- Repository: https://github.com/o8e/authful
- Homepage: https://github.com/o8e/authful#readme
- Issues: https://github.com/o8e/authful/issues
- npm.io page: https://npm.io/package/authful

## Dependencies (4)

- [dayjs](https://npm.io/package/dayjs.md) ^1.8.12
- [bcrypt](https://npm.io/package/bcrypt.md) ^3.0.6
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1

## Recent versions

- 1.0.2 (latest) — 2019-04-15
- 1.0.1 — 2019-04-14
- 1.0.0 — 2019-04-14

## README

![](https://i.imgur.com/BtdQigB.png)

# Authful

![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)
[![npm version](https://badge.fury.io/js/authful.svg)](https://badge.fury.io/js/authful)
![dependencies](https://david-dm.org/o8e/authful.svg)

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](https://npmjs.com/package/jsonwebtoken) and [bcrypt](https://npmjs.com/package/bcrypt) and provides common methods.

:sparkles: **1.3kB** minified + gzip

## Installation

```
npm install authful -s
```

```js
import * as Authful from 'authful'

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

## Usage

![docs in progress](https://img.shields.io/badge/docs-in%20progress-orange.svg)

:hash: Hash a password

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

:check: Check a password

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

:lock: Create a token

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

:closed_lock_with_key: Decode a token

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

:arrows_counterclockwise: Refresh a token

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

---
_Source: https://npm.io/package/authful · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
