@nivinjoseph/n-sec 5.0.5 → 6.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.
Files changed (83) hide show
  1. package/.vscode/settings.json +111 -0
  2. package/.yarn/releases/yarn-4.0.2.cjs +893 -0
  3. package/.yarnrc.yml +3 -0
  4. package/dist/api-security/alg-type.d.ts +1 -0
  5. package/dist/api-security/alg-type.d.ts.map +1 -0
  6. package/dist/api-security/alg-type.js +2 -5
  7. package/dist/api-security/alg-type.js.map +1 -1
  8. package/dist/api-security/claim.d.ts +1 -0
  9. package/dist/api-security/claim.d.ts.map +1 -0
  10. package/dist/api-security/claim.js +5 -9
  11. package/dist/api-security/claim.js.map +1 -1
  12. package/dist/api-security/claims-identity.d.ts +2 -1
  13. package/dist/api-security/claims-identity.d.ts.map +1 -0
  14. package/dist/api-security/claims-identity.js +4 -8
  15. package/dist/api-security/claims-identity.js.map +1 -1
  16. package/dist/api-security/expired-token-exception.d.ts +1 -0
  17. package/dist/api-security/expired-token-exception.d.ts.map +1 -0
  18. package/dist/api-security/expired-token-exception.js +5 -9
  19. package/dist/api-security/expired-token-exception.js.map +1 -1
  20. package/dist/api-security/invalid-token-exception.d.ts +1 -0
  21. package/dist/api-security/invalid-token-exception.d.ts.map +1 -0
  22. package/dist/api-security/invalid-token-exception.js +7 -11
  23. package/dist/api-security/invalid-token-exception.js.map +1 -1
  24. package/dist/api-security/json-web-token.d.ts +3 -2
  25. package/dist/api-security/json-web-token.d.ts.map +1 -0
  26. package/dist/api-security/json-web-token.js +39 -43
  27. package/dist/api-security/json-web-token.js.map +1 -1
  28. package/dist/api-security/security-token.d.ts +1 -0
  29. package/dist/api-security/security-token.d.ts.map +1 -0
  30. package/dist/api-security/security-token.js +6 -10
  31. package/dist/api-security/security-token.js.map +1 -1
  32. package/dist/bin.d.ts +1 -0
  33. package/dist/bin.d.ts.map +1 -0
  34. package/dist/bin.js +16 -20
  35. package/dist/bin.js.map +1 -1
  36. package/dist/crypto/asymmetric-encryption.d.ts +2 -0
  37. package/dist/crypto/asymmetric-encryption.d.ts.map +1 -0
  38. package/dist/crypto/asymmetric-encryption.js +1 -1
  39. package/dist/crypto/asymmetric-encryption.js.map +1 -1
  40. package/dist/crypto/crypto-exception.d.ts +1 -0
  41. package/dist/crypto/crypto-exception.d.ts.map +1 -0
  42. package/dist/crypto/crypto-exception.js +2 -6
  43. package/dist/crypto/crypto-exception.js.map +1 -1
  44. package/dist/crypto/digital-signature.d.ts +2 -0
  45. package/dist/crypto/digital-signature.d.ts.map +1 -0
  46. package/dist/crypto/digital-signature.js +1 -1
  47. package/dist/crypto/digital-signature.js.map +1 -1
  48. package/dist/crypto/hash.d.ts +1 -0
  49. package/dist/crypto/hash.d.ts.map +1 -0
  50. package/dist/crypto/hash.js +7 -11
  51. package/dist/crypto/hash.js.map +1 -1
  52. package/dist/crypto/hmac.d.ts +1 -0
  53. package/dist/crypto/hmac.d.ts.map +1 -0
  54. package/dist/crypto/hmac.js +6 -10
  55. package/dist/crypto/hmac.js.map +1 -1
  56. package/dist/crypto/symmetric-encryption.d.ts +1 -0
  57. package/dist/crypto/symmetric-encryption.d.ts.map +1 -0
  58. package/dist/crypto/symmetric-encryption.js +13 -17
  59. package/dist/crypto/symmetric-encryption.js.map +1 -1
  60. package/dist/index.d.ts +13 -12
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +17 -28
  63. package/dist/index.js.map +1 -1
  64. package/dist/tsconfig.json +2 -1
  65. package/eslint.config.js +591 -0
  66. package/package.json +24 -24
  67. package/src/api-security/claims-identity.ts +1 -1
  68. package/src/api-security/json-web-token.ts +21 -21
  69. package/src/bin.ts +2 -1
  70. package/src/crypto/hash.ts +9 -9
  71. package/src/crypto/hmac.ts +7 -7
  72. package/src/crypto/symmetric-encryption.ts +11 -11
  73. package/src/index.ts +17 -18
  74. package/test/asymmetric-encryption.test.ts +37 -37
  75. package/test/digital-signature.test.ts +22 -22
  76. package/test/hash.test.ts +109 -109
  77. package/test/hmac.test.ts +56 -55
  78. package/test/json-web-token.test.ts +95 -95
  79. package/test/other.test.ts +8 -7
  80. package/test/symmetric-encryption.test.ts +49 -48
  81. package/tsconfig.json +8 -5
  82. package/.eslintignore +0 -2
  83. package/.eslintrc +0 -335
@@ -4,11 +4,11 @@
4
4
  // import "@nivinjoseph/n-ext";
5
5
 
6
6
 
7
- // suite("digitalSignature", () =>
7
+ // await describe("digitalSignature", () =>
8
8
  // {
9
- // suite("sign", () =>
9
+ // await describe("sign", () =>
10
10
  // {
11
- // test("should return string value thats is not null, empty, whitespace, same as value or key pair when invoked with key pair and value", async () =>
11
+ // await test("should return string value thats is not null, empty, whitespace, same as value or key pair when invoked with key pair and value", async () =>
12
12
  // {
13
13
  // let keyPair = await AsymmetricEncryption.generateKeyPair();
14
14
  // let value = "some value";
@@ -19,7 +19,7 @@
19
19
  // });
20
20
 
21
21
 
22
- // // test("should throw CryptoException when KeyPair is null", async () =>
22
+ // // await test("should throw CryptoException when KeyPair is null", async () =>
23
23
  // // {
24
24
  // // try
25
25
  // // {
@@ -34,7 +34,7 @@
34
34
  // // assert.ok(false);
35
35
  // // });
36
36
 
37
- // // test("should throw CryptoException when KeyPair is undefined", async () =>
37
+ // // await test("should throw CryptoException when KeyPair is undefined", async () =>
38
38
  // // {
39
39
  // // try
40
40
  // // {
@@ -49,7 +49,7 @@
49
49
  // // assert.ok(false);
50
50
  // // });
51
51
 
52
- // // test("should throw CryptoException when value is null", async () =>
52
+ // // await test("should throw CryptoException when value is null", async () =>
53
53
  // // {
54
54
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
55
55
  // // try
@@ -65,7 +65,7 @@
65
65
  // // assert.ok(false);
66
66
  // // });
67
67
 
68
- // // test("should throw CryptoException when value is undefined", async () =>
68
+ // // await test("should throw CryptoException when value is undefined", async () =>
69
69
  // // {
70
70
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
71
71
  // // try
@@ -81,7 +81,7 @@
81
81
  // // assert.ok(false);
82
82
  // // });
83
83
 
84
- // // test("should throw CryptoException when value is empty string", async () =>
84
+ // // await test("should throw CryptoException when value is empty string", async () =>
85
85
  // // {
86
86
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
87
87
  // // try
@@ -97,7 +97,7 @@
97
97
  // // assert.ok(false);
98
98
  // // });
99
99
 
100
- // // test("should throw CryptoException when keyPair is empty string", async () =>
100
+ // // await test("should throw CryptoException when keyPair is empty string", async () =>
101
101
  // // {
102
102
  // // try
103
103
  // // {
@@ -113,9 +113,9 @@
113
113
  // // });
114
114
  // });
115
115
 
116
- // suite("verify", () =>
116
+ // await describe("verify", () =>
117
117
  // {
118
- // test("should return true when called with public key of key pair, value and signature of value generated using key pair", async () =>
118
+ // await test("should return true when called with public key of key pair, value and signature of value generated using key pair", async () =>
119
119
  // {
120
120
  // let keyPair = await AsymmetricEncryption.generateKeyPair();
121
121
  // let publicKey = await AsymmetricEncryption.getPublicKey(keyPair);
@@ -125,7 +125,7 @@
125
125
  // Assert.strictEqual(verification, true);
126
126
  // });
127
127
 
128
- // test("should return false when called with unrelated public key, value and signature", async () =>
128
+ // await test("should return false when called with unrelated public key, value and signature", async () =>
129
129
  // {
130
130
  // let keyPair1 = await AsymmetricEncryption.generateKeyPair();
131
131
  // let keyPair2 = await AsymmetricEncryption.generateKeyPair();
@@ -136,7 +136,7 @@
136
136
  // Assert.strictEqual(verification, false);
137
137
  // });
138
138
 
139
- // test("should return false when called with tampered value", async () =>
139
+ // await test("should return false when called with tampered value", async () =>
140
140
  // {
141
141
  // let keyPair = await AsymmetricEncryption.generateKeyPair();
142
142
  // let publicKey = await AsymmetricEncryption.getPublicKey(keyPair);
@@ -147,7 +147,7 @@
147
147
  // Assert.strictEqual(verification, false);
148
148
  // });
149
149
 
150
- // test("should return false when called with a tampered signature", async () =>
150
+ // await test("should return false when called with a tampered signature", async () =>
151
151
  // {
152
152
  // let keyPair = await AsymmetricEncryption.generateKeyPair();
153
153
  // let publicKey = await AsymmetricEncryption.getPublicKey(keyPair);
@@ -160,7 +160,7 @@
160
160
 
161
161
 
162
162
 
163
- // // test("successfully verify the signed", async () =>
163
+ // // await test("successfully verify the signed", async () =>
164
164
  // // {
165
165
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
166
166
  // // let publicKey = await AsymmetricEncryption.getPublicKey(keyPair);
@@ -169,7 +169,7 @@
169
169
  // // Assert.ok(verify);
170
170
  // // });
171
171
 
172
- // // test("un-verify modified signature", async () =>
172
+ // // await test("un-verify modified signature", async () =>
173
173
  // // {
174
174
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
175
175
  // // let publicKey = await AsymmetricEncryption.getPublicKey(keyPair);
@@ -179,7 +179,7 @@
179
179
  // // Assert.ok(!verify);
180
180
  // // });
181
181
 
182
- // // test("un-verify when wrong public key is given", async () =>
182
+ // // await test("un-verify when wrong public key is given", async () =>
183
183
  // // {
184
184
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
185
185
  // // let signature = await DigitalSignature.sign(keyPair, "some-string");
@@ -189,7 +189,7 @@
189
189
  // // Assert.ok(!verify);
190
190
  // // });
191
191
 
192
- // // test("should throw CryptoException when public key is null", async () =>
192
+ // // await test("should throw CryptoException when public key is null", async () =>
193
193
  // // {
194
194
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
195
195
  // // let signature = await DigitalSignature.sign(keyPair, "some-string");
@@ -206,7 +206,7 @@
206
206
  // // Assert.ok(false);
207
207
  // // });
208
208
 
209
- // // test("should throw CryptoException when value is null", async () =>
209
+ // // await test("should throw CryptoException when value is null", async () =>
210
210
  // // {
211
211
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
212
212
  // // let signature = await DigitalSignature.sign(keyPair, "some-string");
@@ -224,7 +224,7 @@
224
224
  // // Assert.ok(false);
225
225
  // // });
226
226
 
227
- // // test("should throw CryptoException when value is empty string", async () =>
227
+ // // await test("should throw CryptoException when value is empty string", async () =>
228
228
  // // {
229
229
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
230
230
  // // let signature = await DigitalSignature.sign(keyPair, "some-string");
@@ -242,7 +242,7 @@
242
242
  // // Assert.ok(false);
243
243
  // // });
244
244
 
245
- // // test("should throw CryptoException when signature is null", async () =>
245
+ // // await test("should throw CryptoException when signature is null", async () =>
246
246
  // // {
247
247
  // // let keyPair = await AsymmetricEncryption.generateKeyPair();
248
248
  // // let publicKey = await AsymmetricEncryption.getPublicKey(keyPair);
@@ -259,7 +259,7 @@
259
259
  // // Assert.ok(false);
260
260
  // // });
261
261
 
262
- // // test("should throw CryptoException when value, key pair and signature are all null", async () =>
262
+ // // await test("should throw CryptoException when value, key pair and signature are all null", async () =>
263
263
  // // {
264
264
  // // try
265
265
  // // {
package/test/hash.test.ts CHANGED
@@ -1,49 +1,50 @@
1
- import * as Assert from "assert";
2
- import { Hash } from "./../src/index";
1
+ import { describe, test } from "node:test";
2
+ import assert from "node:assert";
3
+ import { Hash } from "./../src/index.js";
3
4
  import "@nivinjoseph/n-ext";
4
5
  // import { CryptoException } from "./../src/crypto-exception";
5
6
 
6
- suite("Hash", () =>
7
+ await describe("Hash", async () =>
7
8
  {
8
- suite("create", () =>
9
+ await describe("create", async () =>
9
10
  {
10
- test("must return a string value that is not null, empty, whitespace or same as input when called with a valid input", () =>
11
+ await test("must return a string value that is not null, empty, whitespace or same as input when called with a valid input", () =>
11
12
  {
12
13
  const input = "hello world";
13
14
  const hash = Hash.create(input);
14
15
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
15
- Assert.ok(hash !== null && !hash.isEmptyOrWhiteSpace());
16
- Assert.notStrictEqual(hash, input);
16
+ assert.ok(hash !== null && !hash.isEmptyOrWhiteSpace());
17
+ assert.notStrictEqual(hash, input);
17
18
  });
18
-
19
- test("multiple invocations with the same input must return the same output", () =>
19
+
20
+ await test("multiple invocations with the same input must return the same output", () =>
20
21
  {
21
22
  const input = "hello world";
22
23
  const hash1 = Hash.create(input);
23
24
  const hash2 = Hash.create(input);
24
- Assert.strictEqual(hash1, hash2);
25
+ assert.strictEqual(hash1, hash2);
25
26
  });
26
-
27
- test("multiple invocations with the different inputs must return different outputs", () =>
27
+
28
+ await test("multiple invocations with the different inputs must return different outputs", () =>
28
29
  {
29
30
  const input1 = "hello world";
30
31
  const hash1 = Hash.create(input1);
31
32
  const input2 = "goodbye world";
32
33
  const hash2 = Hash.create(input2);
33
- Assert.notStrictEqual(hash1, hash2);
34
+ assert.notStrictEqual(hash1, hash2);
34
35
  });
35
-
36
-
37
- // test("successfully create a hash twice with different values", async () =>
36
+
37
+
38
+ // await test("successfully create a hash twice with different values", async () =>
38
39
  // {
39
40
  // let hash1 = await Hash.create("hello world");
40
41
  // let hash2 = await Hash.create("hello world2");
41
- // Assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
42
- // Assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
43
- // Assert.notStrictEqual(hash1, hash2);
42
+ // assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
43
+ // assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
44
+ // assert.notStrictEqual(hash1, hash2);
44
45
  // });
45
-
46
- // test("should throw CryptoException when value is null", async () =>
46
+
47
+ // await test("should throw CryptoException when value is null", async () =>
47
48
  // {
48
49
  // try
49
50
  // {
@@ -51,14 +52,14 @@ suite("Hash", () =>
51
52
  // }
52
53
  // catch (exception)
53
54
  // {
54
- // Assert.ok(exception instanceof CryptoException);
55
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
55
+ // assert.ok(exception instanceof CryptoException);
56
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
56
57
  // return;
57
58
  // }
58
- // Assert.ok(false);
59
+ // assert.ok(false);
59
60
  // });
60
-
61
- // test("should throw CryptoException when value is undefined", async () =>
61
+
62
+ // await test("should throw CryptoException when value is undefined", async () =>
62
63
  // {
63
64
  // try
64
65
  // {
@@ -66,14 +67,14 @@ suite("Hash", () =>
66
67
  // }
67
68
  // catch (exception)
68
69
  // {
69
- // Assert.ok(exception instanceof CryptoException);
70
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
70
+ // assert.ok(exception instanceof CryptoException);
71
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
71
72
  // return;
72
73
  // }
73
- // Assert.ok(false);
74
+ // assert.ok(false);
74
75
  // });
75
-
76
- // test("should throw CryptoException when value is empty string", async () =>
76
+
77
+ // await test("should throw CryptoException when value is empty string", async () =>
77
78
  // {
78
79
  // try
79
80
  // {
@@ -81,51 +82,51 @@ suite("Hash", () =>
81
82
  // }
82
83
  // catch (exception)
83
84
  // {
84
- // Assert.ok(exception instanceof CryptoException);
85
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
85
+ // assert.ok(exception instanceof CryptoException);
86
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
86
87
  // return;
87
88
  // }
88
- // Assert.ok(false);
89
+ // assert.ok(false);
89
90
  // });
90
-
91
+
91
92
  });
92
-
93
- suite("createUsingSalt", () =>
93
+
94
+ await describe("createUsingSalt", async () =>
94
95
  {
95
- test("must return a string value that is not null, empty, whitespace or same as input or salt when called with a valid input and salt", () =>
96
+ await test("must return a string value that is not null, empty, whitespace or same as input or salt when called with a valid input and salt", () =>
96
97
  {
97
98
  const input = "hello world";
98
99
  const salt = "salt";
99
100
  const hash = Hash.createUsingSalt(input, salt);
100
101
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
101
- Assert.ok(hash !== null && !hash.isEmptyOrWhiteSpace());
102
- Assert.notStrictEqual(hash, input);
103
- Assert.notStrictEqual(hash, salt);
102
+ assert.ok(hash !== null && !hash.isEmptyOrWhiteSpace());
103
+ assert.notStrictEqual(hash, input);
104
+ assert.notStrictEqual(hash, salt);
104
105
  });
105
106
 
106
- test("multiple invocations with the same input and salt must return the same output", () =>
107
+ await test("multiple invocations with the same input and salt must return the same output", () =>
107
108
  {
108
109
  const input = "hello world";
109
110
  const salt = "salt";
110
111
  const hash1 = Hash.createUsingSalt(input, salt);
111
112
  const hash2 = Hash.createUsingSalt(input, salt);
112
- Assert.strictEqual(hash1, hash2);
113
+ assert.strictEqual(hash1, hash2);
113
114
  });
114
115
 
115
- test("multiple invocations with different inputs and different salts must return different outputs", () =>
116
+ await test("multiple invocations with different inputs and different salts must return different outputs", () =>
116
117
  {
117
118
  const input1 = "hello world";
118
119
  const salt1 = "salt-1";
119
120
  const hash1 = Hash.createUsingSalt(input1, salt1);
120
-
121
+
121
122
  const input2 = "goodbye world";
122
123
  const salt2 = "salt-2";
123
124
  const hash2 = Hash.createUsingSalt(input2, salt2);
124
-
125
- Assert.notStrictEqual(hash1, hash2);
125
+
126
+ assert.notStrictEqual(hash1, hash2);
126
127
  });
127
-
128
- test("multiple invocations with different inputs and the same salt must return different outputs", () =>
128
+
129
+ await test("multiple invocations with different inputs and the same salt must return different outputs", () =>
129
130
  {
130
131
  const input1 = "hello world";
131
132
  const salt1 = "salt-1";
@@ -134,10 +135,10 @@ suite("Hash", () =>
134
135
  const input2 = "goodbye world";
135
136
  const hash2 = Hash.createUsingSalt(input2, salt1);
136
137
 
137
- Assert.notStrictEqual(hash1, hash2);
138
+ assert.notStrictEqual(hash1, hash2);
138
139
  });
139
-
140
- test("multiple invocations with the same input and different salts must return different outputs", () =>
140
+
141
+ await test("multiple invocations with the same input and different salts must return different outputs", () =>
141
142
  {
142
143
  const input = "hello world";
143
144
  const salt1 = "salt-1";
@@ -146,63 +147,62 @@ suite("Hash", () =>
146
147
  const salt2 = "salt-2";
147
148
  const hash2 = Hash.createUsingSalt(input, salt2);
148
149
 
149
- Assert.notStrictEqual(hash1, hash2);
150
+ assert.notStrictEqual(hash1, hash2);
150
151
  });
151
-
152
- test("regex issue", () =>
152
+
153
+ await test("regex issue", () =>
153
154
  {
154
155
  let password = "YQAt3TPI7s1YXyClbQ2$&JdHOKZJ@z4!";
155
156
  password = password.trim();
156
157
 
157
158
  const createdAt = Date.now();
158
159
  const username = "defaultUser";
159
-
160
+
160
161
  const salt = (createdAt % 2) === 0
161
162
  ? `${username.base64Decode()}${createdAt}`
162
163
  : `${createdAt}${username.base64Decode()}`;
163
164
 
164
- return Hash.createUsingSalt(password, salt);
165
+ Hash.createUsingSalt(password, salt);
165
166
  });
166
-
167
-
168
-
169
-
170
-
171
- // test("successfully create a hash", async () =>
167
+
168
+
169
+
170
+
171
+ // await test("successfully create a hash", async () =>
172
172
  // {
173
173
  // let hash = await Hash.createUsingSalt("hello world", "some-salt");
174
- // Assert.ok(hash !== null && !hash.isEmptyOrWhiteSpace());
175
- // Assert.notStrictEqual("hello world", hash);
174
+ // assert.ok(hash !== null && !hash.isEmptyOrWhiteSpace());
175
+ // assert.notStrictEqual("hello world", hash);
176
176
  // });
177
177
 
178
- // test("successfully create a hash twice with same values and same salt", async () =>
178
+ // await test("successfully create a hash twice with same values and same salt", async () =>
179
179
  // {
180
180
  // let hash1 = await Hash.createUsingSalt("hello world", "some-salt");
181
181
  // let hash2 = await Hash.createUsingSalt("hello world", "some-salt");
182
- // Assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
183
- // Assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
184
- // Assert.strictEqual(hash1, hash2);
182
+ // assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
183
+ // assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
184
+ // assert.strictEqual(hash1, hash2);
185
185
  // });
186
-
187
- // test("successfully create a hash twice with same values and different salt", async () =>
186
+
187
+ // await test("successfully create a hash twice with same values and different salt", async () =>
188
188
  // {
189
189
  // let hash1 = await Hash.createUsingSalt("hello world", "some-salt");
190
190
  // let hash2 = await Hash.createUsingSalt("hello world", "some-other-salt");
191
- // Assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
192
- // Assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
193
- // Assert.notStrictEqual(hash1, hash2);
191
+ // assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
192
+ // assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
193
+ // assert.notStrictEqual(hash1, hash2);
194
194
  // });
195
-
196
- // test("successfully create a hash twice with different values same salt", async () =>
195
+
196
+ // await test("successfully create a hash twice with different values same salt", async () =>
197
197
  // {
198
198
  // let hash1 = await Hash.createUsingSalt("hello world", "some-salt");
199
199
  // let hash2 = await Hash.createUsingSalt("hello world2", "some-salt");
200
- // Assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
201
- // Assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
202
- // Assert.notStrictEqual(hash1, hash2);
200
+ // assert.ok(hash1 !== null && !hash1.isEmptyOrWhiteSpace());
201
+ // assert.ok(hash2 !== null && !hash2.isEmptyOrWhiteSpace());
202
+ // assert.notStrictEqual(hash1, hash2);
203
203
  // });
204
-
205
- // test("should throw CryptoException when value is null", async () =>
204
+
205
+ // await test("should throw CryptoException when value is null", async () =>
206
206
  // {
207
207
  // try
208
208
  // {
@@ -210,14 +210,14 @@ suite("Hash", () =>
210
210
  // }
211
211
  // catch (exception)
212
212
  // {
213
- // Assert.ok(exception instanceof CryptoException);
214
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
213
+ // assert.ok(exception instanceof CryptoException);
214
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
215
215
  // return;
216
216
  // }
217
- // Assert.ok(false);
217
+ // assert.ok(false);
218
218
  // });
219
-
220
- // test("should throw CryptoException when value is undefined", async () =>
219
+
220
+ // await test("should throw CryptoException when value is undefined", async () =>
221
221
  // {
222
222
  // try
223
223
  // {
@@ -225,14 +225,14 @@ suite("Hash", () =>
225
225
  // }
226
226
  // catch (exception)
227
227
  // {
228
- // Assert.ok(exception instanceof CryptoException);
229
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
228
+ // assert.ok(exception instanceof CryptoException);
229
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
230
230
  // return;
231
231
  // }
232
- // Assert.ok(false);
232
+ // assert.ok(false);
233
233
  // });
234
-
235
- // test("should throw CryptoException when salt is null", async () =>
234
+
235
+ // await test("should throw CryptoException when salt is null", async () =>
236
236
  // {
237
237
  // try
238
238
  // {
@@ -240,14 +240,14 @@ suite("Hash", () =>
240
240
  // }
241
241
  // catch (exception)
242
242
  // {
243
- // Assert.ok(exception instanceof CryptoException);
244
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
243
+ // assert.ok(exception instanceof CryptoException);
244
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
245
245
  // return;
246
246
  // }
247
- // Assert.ok(false);
247
+ // assert.ok(false);
248
248
  // });
249
-
250
- // test("should throw CryptoException when salt is undefined", async () =>
249
+
250
+ // await test("should throw CryptoException when salt is undefined", async () =>
251
251
  // {
252
252
  // try
253
253
  // {
@@ -255,14 +255,14 @@ suite("Hash", () =>
255
255
  // }
256
256
  // catch (exception)
257
257
  // {
258
- // Assert.ok(exception instanceof CryptoException);
259
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
258
+ // assert.ok(exception instanceof CryptoException);
259
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
260
260
  // return;
261
261
  // }
262
- // Assert.ok(false);
262
+ // assert.ok(false);
263
263
  // });
264
-
265
- // test("should throw CryptoException when salt is empty string", async () =>
264
+
265
+ // await test("should throw CryptoException when salt is empty string", async () =>
266
266
  // {
267
267
  // try
268
268
  // {
@@ -270,14 +270,14 @@ suite("Hash", () =>
270
270
  // }
271
271
  // catch (exception)
272
272
  // {
273
- // Assert.ok(exception instanceof CryptoException);
274
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
273
+ // assert.ok(exception instanceof CryptoException);
274
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
275
275
  // return;
276
276
  // }
277
- // Assert.ok(false);
277
+ // assert.ok(false);
278
278
  // });
279
-
280
- // test("should throw CryptoException when value is empty string", async () =>
279
+
280
+ // await test("should throw CryptoException when value is empty string", async () =>
281
281
  // {
282
282
  // try
283
283
  // {
@@ -285,11 +285,11 @@ suite("Hash", () =>
285
285
  // }
286
286
  // catch (exception)
287
287
  // {
288
- // Assert.ok(exception instanceof CryptoException);
289
- // Assert.strictEqual(exception.message, "Parameter count mismatch.");
288
+ // assert.ok(exception instanceof CryptoException);
289
+ // assert.strictEqual(exception.message, "Parameter count mismatch.");
290
290
  // return;
291
291
  // }
292
- // Assert.ok(false);
292
+ // assert.ok(false);
293
293
  // });
294
294
  });
295
295
  });