js-crypto-hmac
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -110,3 +110,5 @@ "use strict"; | ||
e_1 = _a.sent(); | ||
errMsg = e_1.message; | ||
if (e_1 instanceof Error) { | ||
errMsg = e_1.message; | ||
} | ||
native = false; | ||
@@ -125,4 +127,10 @@ return [3 /*break*/, 7]; | ||
e_2 = _a.sent(); | ||
errMsg = errMsg + " => " + e_2.message; | ||
throw new Error("UnsupportedEnvironments: " + errMsg); | ||
if (e_2 instanceof Error) { | ||
errMsg = errMsg + " => " + e_2.message; | ||
throw new Error("UnsupportedEnvironments: " + errMsg); | ||
} | ||
else { | ||
throw new Error('UnsupportedEnvironments'); | ||
} | ||
return [3 /*break*/, 11]; | ||
case 11: return [2 /*return*/, new Uint8Array(msgKeyedHash)]; | ||
@@ -186,3 +194,3 @@ } | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, exports.compute(key, data, hash)]; | ||
case 0: return [4 /*yield*/, (0, exports.compute)(key, data, hash)]; | ||
case 1: | ||
@@ -189,0 +197,0 @@ newMac = _a.sent(); |
{ | ||
"name": "js-crypto-hmac", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Universal Module for HMAC (Hash-based Message Authentication Code) in JavaScript", | ||
@@ -35,5 +35,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"js-crypto-env": "^1.0.2", | ||
"js-crypto-hash": "^1.0.2" | ||
"js-crypto-env": "^1.0.3", | ||
"js-crypto-hash": "^1.0.3" | ||
} | ||
} |
Universal Module for HMAC (Hash-based Message Authentication Code) in JavaScript | ||
-- | ||
[![npm version](https://badge.fury.io/js/js-crypto-hmac.svg)](https://badge.fury.io/js/js-crypto-hmac) | ||
[![Dependencies](https://david-dm.org/junkurihara/jscu.svg?path=packages/js-crypto-hmac)](https://david-dm.org/junkurihara/jscu?path=packages/js-crypto-hmac) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
@@ -11,3 +10,3 @@ | ||
This library is designed to 'universally' provide HMAC (Hash-based Message Authentication Code) functions, i.e., it works both on most modern browsers and on Node.js just by importing from NPM/source code. Note that in the design principle, the library fully utilizes native APIs like WebCrypto API to accelerate its operation if available. | ||
This library is designed to 'universally' provide HMAC (Hash-based Message Authentication Code) functions, i.e., it works both on most modern browsers and on Node.js just by importing from NPM/source code. Note that in the design principle, the library fully utilizes native APIs like WebCrypto API to accelerate its operation if available. | ||
@@ -39,3 +38,3 @@ # Installation | ||
# Usage | ||
@@ -47,3 +46,3 @@ | ||
const msg = ...; // Uint8Array of arbitrary length | ||
const key = ...; // Uint8Array of 32 bytes (since SHA-256 is used) | ||
const key = ...; // Uint8Array of 32 bytes (since SHA-256 is used) | ||
const hash = 'SHA-256'; | ||
@@ -60,3 +59,3 @@ hmac.compute(key, msg, hash).then( (hmac) => { | ||
const key = ...; // Uint8Array of 32 bytes (since SHA-256 is used) | ||
const mac = ...; // computed keyed hash in Uint8Array | ||
const mac = ...; // computed keyed hash in Uint8Array | ||
const hash = 'SHA-256'; | ||
@@ -70,2 +69,2 @@ hmac.verify(key, msg, mac, hash).then( (result) => { | ||
Licensed under the MIT license, see `LICENSE` file. | ||
Licensed under the MIT license, see `LICENSE` file. |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83293
300
Updatedjs-crypto-env@^1.0.3
Updatedjs-crypto-hash@^1.0.3