js-crypto-hkdf
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -74,22 +74,18 @@ "use strict"; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var webCrypto, msCrypto, key, masterObj, hkdfCtrParams, e_1; | ||
var env, key, masterObj, hkdfCtrParams, e_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
webCrypto = util.getWebCrypto(); | ||
msCrypto = util.getMsCrypto(); | ||
env = util.getCrypto(); | ||
if (!salt) | ||
salt = js_crypto_random_1.default.getRandomBytes(length); | ||
if (!(typeof webCrypto !== 'undefined' | ||
&& typeof webCrypto.importKey === 'function' | ||
&& typeof webCrypto.deriveBits === 'function' | ||
&& typeof msCrypto === 'undefined')) return [3 /*break*/, 7]; | ||
if (!(env.name === 'webCrypto' && typeof env.crypto.importKey === 'function' && typeof env.crypto.deriveBits === 'function')) return [3 /*break*/, 7]; | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 4, , 6]); | ||
return [4 /*yield*/, webCrypto.importKey('raw', master, { name: 'HKDF' }, false, ['deriveKey', 'deriveBits'])]; | ||
return [4 /*yield*/, env.crypto.importKey('raw', master, { name: 'HKDF' }, false, ['deriveKey', 'deriveBits'])]; | ||
case 2: | ||
masterObj = _a.sent(); | ||
hkdfCtrParams = { name: 'HKDF', salt: salt, info: js_encoding_utils_1.default.encoder.stringToArrayBuffer(info), hash: hash }; | ||
return [4 /*yield*/, webCrypto.deriveBits(hkdfCtrParams, masterObj, length * 8)]; | ||
return [4 /*yield*/, env.crypto.deriveBits(hkdfCtrParams, masterObj, length * 8)]; | ||
case 3: | ||
@@ -96,0 +92,0 @@ key = _a.sent(); |
{ | ||
"name": "js-crypto-hkdf", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Universal Module for HKDF (Hash-based Key Derivation Function) in JavaScript", | ||
@@ -41,7 +41,7 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"js-crypto-env": "^0.3.0", | ||
"js-crypto-hmac": "^0.6.1", | ||
"js-crypto-random": "^0.4.1", | ||
"js-crypto-env": "^0.3.1", | ||
"js-crypto-hmac": "^0.6.2", | ||
"js-crypto-random": "^0.4.2", | ||
"js-encoding-utils": "0.5.6" | ||
} | ||
} |
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
101311
641
Updatedjs-crypto-env@^0.3.1
Updatedjs-crypto-hmac@^0.6.2
Updatedjs-crypto-random@^0.4.2