@digitalbazaar/http-signature-header
v5.0.1
Published
[![NPM Version](https://img.shields.io/npm/v/http-signature-header.svg)](https://npm.im/http-signature-header) [![Build status](https://img.shields.io/github/workflow/status/digitalbazaar/http-signature-header/Node.js%20CI)](https://github.com/digitalbaza
Downloads
6,820
Keywords
Readme
HTTP Signature Header (http-signature-header)
A JavaScript library for creating and verifying HTTP Signature headers
Table of Contents
Background
Install
To install locally (for development):
git clone https://github.com/digitalbazaar/http-signature-header.git
cd http-signature-header
npm install
Usage
import {
createAuthzHeader, createSignatureString
} from '@digitalbazaar/http-signature-header';
const requestOptions = {
url,
method: 'POST',
headers
}
const includeHeaders = ['expires', 'host', '(request-target)'];
const plaintext = createSignatureString({includeHeaders, requestOptions});
const data = new TextEncoder().encode(plaintext);
const signature = base64url.encode(await signer.sign({data}));
const Authorization = createAuthzHeader({
includeHeaders,
keyId: signer.id,
signature
});
Contribute
Please follow the existing code style.
PRs accepted.
If editing the Readme, please conform to the standard-readme specification.
Commercial Support
Commercial support for this library is available upon request from Digital Bazaar: [email protected]
License
BSD-3-Clause © Digital Bazaar