uri-hmac-sign

1.0.0 • Public • Published

URI HMAC Signer

A module for signing and validating URIs using HMAC.

Installation

npm i uri-hmac-sign

Usage

const createSigner = require('uri-hmac-sign');
const signer = createSigner({
    key: 'Your signing key goes here',
    algorithm: 'The algorithm to use with the HMAC',
    // Whether to order the querystring parameters (A function will be used as the sort argument),
    order: true,
    // The name of the querystring value that should be used to store the hash in the URI
    querystringName: 'hash' // Defaults to hash
});

let signed = signer.sign('http://your.abso/ute.uri/here');
signer.validate(signed);

signed = signer.sign('/relative/uris/work/well/too');
signer.validate(signed);

Package Sidebar

Install

npm i uri-hmac-sign

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

10.7 kB

Total Files

5

Last publish

Collaborators

  • major-mann