@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.
@@ -1,4 +1,4 @@
1
- import argsMap from '#utils/args-map'
1
+ import argsMap from './args-map.mjs'
2
2
 
3
3
  /**
4
4
  * @type {number}
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
- merge({
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
- '**/*.{cjs,mjs}'
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
- .concat(
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.0",
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.35",
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.5",
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
- "#utils/*": "./utils/*.mjs"
56
+ "#pbkdf2/*": "./src/*.mjs",
57
+ "#pbkdf2": "./src/index.mjs",
58
+ "#pbkdf2/common": "./src/common/index.mjs"
55
59
  }
56
60
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import argsMap from '#utils/args-map'
3
+ import argsMap from '#config/args-map'
4
4
  import compare from '#utils/compare'
5
5
  import {
6
6
  fromBase64ToBuffer
package/scripts/hash.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import argsMap from '#utils/args-map'
3
+ import argsMap from '#config/args-map'
4
4
  import {
5
5
  fromBase64ToBuffer,
6
6
  fromBufferToBase64
package/scripts/salt.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import argsMap from '#utils/args-map'
3
+ import argsMap from '#config/args-map'
4
4
  import {
5
5
  fromBufferToBase64
6
6
  } from '#utils/common'
@@ -2,12 +2,12 @@ import type {
2
2
  BinaryLike
3
3
  } from 'node:crypto'
4
4
 
5
- type CompareParams = {
6
- salt: BinaryLike,
7
- hash: Buffer,
8
- iterations?: number,
9
- keylen?: number,
10
- digest?: string
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
- * }} HashParams
15
+ * }} HashParams
18
16
  */
19
17
 
20
18
  import {
package/src/hash.d.mts ADDED
@@ -0,0 +1,12 @@
1
+ import type {
2
+ BinaryLike
3
+ } from 'node:crypto'
4
+
5
+ interface HashParams {
6
+ salt: BinaryLike
7
+ iterations?: number
8
+ keylen?: number
9
+ digest?: string
10
+ }
11
+
12
+ export default function hash (password: BinaryLike, params: HashParams): Promise<Buffer>
@@ -5,7 +5,7 @@
5
5
  * iterations?: number,
6
6
  * keylen?: number,
7
7
  * digest?: string
8
- * }} HashParams
8
+ * }} HashParams
9
9
  */
10
10
 
11
11
  import {
@@ -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
@@ -0,0 +1,3 @@
1
+ export { default as compare } from './compare.mjs'
2
+ export { default as hash } from './hash.mjs'
3
+ export { default as salt } from './salt.mjs'
@@ -5,9 +5,9 @@ import {
5
5
  import {
6
6
  fromBase64ToBuffer,
7
7
  fromBufferToBase64
8
- } from '#utils/common'
8
+ } from '#pbkdf2/common'
9
9
 
10
- describe('`#utils/common`', () => {
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 '#utils/compare'
4
+ import compare from '#pbkdf2/compare'
5
5
 
6
- describe('`#utils/compare`', () => {
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
@@ -1,9 +0,0 @@
1
- import compare from '#utils/compare'
2
- import hash from '#utils/hash'
3
- import salt from '#utils/salt'
4
-
5
- export {
6
- compare,
7
- hash,
8
- salt
9
- }
package/utils/hash.d.mts DELETED
@@ -1,11 +0,0 @@
1
-
2
- import type {BinaryLike} from 'node:crypto'
3
-
4
- type HashParams = {
5
- salt: BinaryLike,
6
- iterations?: number,
7
- keylen?: number,
8
- digest?: string
9
- }
10
-
11
- export default function hash (password: BinaryLike, params: HashParams): Promise<Buffer>
File without changes
File without changes
File without changes
File without changes
File without changes