https://github.com/digitalbazaar/http-signature-header
https://github.com/digitalbazaar/http-signature-header
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/digitalbazaar/http-signature-header
- Owner: digitalbazaar
- License: bsd-3-clause
- Created: 2018-05-10T17:46:12.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-08-08T19:08:40.000Z (almost 2 years ago)
- Last Synced: 2025-05-04T00:03:45.906Z (about 1 year ago)
- Language: JavaScript
- Size: 264 KB
- Stars: 8
- Watchers: 11
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# HTTP Signature Header _(http-signature-header)_
[](https://npm.im/http-signature-header)
[](https://github.com/digitalbazaar/http-signature-header/actions/workflows/main.yaml)
[](https://codecov.io/gh/digitalbazaar/http-signature-header)
> A JavaScript library for creating and verifying HTTP Signature headers
## Table of Contents
- [Background](#background)
- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [Commercial Support](#commercial-support)
- [License](#license)
## Background
**[HTTP Signatures IETF draft](https://tools.ietf.org/html/draft-cavage-http-signatures)**
## Install
To install locally (for development):
```
git clone https://github.com/digitalbazaar/http-signature-header.git
cd http-signature-header
npm install
```
## Usage
```js
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](https://github.com/RichardLitt/standard-readme) specification.
## Commercial Support
Commercial support for this library is available upon request from
Digital Bazaar: support@digitalbazaar.com
## License
[BSD-3-Clause](LICENSE.md) © Digital Bazaar