Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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', await 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 = await verifyContentDigest(Buffer.concat(buffers), req.getHeader('Content-Digest'))
});

About

TS Library to create and verify a Content-Digest header.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages