signature_calculator
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Introduction

This library is aimed to provide a consistent way to handle HMAC authentication between platforms.

Scripts

Run npm run build to build this lib.

Basic Usage

/**
 * Your secret
 */
const secret = "xxxxxxxxxxxxxxx";

/**
 * For https://example.com/test
 */
const endpointUrl = "/test";
/**
 *  Your payload that is about to be sent over the network. 
 */
const  payload = {
    field_1: "string",
    field_2: "string",
    field_3: 100
};

const signatureInstance = new Signature(secret);

const hash = signatureInstance.getSignature({
    ...payload,
    url: endpointUrl
});

// you can now use hash.

Note: that you must provide url as part of signature creation.

Good Luck!

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.50latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i signature_calculator

Weekly Downloads

0

Version

1.0.5

License

ISC

Unpacked Size

3.84 kB

Total Files

8

Last publish

Collaborators

  • mojtaba_redacre