# @adaptive-recognition/vehicle-detector-agent-webhook-middleware

> Express middleware for parsing Vehicle Detector Agent webhook requests and verifying their signature.

Latest version **1.0.2** (published 2023-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @adaptive-recognition/vehicle-detector-agent-webhook-middleware
pnpm add @adaptive-recognition/vehicle-detector-agent-webhook-middleware
yarn add @adaptive-recognition/vehicle-detector-agent-webhook-middleware
bun add @adaptive-recognition/vehicle-detector-agent-webhook-middleware
```

## 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 | 2023-02-27 |
| First published | 2023-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Botond BALÁZS |
| Maintainers | laszlo.toth, botond.balazs.ar, tothl74 |
| Keywords | anpr, adaptive, recognition, vehicle, detector, agent, webhook, hook, middleware, express |

## Links

- npm: https://www.npmjs.com/package/@adaptive-recognition/vehicle-detector-agent-webhook-middleware
- npm.io page: https://npm.io/package/@adaptive-recognition/vehicle-detector-agent-webhook-middleware

## Dependencies (4)

- [jwa](https://npm.io/package/jwa.md) ^2.0.0
- [jest](https://npm.io/package/jest.md) ^29.3.1
- [debug](https://npm.io/package/debug.md) ^4.3.4
- [ts-jest](https://npm.io/package/ts-jest.md) ^29.0.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-02-27
- 1.0.1 — 2023-02-27

## README

# Vehicle Detector Agent Webhook Middleware

Express middleware for parsing Vehicle Detector Agent webhook requests and verifying their signature.

## How to Install

```sh
npm install --save @arcloud/vehicle-detector-agent-webhook-middleware
```

## Usage

### TypeScript

```typescript
import express, { Express, Request, Response } from 'express';
import { WebhookEvent, webhookSignatureValidator } from "@arcloud/vehicle-detector-agent-webhook-middleware";

const app: Express = express();
const port = 8080;

const signatureValidator = webhookSignatureValidator({
  algorithm: "RS256",
  publicKeyPath: "/path/to/RS256.public.pem"
});

app.get('/', (req: Request, res: Response) => {
  res.send('OK');
});

// This endpoint uses the middleware - requests with an invalid signature 
// will be rejected.
app.post('/webhook', signatureValidator, (req: Request, res: Response) => {
  const event: WebhookEvent = req.body; // req.body contains the parsed event
  console.log("Detected At: ", event.detectedAt);
  console.log("Unicode Text:", event.event.plate.unicodeText);
  res.send('OK');
});

app.listen(port, () => {
  console.log(`⚡️[server]: Server is running at https://localhost:${port}`);
});
```

### JavaScript

```javascript
const express = require("express");
const { webhookSignatureValidator } = require("@arcloud/vehicle-detector-agent-webhook-middleware");

const app = express();
const port = 8080;

const signatureValidator = webhookSignatureValidator({
  algorithm: "RS256",
  publicKeyPath: "/path/to/RS256.public.pem"
});

// This endpoint uses the middleware - requests with an invalid signature 
// will be rejected.
app.post('/webhook', signatureValidator, (req, res) => {
  const event = req.body; // req.body contains the parsed event
  console.log("Detected At: ", event.detectedAt);
  console.log("Unicode Text:", event.event.plate.unicodeText);
  res.send('OK');
});

app.listen(port, () => {
  console.log(`⚡️[server]: Server is running at https://localhost:${port}`);
});
```

---
_Source: https://npm.io/package/@adaptive-recognition/vehicle-detector-agent-webhook-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
