package
A middleware to handle verification of HTTP digest headers as described in [RFC-3230](https://tools.ietf.org/html/rfc3230) "Instance Digests in HTTP".
npm install koa-instance-digestGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Registry package owners.
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:
However, it does NOT provide:
Install the package via yarn:
❯ yarn add koa-instance-digestor via npm:
❯ npm install koa-instance-digest --saveThe following algorithms are available: md5, sha, sha-256, sha-512.
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
});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);The Digest header can be provided as follows:
'Digest: <algorithm>=<value>'If the header is missing the following header will be added to the response:
'Want-Digest: <list-of-accepted-algorithms>'❯ yarn test❯ npm version [<new version> | major | minor | patch] -m "Release %s"Estimated unpacked size across 3 packages.
244.6 kB
Includes dependencies.