@sequencemedia/pbkdf2 1.0.1 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequencemedia/pbkdf2",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "./index.mjs",
5
5
  "type": "module",
6
6
  "author": {
@@ -1,135 +0,0 @@
1
- import {
2
- expect
3
- } from 'chai'
4
- import {
5
- fromBase64,
6
- toBase64,
7
- fromBase64ToBuffer,
8
- fromBufferToBase64
9
- } from '#utils/common'
10
-
11
- describe('`#utils/common`', () => {
12
- describe('fromBase64', () => it('is a function', () => expect(fromBase64).to.be.a('function')))
13
-
14
- describe('toBase64', () => it('is a function', () => expect(toBase64).to.be.a('function')))
15
-
16
- describe('fromBase64ToBuffer', () => it('is a function', () => expect(fromBase64ToBuffer).to.be.a('function')))
17
-
18
- describe('fromBufferToBase64', () => it('is a function', () => expect(fromBufferToBase64).to.be.a('function')))
19
-
20
- describe('fromBase64()', () => {
21
- describe('User 1', () => {
22
- it('returns a string', () => {
23
- const BASE64 = 'YzFjMTY4MmMyMWE4MjFkYjRhNWE5YjJmNDY0OTUzM2Q='
24
- const UTF8 = 'c1c1682c21a821db4a5a9b2f4649533d'
25
-
26
- return expect(fromBase64(BASE64)).to.equal(UTF8)
27
- })
28
- })
29
-
30
- describe('User 2', () => {
31
- it('returns a string', () => {
32
- const BASE64 = 'MDI2OGM0MDU4NWJiOTgxNWEyYzQwN2RkYjM1YTY5YWU='
33
- const UTF8 = '0268c40585bb9815a2c407ddb35a69ae'
34
-
35
- return expect(fromBase64(BASE64)).to.equal(UTF8)
36
- })
37
- })
38
-
39
- describe('User 3', () => {
40
- it('returns a string', () => {
41
- const BASE64 = 'ZDI3OTZmZWU3M2I3M2Y3MTgxMmYyNGM3MjU4NDE2NDM='
42
- const UTF8 = 'd2796fee73b73f71812f24c725841643'
43
-
44
- return expect(fromBase64(BASE64)).to.equal(UTF8)
45
- })
46
- })
47
- })
48
-
49
- describe('toBase64()', () => {
50
- describe('User 1', () => {
51
- it('returns a string', () => {
52
- const UTF8 = 'c1c1682c21a821db4a5a9b2f4649533d'
53
- const BASE64 = 'YzFjMTY4MmMyMWE4MjFkYjRhNWE5YjJmNDY0OTUzM2Q='
54
-
55
- return expect(toBase64(UTF8)).to.equal(BASE64)
56
- })
57
- })
58
-
59
- describe('User 2', () => {
60
- it('returns a string', () => {
61
- const UTF8 = '0268c40585bb9815a2c407ddb35a69ae'
62
- const BASE64 = 'MDI2OGM0MDU4NWJiOTgxNWEyYzQwN2RkYjM1YTY5YWU='
63
-
64
- return expect(toBase64(UTF8)).to.equal(BASE64)
65
- })
66
- })
67
-
68
- describe('User 3', () => {
69
- it('returns a string', () => {
70
- const UTF8 = 'd2796fee73b73f71812f24c725841643'
71
- const BASE64 = 'ZDI3OTZmZWU3M2I3M2Y3MTgxMmYyNGM3MjU4NDE2NDM='
72
-
73
- return expect(toBase64(UTF8)).to.equal(BASE64)
74
- })
75
- })
76
- })
77
-
78
- describe('fromBase64ToBuffer()', () => {
79
- describe('User 1', () => {
80
- it('returns a buffer', () => {
81
- const BASE64 = 'YzFjMTY4MmMyMWE4MjFkYjRhNWE5YjJmNDY0OTUzM2Q='
82
- const BUFFER = Buffer.from('c1c1682c21a821db4a5a9b2f4649533d')
83
-
84
- return expect(Buffer.compare(fromBase64ToBuffer(BASE64), BUFFER)).to.equal(0)
85
- })
86
- })
87
-
88
- describe('User 2', () => {
89
- it('returns a buffer', () => {
90
- const BASE64 = 'MDI2OGM0MDU4NWJiOTgxNWEyYzQwN2RkYjM1YTY5YWU='
91
- const BUFFER = Buffer.from('0268c40585bb9815a2c407ddb35a69ae')
92
-
93
- return expect(Buffer.compare(fromBase64ToBuffer(BASE64), BUFFER)).to.equal(0)
94
- })
95
- })
96
-
97
- describe('User 3', () => {
98
- it('returns a buffer', () => {
99
- const BASE64 = 'ZDI3OTZmZWU3M2I3M2Y3MTgxMmYyNGM3MjU4NDE2NDM='
100
- const BUFFER = Buffer.from('d2796fee73b73f71812f24c725841643')
101
-
102
- return expect(Buffer.compare(fromBase64ToBuffer(BASE64), BUFFER)).to.equal(0)
103
- })
104
- })
105
- })
106
-
107
- describe('fromBufferToBase64()', () => {
108
- describe('User 1', () => {
109
- it('returns a string', () => {
110
- const BUFFER = Buffer.from('c1c1682c21a821db4a5a9b2f4649533d')
111
- const BASE64 = 'YzFjMTY4MmMyMWE4MjFkYjRhNWE5YjJmNDY0OTUzM2Q='
112
-
113
- return expect(fromBufferToBase64(BUFFER)).to.equal(BASE64)
114
- })
115
- })
116
-
117
- describe('User 2', () => {
118
- it('returns a string', () => {
119
- const BUFFER = Buffer.from('0268c40585bb9815a2c407ddb35a69ae')
120
- const BASE64 = 'MDI2OGM0MDU4NWJiOTgxNWEyYzQwN2RkYjM1YTY5YWU='
121
-
122
- return expect(fromBufferToBase64(BUFFER)).to.equal(BASE64)
123
- })
124
- })
125
-
126
- describe('User 3', () => {
127
- it('returns a string', () => {
128
- const BUFFER = Buffer.from('d2796fee73b73f71812f24c725841643')
129
- const BASE64 = 'ZDI3OTZmZWU3M2I3M2Y3MTgxMmYyNGM3MjU4NDE2NDM='
130
-
131
- return expect(fromBufferToBase64(BUFFER)).to.equal(BASE64)
132
- })
133
- })
134
- })
135
- })
@@ -1,81 +0,0 @@
1
- import {
2
- expect
3
- } from 'chai'
4
- import compare from '#utils/compare'
5
-
6
- describe('`#utils/compare`', () => {
7
- describe('compare', () => it('is a function', () => expect(compare).to.be.a('function')))
8
-
9
- describe('compare()', () => {
10
- const ITERATIONS = 32768
11
-
12
- describe('User 1', () => {
13
- const HASH = Buffer.from('kOhpM7//M4I9+WcWLH7vbb/yN2+8qKyxQ0xAfI4JzamcRMdwwl7vAh0ch7UJ0JoBe9AqaAGuUJZF/mVA9EqaLQ==', 'base64')
14
- const SALT = 'c1c1682c21a821db4a5a9b2f4649533d'
15
-
16
- describe('`password` is valid', () => {
17
- it('returns true', async () => {
18
- const password = '^49pPaRdVSNC'
19
- const isValid = await compare(password, { hash: HASH, salt: SALT, iterations: ITERATIONS })
20
-
21
- return expect(isValid).to.be.true
22
- })
23
- })
24
-
25
- describe('`password` is not valid', () => {
26
- it('returns false', async () => {
27
- const password = 'not password'
28
- const isValid = await compare(password, { hash: HASH, salt: SALT, iterations: ITERATIONS })
29
-
30
- return expect(isValid).to.be.false
31
- })
32
- })
33
- })
34
-
35
- describe('User 2', () => {
36
- const HASH = Buffer.from('BrtOel2qy5HrYWn45jBKf5b3HUKdVeQfIj1ljhGxQ/SiWsmMMuOl756H4MXkMOnVJKrgFfHFy7cgFXUaSFA2ow==', 'base64')
37
- const SALT = '0268c40585bb9815a2c407ddb35a69ae'
38
-
39
- describe('`password` is valid', () => {
40
- it('returns true', async () => {
41
- const password = 'S0uSaC&FzDOO'
42
- const isValid = await compare(password, { hash: HASH, salt: SALT, iterations: ITERATIONS })
43
-
44
- return expect(isValid).to.be.true
45
- })
46
- })
47
-
48
- describe('`password` is not valid', () => {
49
- it('returns false', async () => {
50
- const password = 'not password'
51
- const isValid = await compare(password, { hash: HASH, salt: SALT, iterations: ITERATIONS })
52
-
53
- return expect(isValid).to.be.false
54
- })
55
- })
56
- })
57
-
58
- describe('User 3', () => {
59
- const HASH = Buffer.from('bV76sVqsM0doKBFnaHsZQC9OgcVnF/+gzkG7HFXdD7jyQdN1PqCVijyXKMijmYQPWJohi5f7sVxhoLJ5kf8aQA==', 'base64')
60
- const SALT = 'd2796fee73b73f71812f24c725841643'
61
-
62
- describe('`password` is valid', () => {
63
- it('returns true', async () => {
64
- const password = '@^EJmdlkt5A#'
65
- const isValid = await compare(password, { hash: HASH, salt: SALT, iterations: ITERATIONS })
66
-
67
- return expect(isValid).to.be.true
68
- })
69
- })
70
-
71
- describe('`password` is not valid', () => {
72
- it('returns false', async () => {
73
- const password = 'not password'
74
- const isValid = await compare(password, { hash: HASH, salt: SALT, iterations: ITERATIONS })
75
-
76
- return expect(isValid).to.be.false
77
- })
78
- })
79
- })
80
- })
81
- })