Socket
Book a DemoInstallSign in
Socket

httpbis-digest-headers

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

httpbis-digest-headers

Create and verify content digests as found in HTTP headers according to draft-ietf-httpbis-digest-headers

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1.3K
67.42%
Maintainers
1
Weekly downloads
 
Created
Source

HTTP Digest Headers

Node.js CI

Based on the draft specification for HTTP Digest Headers, this library facilitates the creation and verification of a Content-Digest header.

This is useful when verifying the content of a message body as part of signature verification.

Specifications

The library currently only supports sha-256 and sha-512 algorithms

Examples

Creating a digest header

import { createContentDigestHeader } from 'httpbis-digest-headers';
request.setHeader('Content-Digest', createContentDigestHeader(messageBody, ['sha-256']))

Verify a digest header

import { verifyContentDigest } from 'httpbis-digest-headers';
const server = http.createServer(async (req, res) => {
  const buffers = [];

  for await (const chunk of req) {
    buffers.push(chunk);
  }
  const verified = verifyContentDigest(Buffer.concat(buffers), req.getHeader('Content-Digest'))
});```

Keywords

http

FAQs

Package last updated on 27 Sep 2022

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