@sequencemedia/pbkdf2 1.1.0 → 1.1.2
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.
- package/config/compare.mjs +1 -1
- package/eslint.config.mjs +48 -17
- package/package.json +10 -6
- package/scripts/compare.mjs +1 -1
- package/scripts/hash.mjs +1 -1
- package/scripts/salt.mjs +1 -1
- package/{utils → src}/compare.d.mts +7 -7
- package/{utils → src}/compare.mjs +1 -3
- package/src/hash.d.mts +12 -0
- package/{utils → src}/hash.mjs +1 -1
- package/src/index.d.mts +22 -0
- package/src/index.mjs +3 -0
- package/test/{utils → src}/common.spec.mjs +2 -2
- package/test/{utils → src}/compare.spec.mjs +2 -2
- package/index.d.mts +0 -22
- package/index.mjs +0 -9
- package/utils/hash.d.mts +0 -11
- /package/{utils → config}/args-map.mjs +0 -0
- /package/{utils/common.d.mts → src/common/index.d.mts} +0 -0
- /package/{utils/common.mjs → src/common/index.mjs} +0 -0
- /package/{utils → src}/salt.d.mts +0 -0
- /package/{utils → src}/salt.mjs +0 -0
package/config/compare.mjs
CHANGED
package/eslint.config.mjs
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import merge from '@sequencemedia/eslint-config-standard/merge'
|
|
2
1
|
import globals from 'globals'
|
|
2
|
+
import jsdoc from 'eslint-plugin-jsdoc'
|
|
3
|
+
import standard from '@sequencemedia/eslint-config-standard/merge'
|
|
4
|
+
import typescript from '@sequencemedia/eslint-config-typescript/merge'
|
|
3
5
|
|
|
4
|
-
export default
|
|
5
|
-
|
|
6
|
+
export default [
|
|
7
|
+
jsdoc.configs['flat/recommended'],
|
|
8
|
+
{
|
|
9
|
+
languageOptions: {
|
|
10
|
+
globals: {
|
|
11
|
+
ArrayBufferLike: 'readonly'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
...standard({
|
|
16
|
+
files: [
|
|
17
|
+
'**/*.{mjs,cjs,mts,cts}'
|
|
18
|
+
],
|
|
19
|
+
ignores: [
|
|
20
|
+
'test'
|
|
21
|
+
],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
globals: {
|
|
24
|
+
...globals.node
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
...typescript({
|
|
6
29
|
files: [
|
|
7
|
-
'**/*.{
|
|
30
|
+
'**/*.{mts,cts}'
|
|
8
31
|
],
|
|
9
32
|
ignores: [
|
|
10
33
|
'test'
|
|
@@ -14,17 +37,25 @@ export default (
|
|
|
14
37
|
...globals.node
|
|
15
38
|
}
|
|
16
39
|
}
|
|
40
|
+
}),
|
|
41
|
+
...standard({
|
|
42
|
+
files: [
|
|
43
|
+
'test/**/*.{mjs,cjs,mts,cts}'
|
|
44
|
+
],
|
|
45
|
+
languageOptions: {
|
|
46
|
+
globals: {
|
|
47
|
+
...globals.mocha
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
...typescript({
|
|
52
|
+
files: [
|
|
53
|
+
'test/**/*.{mts,cts}'
|
|
54
|
+
],
|
|
55
|
+
languageOptions: {
|
|
56
|
+
globals: {
|
|
57
|
+
...globals.mocha
|
|
58
|
+
}
|
|
59
|
+
}
|
|
17
60
|
})
|
|
18
|
-
|
|
19
|
-
merge({
|
|
20
|
-
files: [
|
|
21
|
-
'test/**/*.{cjs,mjs}'
|
|
22
|
-
],
|
|
23
|
-
languageOptions: {
|
|
24
|
-
globals: {
|
|
25
|
-
...globals.mocha
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
)
|
|
30
|
-
)
|
|
61
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/pbkdf2",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"pbkdf2",
|
|
6
6
|
"crypto",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"ecmascript",
|
|
11
11
|
"typescript"
|
|
12
12
|
],
|
|
13
|
-
"main": "./index.mjs",
|
|
13
|
+
"main": "./src/index.mjs",
|
|
14
14
|
"type": "module",
|
|
15
|
-
"types": "./index.d.mts",
|
|
15
|
+
"types": "./src/index.d.mts",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "Jonathan Perry for Sequence Media Limited",
|
|
18
18
|
"email": "sequencemedia@sequencemedia.net",
|
|
@@ -37,20 +37,24 @@
|
|
|
37
37
|
"yargs-parser": "^21.1.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@sequencemedia/eslint-config-standard": "^0.2.
|
|
40
|
+
"@sequencemedia/eslint-config-standard": "^0.2.36",
|
|
41
|
+
"@sequencemedia/eslint-config-typescript": "^0.1.51",
|
|
41
42
|
"@types/chai": "^5.0.1",
|
|
42
43
|
"@types/mocha": "^10.0.10",
|
|
43
|
-
"@types/node": "^22.13.
|
|
44
|
+
"@types/node": "^22.13.8",
|
|
44
45
|
"@types/yargs-parser": "^21.0.3",
|
|
45
46
|
"chai": "^5.2.0",
|
|
46
47
|
"cross-env": "^7.0.3",
|
|
47
48
|
"eslint": "^9.21.0",
|
|
49
|
+
"eslint-plugin-jsdoc": "^50.6.3",
|
|
48
50
|
"globals": "^16.0.0",
|
|
49
51
|
"husky": "^9.1.7",
|
|
50
52
|
"mocha": "^11.1.0"
|
|
51
53
|
},
|
|
52
54
|
"imports": {
|
|
53
55
|
"#config/*": "./config/*.mjs",
|
|
54
|
-
"#
|
|
56
|
+
"#pbkdf2/*": "./src/*.mjs",
|
|
57
|
+
"#pbkdf2": "./src/index.mjs",
|
|
58
|
+
"#pbkdf2/common": "./src/common/index.mjs"
|
|
55
59
|
}
|
|
56
60
|
}
|
package/scripts/compare.mjs
CHANGED
package/scripts/hash.mjs
CHANGED
package/scripts/salt.mjs
CHANGED
|
@@ -2,12 +2,12 @@ import type {
|
|
|
2
2
|
BinaryLike
|
|
3
3
|
} from 'node:crypto'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
interface CompareParams {
|
|
6
|
+
salt: BinaryLike
|
|
7
|
+
hash: Buffer
|
|
8
|
+
iterations?: number
|
|
9
|
+
keylen?: number
|
|
10
|
+
digest?: string
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export default function compare (password: BinaryLike, params: CompareParams): Promise<boolean>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('node:crypto').BinaryLike} BinaryLike
|
|
3
|
-
*
|
|
4
3
|
* @typedef {{
|
|
5
4
|
* salt: BinaryLike,
|
|
6
5
|
* hash: Buffer,
|
|
@@ -8,13 +7,12 @@
|
|
|
8
7
|
* keylen?: number,
|
|
9
8
|
* digest?: string
|
|
10
9
|
* }} CompareParams
|
|
11
|
-
*
|
|
12
10
|
* @typedef {{
|
|
13
11
|
* salt: BinaryLike,
|
|
14
12
|
* iterations?: number,
|
|
15
13
|
* keylen?: number,
|
|
16
14
|
* digest?: string
|
|
17
|
-
*
|
|
15
|
+
* }} HashParams
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
import {
|
package/src/hash.d.mts
ADDED
package/{utils → src}/hash.mjs
RENAMED
package/src/index.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BinaryLike
|
|
3
|
+
} from 'node:crypto'
|
|
4
|
+
|
|
5
|
+
export interface CompareParams {
|
|
6
|
+
salt: BinaryLike
|
|
7
|
+
hash: Buffer
|
|
8
|
+
iterations?: number
|
|
9
|
+
keylen?: number
|
|
10
|
+
digest?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface HashParams {
|
|
14
|
+
salt: BinaryLike
|
|
15
|
+
iterations?: number
|
|
16
|
+
keylen?: number
|
|
17
|
+
digest?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function compare (password: BinaryLike, params: CompareParams): Promise<boolean>
|
|
21
|
+
export function hash (password: BinaryLike, params: HashParams): Promise<Buffer>
|
|
22
|
+
export function salt (size: number): Promise<Buffer>
|
package/src/index.mjs
ADDED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
fromBase64ToBuffer,
|
|
7
7
|
fromBufferToBase64
|
|
8
|
-
} from '#
|
|
8
|
+
} from '#pbkdf2/common'
|
|
9
9
|
|
|
10
|
-
describe('`#
|
|
10
|
+
describe('`#pbkdf2/common`', () => {
|
|
11
11
|
describe('fromBase64ToBuffer', () => it('is a function', () => expect(fromBase64ToBuffer).to.be.a('function')))
|
|
12
12
|
|
|
13
13
|
describe('fromBufferToBase64', () => it('is a function', () => expect(fromBufferToBase64).to.be.a('function')))
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
expect
|
|
3
3
|
} from 'chai'
|
|
4
|
-
import compare from '#
|
|
4
|
+
import compare from '#pbkdf2/compare'
|
|
5
5
|
|
|
6
|
-
describe('`#
|
|
6
|
+
describe('`#pbkdf2/compare`', () => {
|
|
7
7
|
describe('compare', () => it('is a function', () => expect(compare).to.be.a('function')))
|
|
8
8
|
|
|
9
9
|
describe('compare()', () => {
|
package/index.d.mts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
BinaryLike
|
|
3
|
-
} from 'node:crypto'
|
|
4
|
-
|
|
5
|
-
export type CompareParams = {
|
|
6
|
-
salt: BinaryLike,
|
|
7
|
-
hash: Buffer,
|
|
8
|
-
iterations?: number,
|
|
9
|
-
keylen?: number,
|
|
10
|
-
digest?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type HashParams = {
|
|
14
|
-
salt: BinaryLike,
|
|
15
|
-
iterations?: number,
|
|
16
|
-
keylen?: number,
|
|
17
|
-
digest?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function compare(password: BinaryLike, params: CompareParams): Promise<boolean>
|
|
21
|
-
export function hash (password: BinaryLike, params: HashParams): Promise<Buffer>
|
|
22
|
-
export function salt (size: number): Promise<Buffer>
|
package/index.mjs
DELETED
package/utils/hash.d.mts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{utils → src}/salt.mjs
RENAMED
|
File without changes
|