1.0.2 • Published 9 years ago

url-hash v1.0.2

Weekly downloads
188
License
MIT
Repository
github
Last release
9 years ago

url-hash

Node library to add hash parameter for tamper-free urls

Basic Usage

Add hash to url

// require library
var urlHash = require('url-hash');

var url = 'http://www.example.com/page?id=4';

// add hash to url
var newUrl = urlHash.create(url);

Verify Url

// require library
var urlHash = require('url-hash');

// check integrity of url
var result = urlHash.check(url/to/verify);

/*

  result will either:
  1. equal true if the url is unchanged
  2. equal false if the url has been changed

*/

Configuration options

This library currently offers the following configuration options:

  • salt
  • expire
  • hash key name
urlHash.config({
                salt:    'someUniqueCustomSalt', // use custom salt (recommended)
                expire:  60000,                  // url expires after 1 minute
                hashKey: 'myCustomHashKeyName'   // use custom name for hash parameter
              });
1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago