Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-instance-digest

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-instance-digest

A middleware to handle verification of HTTP digest headers as described in [RFC-3230](https://tools.ietf.org/html/rfc3230) "Instance Digests in HTTP".

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

koa-instance-digest

A middleware to handle verification of HTTP digest headers as described in RFC-3230 "Instance Digests in HTTP".

Note that, as per the RFC, this module provides:

  • Digest coverage for entire instances communicated via HTTP.
  • Support for multiple digest algorithms.
  • Negotiation of the use of digests.

However, it does NOT provide:

  • header integrity
  • authentication
  • privacy
  • authorization

Status

npm version build status

Installation

Install the package via yarn:

❯ yarn add koa-instance-digest

or via npm:

❯ npm install koa-instance-digest --save

Available algorithms

The following algorithms are available: md5, sha, sha-256, sha-512.

Configuration

The middleware can be configured with the following parameters:

  • algorithms: List of supported algorithms (all by default).
  • required: Whether to set a digest header as mandatory (false by default).

You can change the defaults by doing:

middleware({
  algorithms: ['sha-256'],
  required: true
});

Usage

const { middleware } = require('koa-instance-digest');
const Koa = require('koa');

const app = new Koa();

app.post('/', middleware(), async ctx => {
  // Your code here ...
});

app.listen(3000);

Request

The Digest header can be provided as follows:

'Digest: <algorithm>=<value>'

Response

If the header is missing the following header will be added to the response:

'Want-Digest: <list-of-accepted-algorithms>'

Tests

❯ yarn test

Release

❯ npm version [<new version> | major | minor | patch] -m "Release %s"

FAQs

Package last updated on 26 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc