0.0.1 • Published 4 years ago

hmac-isomorphic v0.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

hmac-isomorphic

Usage

Make sure that whatever build system you are using (Webpack etc) is honoring the browser field in package.json. Then import the library.

The module provides a single function that returns a promise, both in node and in the browser. There are three arguments: 1. algo, string: the signing algorithim to use. Can be sha256, sha512, etc. Be sure to use the naming mechanism from nodejs, e.g. sha256 not SHA-256. 2. key, string: the encryption key to use. This should be secret. 3. message, string: the message to generate the signature from.

const createHmacDigest = require('hmac-isomorphic');
createHmacDigest('sha256', 'abc123', 'def456').then(console.log);

Implementation