@poppinss/utils 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,12 +7,9 @@
|
|
|
7
7
|
* For the full copyright and license information, please view the LICENSE
|
|
8
8
|
* file that was distributed with this source code.
|
|
9
9
|
*/
|
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
11
|
exports.safeEqual = void 0;
|
|
15
|
-
const
|
|
12
|
+
const buffer_1 = require("buffer");
|
|
16
13
|
const crypto_1 = require("crypto");
|
|
17
14
|
/**
|
|
18
15
|
* Generates a random string for a given size
|
|
@@ -23,23 +20,23 @@ function safeEqual(value, comparisonValue) {
|
|
|
23
20
|
* The length of the main value to ensure that we compare equal strings
|
|
24
21
|
* against each other to get a constant time.
|
|
25
22
|
*/
|
|
26
|
-
const expectedLength = Buffer.byteLength(value);
|
|
23
|
+
const expectedLength = buffer_1.Buffer.byteLength(value);
|
|
27
24
|
/**
|
|
28
25
|
* Value A
|
|
29
26
|
*/
|
|
30
|
-
const valueBuffer =
|
|
27
|
+
const valueBuffer = buffer_1.Buffer.alloc(expectedLength, 0, 'utf-8');
|
|
31
28
|
valueBuffer.write(value);
|
|
32
29
|
/**
|
|
33
30
|
* Value B
|
|
34
31
|
*/
|
|
35
|
-
const comparisonValueBuffer =
|
|
32
|
+
const comparisonValueBuffer = buffer_1.Buffer.alloc(expectedLength, 0, 'utf-8');
|
|
36
33
|
comparisonValueBuffer.write(comparisonValue);
|
|
37
34
|
/**
|
|
38
35
|
* Ensure values are same and also have same length
|
|
39
36
|
*/
|
|
40
37
|
return ((0, crypto_1.timingSafeEqual)(valueBuffer, comparisonValueBuffer) &&
|
|
41
|
-
expectedLength === Buffer.byteLength(comparisonValue));
|
|
38
|
+
expectedLength === buffer_1.Buffer.byteLength(comparisonValue));
|
|
42
39
|
}
|
|
43
|
-
return (0, crypto_1.timingSafeEqual)(Buffer.from(value), Buffer.from(comparisonValue));
|
|
40
|
+
return (0, crypto_1.timingSafeEqual)(buffer_1.Buffer.from(value), buffer_1.Buffer.from(comparisonValue));
|
|
44
41
|
}
|
|
45
42
|
exports.safeEqual = safeEqual;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poppinss/utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Handy utilities for repetitive work",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@adonisjs/mrm-preset": "^5.0.2",
|
|
36
36
|
"@adonisjs/require-ts": "^2.0.8",
|
|
37
|
-
"@poppinss/dev-utils": "^
|
|
37
|
+
"@poppinss/dev-utils": "^2.0.1",
|
|
38
38
|
"@types/fs-readdir-recursive": "^1.0.0",
|
|
39
39
|
"@types/lodash": "^4.14.178",
|
|
40
40
|
"@types/ms": "^0.7.31",
|
|
41
|
-
"@types/node": "^17.0.
|
|
41
|
+
"@types/node": "^17.0.8",
|
|
42
42
|
"@types/pluralize": "0.0.29",
|
|
43
43
|
"@types/require-all": "^3.0.3",
|
|
44
44
|
"del-cli": "^4.0.1",
|
|
45
45
|
"doctoc": "^2.1.0",
|
|
46
|
-
"eslint": "^8.
|
|
46
|
+
"eslint": "^8.7.0",
|
|
47
47
|
"eslint-config-prettier": "^8.3.0",
|
|
48
48
|
"eslint-plugin-adonis": "^2.1.0",
|
|
49
49
|
"eslint-plugin-prettier": "^4.0.0",
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@types/bytes": "^3.1.1",
|
|
77
77
|
"@types/he": "^1.1.2",
|
|
78
|
-
"buffer-alloc": "^1.2.0",
|
|
79
78
|
"bytes": "^3.1.1",
|
|
80
79
|
"change-case": "^4.1.2",
|
|
81
80
|
"cuid": "^2.1.8",
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
"pluralize": "^8.0.0",
|
|
89
88
|
"require-all": "^3.0.0",
|
|
90
89
|
"resolve-from": "^5.0.0",
|
|
91
|
-
"slugify": "^1.6.
|
|
90
|
+
"slugify": "^1.6.5",
|
|
92
91
|
"truncatise": "0.0.8"
|
|
93
92
|
},
|
|
94
93
|
"directories": {
|