@aws-crypto/hkdf-node
Advanced tools
Comparing version 1.0.2 to 1.0.3
"use strict"; | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
* this file except in compliance with the License. A copy of the License is | ||
* located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -26,3 +14,6 @@ class HKDFError extends Error { | ||
constructor(maxLength, algorithm) { | ||
super('Can not derive keys larger than ' + maxLength + ' for algorithm:' + algorithm); | ||
super('Can not derive keys larger than ' + | ||
maxLength + | ||
' for algorithm:' + | ||
algorithm); | ||
this.name = 'KeyLengthError'; | ||
@@ -41,2 +32,2 @@ Object.setPrototypeOf(this, KeyLengthError.prototype); | ||
exports.UnsupportedAlgorithm = UnsupportedAlgorithm; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Vycm9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7R0FhRzs7QUFFSCxNQUFhLFNBQVUsU0FBUSxLQUFLO0lBQ2xDLFlBQWEsT0FBZ0I7UUFDM0IsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBQ2QsTUFBTSxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQ2xEL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0Y7QUFMRCw4QkFLQztBQUVELE1BQWEsY0FBZSxTQUFRLFNBQVM7SUFFM0MsWUFBWSxTQUFpQixFQUFFLFNBQWlCO1FBQzlDLEtBQUssQ0FDSCxrQ0FBa0M7WUFDaEMsU0FBUztZQUNULGlCQUFpQjtZQUNqQixTQUFTLENBQ1osQ0FBQTtRQVBJLFNBQUksR0FBRyxnQkFBZ0IsQ0FBQTtRQVE1QixNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxjQUFjLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDdkQsQ0FBQztDQUNGO0FBWEQsd0NBV0M7QUFFRCxNQUFhLG9CQUFxQixTQUFRLFNBQVM7SUFFakQsWUFBWSxTQUFpQjtRQUMzQixLQUFLLENBQUMsa0JBQWtCLEdBQUcsU0FBUyxHQUFHLGtDQUFrQyxDQUFDLENBQUE7UUFGckUsU0FBSSxHQUFHLHNCQUFzQixDQUFBO1FBR2xDLE1BQU0sQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLG9CQUFvQixDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzdELENBQUM7Q0FDRjtBQU5ELG9EQU1DIn0= |
"use strict"; | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
* this file except in compliance with the License. A copy of the License is | ||
* located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,8 +15,10 @@ const crypto_1 = require("crypto"); | ||
// Check the length and support | ||
try { | ||
var hashLength = crypto_1.createHash(algorithm).digest().length; | ||
} | ||
catch (ex) { | ||
throw new errors_1.UnsupportedAlgorithm(algorithm); | ||
} | ||
const hashLength = (function () { | ||
try { | ||
return crypto_1.createHash(algorithm).digest().length; | ||
} | ||
catch (ex) { | ||
throw new errors_1.UnsupportedAlgorithm(algorithm); | ||
} | ||
})(); | ||
// (<= 255*HashLen) from https://tools.ietf.org/html/rfc5869 | ||
@@ -60,3 +50,3 @@ const maxLength = 255 * hashLength; | ||
function extract(ikm, salt) { | ||
var _salt = salt || Buffer.alloc(hashLength, 0).toString(); | ||
const _salt = salt || Buffer.alloc(hashLength, 0).toString(); | ||
return crypto_1.createHmac(algorithm, _salt).update(ikm).digest(); | ||
@@ -77,10 +67,10 @@ } | ||
info = info || Buffer.alloc(0); | ||
var N = Math.ceil(length / hashLength); | ||
var memo = []; | ||
const N = Math.ceil(length / hashLength); | ||
const memo = []; | ||
/* L/length octets are returned from T(1)...T(N), and T(0) is definitionally empty/zero length. | ||
* Elide T(0) into the Buffer.alloc(0) case and then return L octets of T indexed 0...L-1. | ||
*/ | ||
for (var i = 0; i < N; i++) { | ||
for (let i = 0; i < N; i++) { | ||
memo[i] = crypto_1.createHmac(algorithm, prk) | ||
.update((memo[i - 1] || Buffer.alloc(0))) | ||
.update(memo[i - 1] || Buffer.alloc(0)) | ||
.update(info) | ||
@@ -94,2 +84,2 @@ .update(Buffer.alloc(1, i + 1)) | ||
exports.HKDF = HKDF; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGtkZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oa2RmLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7OztHQWFHOztBQUVILG1DQUErQztBQUMvQyxxQ0FBK0Q7QUFFL0Q7Ozs7O0dBS0c7QUFDSCxTQUFnQixJQUFJLENBQUUs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UFDLENBQUMsSUFBSSxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO2lCQUN0QyxNQUFNLENBQUMsSUFBSSxDQUFDO2lCQUNaLE1BQU0sQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsRUFBRSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7aUJBQzlCLE1BQU0sRUFBRSxDQUFBO1NBQ1o7UUFDRCxPQUFPLE1BQU0sQ0FBQyxNQUFNLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFBO0lBQ3BDLENBQUM7QUFDSCxDQUFDO0FBaEZELG9CQWdGQyJ9 |
"use strict"; | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
* this file except in compliance with the License. A copy of the License is | ||
* located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
function __export(m) { | ||
@@ -22,2 +10,2 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
__export(require("./errors")); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7O0dBYUc7Ozs7O0FBRUgsNEJBQXNCO0FBQ3RCLDhCQUF3QiJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLG9FQUFvRTtBQUNwRSxzQ0FBc0M7Ozs7O0FBRXRDLDRCQUFzQjtBQUN0Qiw4QkFBd0IifQ== |
@@ -1,15 +0,3 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
* this file except in compliance with the License. A copy of the License is | ||
* located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
export class HKDFError extends Error { | ||
@@ -23,3 +11,6 @@ constructor(message) { | ||
constructor(maxLength, algorithm) { | ||
super('Can not derive keys larger than ' + maxLength + ' for algorithm:' + algorithm); | ||
super('Can not derive keys larger than ' + | ||
maxLength + | ||
' for algorithm:' + | ||
algorithm); | ||
this.name = 'KeyLengthError'; | ||
@@ -36,2 +27,2 @@ Object.setPrototypeOf(this, KeyLengthError.prototype); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Vycm9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7OztHQWFHO0FBRUgsTUFBTSxPQUFPLFNBQVUsU0FBUSxLQUFLO0lBQ2xDLFlBQWEsT0FBZ0I7UU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BQTtRQUNkLE1BQU0sQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLFNBQVMsQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUNsRCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLE9BQU8sY0FBZSxTQUFRLFNBQVM7SUFFM0MsWUFBWSxTQUFpQixFQUFFLFNBQWlCO1FBQzlDLEtBQUssQ0FDSCxrQ0FBa0M7WUFDaEMsU0FBUztZQUNULGlCQUFpQjtZQUNqQixTQUFTLENBQ1osQ0FBQTtRQVBJLFNBQUksR0FBRyxnQkFBZ0IsQ0FBQTtRQVE1QixNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxjQUFjLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDdkQsQ0FBQztDQUNGO0FBRUQsTUFBTSxPQUFPLG9CQUFxQixTQUFRLFNBQVM7SUFFakQsWUFBWSxTQUFpQjtRQUMzQixLQUFLLENBQUMsa0JBQWtCLEdBQUcsU0FBUyxHQUFHLGtDQUFrQyxDQUFDLENBQUE7UUFGckUsU0FBSSxHQUFHLHNCQUFzQixDQUFBO1FBR2xDLE1BQU0sQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLG9CQUFvQixDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzdELENBQUM7Q0FDRiJ9 |
@@ -1,15 +0,3 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
* this file except in compliance with the License. A copy of the License is | ||
* located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { createHmac, createHash } from 'crypto'; | ||
@@ -25,8 +13,10 @@ import { UnsupportedAlgorithm, KeyLengthError } from './errors'; | ||
// Check the length and support | ||
try { | ||
var hashLength = createHash(algorithm).digest().length; | ||
} | ||
catch (ex) { | ||
throw new UnsupportedAlgorithm(algorithm); | ||
} | ||
const hashLength = (function () { | ||
try { | ||
return createHash(algorithm).digest().length; | ||
} | ||
catch (ex) { | ||
throw new UnsupportedAlgorithm(algorithm); | ||
} | ||
})(); | ||
// (<= 255*HashLen) from https://tools.ietf.org/html/rfc5869 | ||
@@ -58,3 +48,3 @@ const maxLength = 255 * hashLength; | ||
function extract(ikm, salt) { | ||
var _salt = salt || Buffer.alloc(hashLength, 0).toString(); | ||
const _salt = salt || Buffer.alloc(hashLength, 0).toString(); | ||
return createHmac(algorithm, _salt).update(ikm).digest(); | ||
@@ -75,10 +65,10 @@ } | ||
info = info || Buffer.alloc(0); | ||
var N = Math.ceil(length / hashLength); | ||
var memo = []; | ||
const N = Math.ceil(length / hashLength); | ||
const memo = []; | ||
/* L/length octets are returned from T(1)...T(N), and T(0) is definitionally empty/zero length. | ||
* Elide T(0) into the Buffer.alloc(0) case and then return L octets of T indexed 0...L-1. | ||
*/ | ||
for (var i = 0; i < N; i++) { | ||
for (let i = 0; i < N; i++) { | ||
memo[i] = createHmac(algorithm, prk) | ||
.update((memo[i - 1] || Buffer.alloc(0))) | ||
.update(memo[i - 1] || Buffer.alloc(0)) | ||
.update(info) | ||
@@ -91,2 +81,2 @@ .update(Buffer.alloc(1, i + 1)) | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGtkZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oa2RmLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7O0dBYUc7QUFFSCxPQUFPLEVBQUUsVUFBVSxFQUFFL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LElBQUksR0FBYSxFQUFFLENBQUE7UUFFekI7O1dBRUc7UUFDSCxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFO1lBQzFCLElBQUksQ0FBQyxDQUFDLENBQUMsR0FBRyxVQUFVLENBQUMsU0FBUyxFQUFFLEdBQUcsQ0FBQztpQkFDakMsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLElBQUksTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztpQkFDdEMsTUFBTSxDQUFDLElBQUksQ0FBQztpQkFDWixNQUFNLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO2lCQUM5QixNQUFNLEVBQUUsQ0FBQTtTQUNaO1FBQ0QsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxNQUFNLENBQUMsQ0FBQTtJQUNwQyxDQUFDO0FBQ0gsQ0FBQyJ9 |
@@ -1,17 +0,5 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
* this file except in compliance with the License. A copy of the License is | ||
* located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
export * from './hkdf'; | ||
export * from './errors'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7R0FhRztBQUVILGNBQWMsUUFBUSxDQUFBO0FBQ3RCLGNBQWMsVUFBVSxDQUFBIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0VBQW9FO0FBQ3BFLHNDQUFzQztBQUV0QyxjQUFjLFFBQVEsQ0FBQTtBQUN0QixjQUFjLFVBQVUsQ0FBQSJ9 |
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.0.3](https://github.com/aws/aws-encryption-sdk-javascript/compare/@aws-crypto/hkdf-node@1.0.2...@aws-crypto/hkdf-node@1.0.3) (2020-05-26) | ||
**Note:** Version bump only for package @aws-crypto/hkdf-node | ||
## [1.0.2](https://github.com/aws/aws-encryption-sdk-javascript/compare/@aws-crypto/hkdf-node@1.0.1...@aws-crypto/hkdf-node@1.0.2) (2020-04-02) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@aws-crypto/hkdf-node", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "nodejs hkdf crypto primitive", | ||
@@ -8,3 +8,5 @@ "scripts": { | ||
"build": "tsc -b tsconfig.json && tsc -b tsconfig.module.json", | ||
"lint": "standard src/*.ts test/**/*.ts", | ||
"lint": "run-s lint-*", | ||
"lint-eslint": "eslint src/*.ts test/**/*.ts", | ||
"lint-prettier": "prettier -c src/*.ts test/**/*.ts", | ||
"mocha": "mocha --require ts-node/register test/**/*test.ts", | ||
@@ -38,3 +40,3 @@ "test": "npm run lint && npm run coverage", | ||
}, | ||
"gitHead": "6fdb7e50f91cff05999eeaf79fbd6ad1720024a2" | ||
"gitHead": "4b60e0607e83d1ea2da98fd593e681f98f0d0082" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
244633
293