Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gmoqa/paranoik
HTTP Request integrity verifier middleware for Node.js
https://github.com/gmoqa/paranoik
checksum express javascript middleware nodejs security
Last synced: 4 days ago
JSON representation
HTTP Request integrity verifier middleware for Node.js
- Host: GitHub
- URL: https://github.com/gmoqa/paranoik
- Owner: gmoqa
- License: mit
- Created: 2019-05-03T17:33:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-06T18:25:29.000Z (over 5 years ago)
- Last Synced: 2024-11-07T14:53:54.044Z (11 days ago)
- Topics: checksum, express, javascript, middleware, nodejs, security
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# paranoik
[![NPM Version][npm-version-image]][npm-url] ![size] ![license]Check integrity of each request using a custom HTTP header checksum (X-Checksum).
The hash is formed by [`request url`, `request method`, `request data`, `request user-agent`, `secret key`] in a MD5 hash function.
## Installation
```bash
npm install paranoik
```## Backend Usage
```js
const express = require('express');
const paranoik = require('paranoik');const app = express();
app.use(paranoik('YOUR_SECRET'));
```## Express Configuration
```js
const options = {
secret: YOUR_SECRET,
whitelist: [
'/login',
'/recovery'
]
};app.use(paranoik(options));
```
## Frontend usage
```js
import paranoik from 'paranoik';axios.interceptors.request.use( async (config) => {
config.headers.XChecksum = await paranoik.checksum('YOUR_SECRET');
return config;
}, function (error) {
return Promise.reject(error);
});
```## License
[MIT](LICENSE)
[npm-url]: https://npmjs.org/package/paranoik
[license]: https://badgen.net/npm/license/paranoik
[dependencies]: https://badgen.net/npm/dependencies/paranoik
[size]: https://badgen.net/packagephobia/install/paranoik
[npm-version-image]: https://badgen.net/npm/v/paranoik