# haravan-validate

> express middleware to validate signature for haravan webhooks

Latest version **2.0.2** (published 2024-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install haravan-validate
pnpm add haravan-validate
yarn add haravan-validate
bun add haravan-validate
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2024-04-09 |
| First published | 2017-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Haravan team |
| Maintainers | lmcuong29 |
| Keywords | haravan, webhook |

## Links

- npm: https://www.npmjs.com/package/haravan-validate
- Repository: https://github.com/Haravan/haravan-validate
- Issues: https://github.com/Haravan/haravan-validate/issues
- npm.io page: https://npm.io/package/haravan-validate

## Recent versions

- 2.0.2 (latest) — 2024-04-09
- 2.0.1 — 2024-03-12
- 1.0.2 — 2017-08-24
- 1.0.1 — 2017-08-24
- 1.0.0 — 2017-08-22

## README

# haravan-validate

Simple express middleware to validate haravan webhooks

## Install

```bash
$ npm install --save haravan-validate
```

## Usage

```js
const express = require("express");
const HaravanValidate = require("haravan-validate");
const CLIENT_SECRET = process.env.CLIENT_SECRET;

const middlewareValidate = new HaravanValidate(CLIENT_SECRET);
const app = express();

// make sure the haravan validate middleware
// is added before express.json()
app.use(middlewareValidate);
app.use(express.json());

app.post("/webhook", function (req, res) {
	// validate the request is from haravan
	if (!req.fromHaravan()) {
		return res.status(401).send();
	}

	// send success notification to haravan
	// done before to prevent timeout
	res.status(200).send();

	const body = req.body;
	// process webhook
});
```

## Test

```bash
$ npm test
```

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