@nivinjoseph/n-sec 5.0.1 → 5.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/.eslintignore +2 -0
- package/.eslintrc +335 -0
- package/dist/api-security/alg-type.js +2 -0
- package/dist/api-security/alg-type.js.map +1 -1
- package/dist/api-security/claim.d.ts +2 -2
- package/dist/api-security/claim.js +3 -1
- package/dist/api-security/claim.js.map +1 -1
- package/dist/api-security/claims-identity.js +2 -1
- package/dist/api-security/claims-identity.js.map +1 -1
- package/dist/api-security/expired-token-exception.js +2 -1
- package/dist/api-security/expired-token-exception.js.map +1 -1
- package/dist/api-security/invalid-token-exception.js +3 -2
- package/dist/api-security/invalid-token-exception.js.map +1 -1
- package/dist/api-security/json-web-token.d.ts +3 -3
- package/dist/api-security/json-web-token.js +57 -37
- package/dist/api-security/json-web-token.js.map +1 -1
- package/dist/api-security/security-token.js +2 -2
- package/dist/api-security/security-token.js.map +1 -1
- package/dist/crypto/asymmetric-encryption.js +49 -0
- package/dist/crypto/asymmetric-encryption.js.map +1 -1
- package/dist/crypto/crypto-exception.js +1 -0
- package/dist/crypto/crypto-exception.js.map +1 -1
- package/dist/crypto/digital-signature.js +51 -0
- package/dist/crypto/digital-signature.js.map +1 -1
- package/dist/crypto/hash.js +4 -3
- package/dist/crypto/hash.js.map +1 -1
- package/dist/crypto/hmac.js +3 -2
- package/dist/crypto/hmac.js.map +1 -1
- package/dist/crypto/symmetric-encryption.js +5 -4
- package/dist/crypto/symmetric-encryption.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
- package/src/api-security/claim.ts +5 -4
- package/src/api-security/claims-identity.ts +1 -1
- package/src/api-security/expired-token-exception.ts +1 -1
- package/src/api-security/invalid-token-exception.ts +2 -2
- package/src/api-security/json-web-token.ts +68 -66
- package/src/crypto/hash.ts +1 -2
- package/src/crypto/symmetric-encryption.ts +0 -2
- package/test/hash.test.ts +34 -32
- package/test/hmac.test.ts +24 -23
- package/test/json-web-token.test.ts +40 -37
- package/test/other.test.ts +3 -3
- package/test/symmetric-encryption.test.ts +12 -10
- package/tsconfig.json +8 -11
- package/dist/crypto/uuid.js.map +0 -1
- package/tslint.json +0 -64
package/.eslintignore
ADDED
package/.eslintrc
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"plugins": [
|
|
5
|
+
"@typescript-eslint"
|
|
6
|
+
],
|
|
7
|
+
"extends": [
|
|
8
|
+
"eslint:recommended",
|
|
9
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
10
|
+
"plugin:@typescript-eslint/recommended"
|
|
11
|
+
],
|
|
12
|
+
"parserOptions": {
|
|
13
|
+
"project": "tsconfig.json"
|
|
14
|
+
},
|
|
15
|
+
"rules": {
|
|
16
|
+
"no-eval": "error",
|
|
17
|
+
"no-void": "error",
|
|
18
|
+
"no-with": "error",
|
|
19
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
20
|
+
"@typescript-eslint/array-type": [
|
|
21
|
+
"error",
|
|
22
|
+
{
|
|
23
|
+
"default": "generic",
|
|
24
|
+
"readonly": "generic"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"@typescript-eslint/await-thenable": "error",
|
|
28
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
29
|
+
"error",
|
|
30
|
+
{
|
|
31
|
+
"ts-expect-error": "allow-with-description",
|
|
32
|
+
"ts-ignore": "allow-with-description",
|
|
33
|
+
"ts-nocheck": true,
|
|
34
|
+
"ts-check": true
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
38
|
+
"@typescript-eslint/ban-types": [
|
|
39
|
+
"error",
|
|
40
|
+
{
|
|
41
|
+
"extendDefaults": false,
|
|
42
|
+
"types": {
|
|
43
|
+
"String": {
|
|
44
|
+
"message": "Use string instead",
|
|
45
|
+
"fixWith": "string"
|
|
46
|
+
},
|
|
47
|
+
"Boolean": {
|
|
48
|
+
"message": "Use boolean instead",
|
|
49
|
+
"fixWith": "boolean"
|
|
50
|
+
},
|
|
51
|
+
"Number": {
|
|
52
|
+
"message": "Use number instead",
|
|
53
|
+
"fixWith": "number"
|
|
54
|
+
},
|
|
55
|
+
"Symbol": {
|
|
56
|
+
"message": "Use symbol instead",
|
|
57
|
+
"fixWith": "symbol"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"brace-style": "off",
|
|
63
|
+
"@typescript-eslint/brace-style": [
|
|
64
|
+
"error",
|
|
65
|
+
"allman",
|
|
66
|
+
{
|
|
67
|
+
"allowSingleLine": true
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"@typescript-eslint/class-literal-property-style": [
|
|
71
|
+
"off",
|
|
72
|
+
"getters"
|
|
73
|
+
],
|
|
74
|
+
"comma-dangle": "off",
|
|
75
|
+
"@typescript-eslint/comma-dangle": [
|
|
76
|
+
"error",
|
|
77
|
+
"never"
|
|
78
|
+
],
|
|
79
|
+
"default-param-last": "off",
|
|
80
|
+
"@typescript-eslint/default-param-last": "error",
|
|
81
|
+
"@typescript-eslint/explicit-function-return-type": "error",
|
|
82
|
+
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
83
|
+
"@typescript-eslint/explicit-module-boundary-types": "error",
|
|
84
|
+
"func-call-spacing": "off",
|
|
85
|
+
"@typescript-eslint/func-call-spacing": [
|
|
86
|
+
"error",
|
|
87
|
+
"never"
|
|
88
|
+
],
|
|
89
|
+
"@typescript-eslint/member-delimiter-style": [
|
|
90
|
+
"error",
|
|
91
|
+
{
|
|
92
|
+
"multiline": {
|
|
93
|
+
"delimiter": "semi",
|
|
94
|
+
"requireLast": true
|
|
95
|
+
},
|
|
96
|
+
"singleline": {
|
|
97
|
+
"delimiter": "semi",
|
|
98
|
+
"requireLast": true
|
|
99
|
+
},
|
|
100
|
+
"multilineDetection": "brackets"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"@typescript-eslint/member-ordering": [
|
|
104
|
+
"error",
|
|
105
|
+
{
|
|
106
|
+
"default": [
|
|
107
|
+
// Index signature
|
|
108
|
+
"signature",
|
|
109
|
+
// Fields
|
|
110
|
+
"private-static-field",
|
|
111
|
+
"protected-static-field",
|
|
112
|
+
"public-static-field",
|
|
113
|
+
// "private-decorated-field",
|
|
114
|
+
// "protected-decorated-field",
|
|
115
|
+
// "public-decorated-field",
|
|
116
|
+
"private-instance-field",
|
|
117
|
+
"protected-instance-field",
|
|
118
|
+
"public-instance-field",
|
|
119
|
+
// "public-abstract-field",
|
|
120
|
+
// "protected-abstract-field",
|
|
121
|
+
// "private-abstract-field",
|
|
122
|
+
// "private-field",
|
|
123
|
+
// "protected-field",
|
|
124
|
+
// "public-field",
|
|
125
|
+
// "static-field",
|
|
126
|
+
// "instance-field",
|
|
127
|
+
// "abstract-field",
|
|
128
|
+
// "decorated-field",
|
|
129
|
+
// "field",
|
|
130
|
+
// Getters
|
|
131
|
+
// "public-static-get",
|
|
132
|
+
// "protected-static-get",
|
|
133
|
+
// "private-static-get",
|
|
134
|
+
// "public-decorated-get",
|
|
135
|
+
// "protected-decorated-get",
|
|
136
|
+
// "private-decorated-get",
|
|
137
|
+
// "public-instance-get",
|
|
138
|
+
// "protected-instance-get",
|
|
139
|
+
// "private-instance-get",
|
|
140
|
+
// "public-abstract-get",
|
|
141
|
+
// "protected-abstract-get",
|
|
142
|
+
// "private-abstract-get",
|
|
143
|
+
// "public-get",
|
|
144
|
+
// "protected-get",
|
|
145
|
+
// "private-get",
|
|
146
|
+
// "static-get",
|
|
147
|
+
// "instance-get",
|
|
148
|
+
// "abstract-get",
|
|
149
|
+
// "decorated-get",
|
|
150
|
+
// "get",
|
|
151
|
+
// Setters
|
|
152
|
+
// "public-static-set",
|
|
153
|
+
// "protected-static-set",
|
|
154
|
+
// "private-static-set",
|
|
155
|
+
// "public-decorated-set",
|
|
156
|
+
// "protected-decorated-set",
|
|
157
|
+
// "private-decorated-set",
|
|
158
|
+
// "public-instance-set",
|
|
159
|
+
// "protected-instance-set",
|
|
160
|
+
// "private-instance-set",
|
|
161
|
+
// "public-abstract-set",
|
|
162
|
+
// "protected-abstract-set",
|
|
163
|
+
// "private-abstract-set",
|
|
164
|
+
// "public-set",
|
|
165
|
+
// "protected-set",
|
|
166
|
+
// "private-set",
|
|
167
|
+
// "static-set",
|
|
168
|
+
// "instance-set",
|
|
169
|
+
// "abstract-set",
|
|
170
|
+
// "decorated-set",
|
|
171
|
+
// "set",
|
|
172
|
+
// [
|
|
173
|
+
// "get",
|
|
174
|
+
// "set"
|
|
175
|
+
// ],
|
|
176
|
+
[
|
|
177
|
+
"private-static-get",
|
|
178
|
+
"private-static-set"
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
"protected-static-get",
|
|
182
|
+
"protected-static-set"
|
|
183
|
+
],
|
|
184
|
+
[
|
|
185
|
+
"public-static-get",
|
|
186
|
+
"public-static-set"
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
"private-instance-get",
|
|
190
|
+
"private-instance-set"
|
|
191
|
+
],
|
|
192
|
+
[
|
|
193
|
+
"protected-instance-get",
|
|
194
|
+
"protected-instance-set"
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"public-instance-get",
|
|
198
|
+
"public-instance-set"
|
|
199
|
+
],
|
|
200
|
+
// Constructors
|
|
201
|
+
"public-constructor",
|
|
202
|
+
"protected-constructor",
|
|
203
|
+
"private-constructor",
|
|
204
|
+
// "constructor",
|
|
205
|
+
// Methods
|
|
206
|
+
"public-static-method",
|
|
207
|
+
"protected-static-method",
|
|
208
|
+
"private-static-method",
|
|
209
|
+
// "public-decorated-method",
|
|
210
|
+
// "protected-decorated-method",
|
|
211
|
+
// "private-decorated-method",
|
|
212
|
+
"public-instance-method",
|
|
213
|
+
"protected-instance-method",
|
|
214
|
+
"private-instance-method",
|
|
215
|
+
// "public-abstract-method",
|
|
216
|
+
// "protected-abstract-method",
|
|
217
|
+
// "private-abstract-method",
|
|
218
|
+
// "public-method",
|
|
219
|
+
// "protected-method",
|
|
220
|
+
// "private-method",
|
|
221
|
+
// "static-method",
|
|
222
|
+
// "instance-method",
|
|
223
|
+
// "abstract-method",
|
|
224
|
+
// "decorated-method",
|
|
225
|
+
// "method"
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
"@typescript-eslint/method-signature-style": [
|
|
230
|
+
"error",
|
|
231
|
+
"method"
|
|
232
|
+
],
|
|
233
|
+
"@typescript-eslint/naming-convention": [
|
|
234
|
+
"error",
|
|
235
|
+
{
|
|
236
|
+
"selector": "memberLike",
|
|
237
|
+
"modifiers": [
|
|
238
|
+
"private"
|
|
239
|
+
],
|
|
240
|
+
"format": [
|
|
241
|
+
"camelCase"
|
|
242
|
+
],
|
|
243
|
+
"leadingUnderscore": "require"
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
247
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
248
|
+
"error",
|
|
249
|
+
{
|
|
250
|
+
"ignoreArrowShorthand": true
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
"no-dupe-class-members": "off",
|
|
254
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
255
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
256
|
+
"no-duplicate-imports": "off",
|
|
257
|
+
"@typescript-eslint/no-duplicate-imports": "error",
|
|
258
|
+
"no-empty-function": "off",
|
|
259
|
+
"@typescript-eslint/no-empty-function": [
|
|
260
|
+
"error",
|
|
261
|
+
{
|
|
262
|
+
"allow": [
|
|
263
|
+
"private-constructors"
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
268
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
269
|
+
"no-extra-parens": "off",
|
|
270
|
+
"@typescript-eslint/no-extra-parens": [
|
|
271
|
+
"error",
|
|
272
|
+
"all",
|
|
273
|
+
{
|
|
274
|
+
"nestedBinaryExpressions": false
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"no-extra-semi": "off",
|
|
278
|
+
"@typescript-eslint/no-extra-semi": "error",
|
|
279
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
280
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
281
|
+
"no-implied-eval": "off",
|
|
282
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
283
|
+
"no-invalid-this": "off",
|
|
284
|
+
"@typescript-eslint/no-invalid-this": "error",
|
|
285
|
+
"@typescript-eslint/no-invalid-void-type": "error",
|
|
286
|
+
"no-loop-func": "off",
|
|
287
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
288
|
+
"no-loss-of-precision": "off",
|
|
289
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
290
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
291
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
292
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
293
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
294
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
295
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
296
|
+
"no-redeclare": "off",
|
|
297
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
298
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
299
|
+
"@typescript-eslint/no-throw-literal": "error",
|
|
300
|
+
"@typescript-eslint/no-unnecessary-condition": [
|
|
301
|
+
"error",
|
|
302
|
+
{
|
|
303
|
+
"allowConstantLoopConditions": true
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
307
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
308
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
309
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
310
|
+
"no-unused-expressions": "off",
|
|
311
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
312
|
+
"no-unused-vars": "off",
|
|
313
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
314
|
+
"no-use-before-define": "off",
|
|
315
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
316
|
+
"no-useless-constructor": "off",
|
|
317
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
318
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
319
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
320
|
+
"@typescript-eslint/parameter-properties": "error",
|
|
321
|
+
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
322
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
323
|
+
"@typescript-eslint/prefer-literal-enum-member": "error",
|
|
324
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
325
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
326
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
327
|
+
"@typescript-eslint/prefer-ts-expect-error": "error",
|
|
328
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
329
|
+
"no-return-await": "off",
|
|
330
|
+
"@typescript-eslint/return-await": "error",
|
|
331
|
+
"semi": "off",
|
|
332
|
+
"@typescript-eslint/semi": "error",
|
|
333
|
+
"@typescript-eslint/unbound-method": "error"
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AlgType = void 0;
|
|
4
|
+
// public
|
|
4
5
|
var AlgType;
|
|
5
6
|
(function (AlgType) {
|
|
6
7
|
AlgType[AlgType["hmac"] = 1] = "hmac";
|
|
8
|
+
// dsig = 2
|
|
7
9
|
})(AlgType = exports.AlgType || (exports.AlgType = {}));
|
|
8
10
|
//# sourceMappingURL=alg-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alg-type.js","sourceRoot":"","sources":["../../src/api-security/alg-type.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"alg-type.js","sourceRoot":"","sources":["../../src/api-security/alg-type.ts"],"names":[],"mappings":";;;AAAA,SAAS;AACT,IAAY,OAIX;AAJD,WAAY,OAAO;IAEf,qCAAQ,CAAA;IACR,WAAW;AACf,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB"}
|
|
@@ -2,7 +2,7 @@ export declare class Claim {
|
|
|
2
2
|
private readonly _type;
|
|
3
3
|
private readonly _value;
|
|
4
4
|
get type(): string;
|
|
5
|
-
get value():
|
|
6
|
-
constructor(type: string, value:
|
|
5
|
+
get value(): unknown;
|
|
6
|
+
constructor(type: string, value: unknown);
|
|
7
7
|
equals(claim: Claim): boolean;
|
|
8
8
|
}
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Claim = void 0;
|
|
4
4
|
const n_defensive_1 = require("@nivinjoseph/n-defensive");
|
|
5
|
+
// public
|
|
5
6
|
class Claim {
|
|
6
7
|
constructor(type, value) {
|
|
7
|
-
n_defensive_1.given(type, "type").ensureHasValue();
|
|
8
|
+
(0, n_defensive_1.given)(type, "type").ensureHasValue().ensureIsString();
|
|
8
9
|
this._type = type.trim();
|
|
9
10
|
this._value = value;
|
|
10
11
|
}
|
|
11
12
|
get type() { return this._type; }
|
|
12
13
|
get value() { return this._value; }
|
|
13
14
|
equals(claim) {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
14
16
|
if (claim == null)
|
|
15
17
|
return false;
|
|
16
18
|
if (claim === this)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/api-security/claim.ts"],"names":[],"mappings":";;;AAAA,0DAAiD;
|
|
1
|
+
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/api-security/claim.ts"],"names":[],"mappings":";;;AAAA,0DAAiD;AAGjD,SAAS;AACT,MAAa,KAAK;IAUd,YAAmB,IAAY,EAAE,KAAc;QAE3C,IAAA,mBAAK,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;QAEtD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAVD,IAAW,IAAI,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,IAAW,KAAK,KAAc,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAY5C,MAAM,CAAC,KAAY;QAEtB,uEAAuE;QACvE,IAAI,KAAK,IAAI,IAAI;YACb,OAAO,KAAK,CAAC;QAEjB,IAAI,KAAK,KAAK,IAAI;YACd,OAAO,IAAI,CAAC;QAEhB,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC;IAClE,CAAC;CACJ;AA9BD,sBA8BC"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClaimsIdentity = void 0;
|
|
4
4
|
const n_defensive_1 = require("@nivinjoseph/n-defensive");
|
|
5
|
+
// public
|
|
5
6
|
class ClaimsIdentity {
|
|
6
7
|
constructor(claims) {
|
|
7
|
-
n_defensive_1.given(claims, "claims").ensureHasValue();
|
|
8
|
+
(0, n_defensive_1.given)(claims, "claims").ensureHasValue().ensureIsArray();
|
|
8
9
|
this._claims = [...claims];
|
|
9
10
|
}
|
|
10
11
|
get claims() { return this._claims; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claims-identity.js","sourceRoot":"","sources":["../../src/api-security/claims-identity.ts"],"names":[],"mappings":";;;AACA,0DAAiD;
|
|
1
|
+
{"version":3,"file":"claims-identity.js","sourceRoot":"","sources":["../../src/api-security/claims-identity.ts"],"names":[],"mappings":";;;AACA,0DAAiD;AAGjD,SAAS;AACT,MAAa,cAAc;IAQvB,YAAmB,MAA4B;QAE3C,IAAA,mBAAK,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE,CAAC;QAEzD,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;IAC/B,CAAC;IARD,IAAW,MAAM,KAA2B,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAW3D,QAAQ,CAAC,KAAY;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,CAAC;CACJ;AApBD,wCAoBC"}
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExpiredTokenException = void 0;
|
|
4
4
|
const n_exception_1 = require("@nivinjoseph/n-exception");
|
|
5
5
|
const n_defensive_1 = require("@nivinjoseph/n-defensive");
|
|
6
|
+
// public
|
|
6
7
|
class ExpiredTokenException extends n_exception_1.Exception {
|
|
7
8
|
constructor(token) {
|
|
8
|
-
n_defensive_1.given(token, "token").ensureHasValue();
|
|
9
|
+
(0, n_defensive_1.given)(token, "token").ensureHasValue().ensureIsString();
|
|
9
10
|
token = token.trim();
|
|
10
11
|
super(`Token '${token}' is expired.`);
|
|
11
12
|
this._token = token;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expired-token-exception.js","sourceRoot":"","sources":["../../src/api-security/expired-token-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,0DAAiD;
|
|
1
|
+
{"version":3,"file":"expired-token-exception.js","sourceRoot":"","sources":["../../src/api-security/expired-token-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,0DAAiD;AAGjD,SAAS;AACT,MAAa,qBAAsB,SAAQ,uBAAS;IAQhD,YAAmB,KAAa;QAE5B,IAAA,mBAAK,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;QACxD,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,CAAC,UAAU,KAAK,eAAe,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IATD,IAAW,KAAK,KAAa,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;CAUrD;AAfD,sDAeC"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InvalidTokenException = void 0;
|
|
4
4
|
const n_exception_1 = require("@nivinjoseph/n-exception");
|
|
5
5
|
const n_defensive_1 = require("@nivinjoseph/n-defensive");
|
|
6
|
+
// public
|
|
6
7
|
class InvalidTokenException extends n_exception_1.Exception {
|
|
7
8
|
constructor(token, reason) {
|
|
8
|
-
n_defensive_1.given(token, "token").ensureHasValue();
|
|
9
|
-
n_defensive_1.given(reason, "reason").ensureHasValue();
|
|
9
|
+
(0, n_defensive_1.given)(token, "token").ensureHasValue().ensureIsString();
|
|
10
|
+
(0, n_defensive_1.given)(reason, "reason").ensureHasValue().ensureIsString();
|
|
10
11
|
token = token.trim();
|
|
11
12
|
super(`Token '${token}' is invalid because ${reason}.`);
|
|
12
13
|
this._token = token;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-token-exception.js","sourceRoot":"","sources":["../../src/api-security/invalid-token-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,0DAAiD;
|
|
1
|
+
{"version":3,"file":"invalid-token-exception.js","sourceRoot":"","sources":["../../src/api-security/invalid-token-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,0DAAiD;AAGjD,SAAS;AACT,MAAa,qBAAsB,SAAQ,uBAAS;IAUhD,YAAmB,KAAa,EAAE,MAAc;QAE5C,IAAA,mBAAK,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;QACxD,IAAA,mBAAK,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;QAE1D,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,CAAC,UAAU,KAAK,wBAAwB,MAAM,GAAG,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAbD,IAAW,KAAK,KAAa,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,IAAW,MAAM,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;CAavD;AApBD,sDAoBC"}
|
|
@@ -15,9 +15,9 @@ export declare class JsonWebToken {
|
|
|
15
15
|
get isExpired(): boolean;
|
|
16
16
|
get claims(): ReadonlyArray<Claim>;
|
|
17
17
|
private constructor();
|
|
18
|
-
generateToken(): string;
|
|
19
18
|
static fromClaims(issuer: string, algType: AlgType, key: string, expiry: number, claims: Array<Claim>): JsonWebToken;
|
|
20
19
|
static fromToken(issuer: string, algType: AlgType, key: string, token: string): JsonWebToken;
|
|
21
|
-
private
|
|
22
|
-
|
|
20
|
+
private static _toObject;
|
|
21
|
+
generateToken(): string;
|
|
22
|
+
private _toHex;
|
|
23
23
|
}
|
|
@@ -7,17 +7,18 @@ const n_defensive_1 = require("@nivinjoseph/n-defensive");
|
|
|
7
7
|
const invalid_token_exception_1 = require("./invalid-token-exception");
|
|
8
8
|
const alg_type_1 = require("./alg-type");
|
|
9
9
|
const hmac_1 = require("./../crypto/hmac");
|
|
10
|
+
// import { DigitalSignature } from "./../crypto/digital-signature";
|
|
10
11
|
const expired_token_exception_1 = require("./expired-token-exception");
|
|
12
|
+
// public
|
|
11
13
|
class JsonWebToken {
|
|
12
14
|
constructor(issuer, algType, key, isFullKey, expiry, claims) {
|
|
13
|
-
n_defensive_1.given(issuer, "issuer").ensureHasValue();
|
|
14
|
-
n_defensive_1.given(algType, "algType").ensureHasValue().ensureIsEnum(alg_type_1.AlgType);
|
|
15
|
-
n_defensive_1.given(key, "key").ensureHasValue();
|
|
16
|
-
n_defensive_1.given(isFullKey, "isFullKey").ensureHasValue();
|
|
17
|
-
n_defensive_1.given(expiry, "expiry").ensureHasValue();
|
|
18
|
-
n_defensive_1.given(claims, "claims")
|
|
19
|
-
.
|
|
20
|
-
.ensure(t => t.length > 0);
|
|
15
|
+
(0, n_defensive_1.given)(issuer, "issuer").ensureHasValue().ensureIsString();
|
|
16
|
+
(0, n_defensive_1.given)(algType, "algType").ensureHasValue().ensureIsEnum(alg_type_1.AlgType);
|
|
17
|
+
(0, n_defensive_1.given)(key, "key").ensureHasValue().ensureIsString();
|
|
18
|
+
(0, n_defensive_1.given)(isFullKey, "isFullKey").ensureHasValue().ensureIsBoolean();
|
|
19
|
+
(0, n_defensive_1.given)(expiry, "expiry").ensureHasValue().ensureIsNumber();
|
|
20
|
+
(0, n_defensive_1.given)(claims, "claims").ensureHasValue().ensureIsArray()
|
|
21
|
+
.ensure(t => t.isNotEmpty, "cannot be empty");
|
|
21
22
|
this._issuer = issuer.trim();
|
|
22
23
|
this._algType = algType;
|
|
23
24
|
this._key = key.trim();
|
|
@@ -32,29 +33,14 @@ class JsonWebToken {
|
|
|
32
33
|
get expiry() { return this._expiry; }
|
|
33
34
|
get isExpired() { return this._expiry <= Date.now(); }
|
|
34
35
|
get claims() { return this._claims; }
|
|
35
|
-
generateToken() {
|
|
36
|
-
if (!this._isfullKey)
|
|
37
|
-
throw new n_exception_1.InvalidOperationException("generating token using an instance created from token");
|
|
38
|
-
const header = {
|
|
39
|
-
iss: this._issuer,
|
|
40
|
-
alg: this._algType,
|
|
41
|
-
exp: this._expiry
|
|
42
|
-
};
|
|
43
|
-
const body = {};
|
|
44
|
-
this._claims.forEach(t => body[t.type] = t.value);
|
|
45
|
-
const headerAndBody = this.toHex(header) + "." + this.toHex(body);
|
|
46
|
-
const signature = hmac_1.Hmac.create(this._key, headerAndBody);
|
|
47
|
-
const token = headerAndBody + "." + signature;
|
|
48
|
-
return token;
|
|
49
|
-
}
|
|
50
36
|
static fromClaims(issuer, algType, key, expiry, claims) {
|
|
51
37
|
return new JsonWebToken(issuer, algType, key, true, expiry, claims);
|
|
52
38
|
}
|
|
53
39
|
static fromToken(issuer, algType, key, token) {
|
|
54
|
-
n_defensive_1.given(issuer, "issuer").ensureHasValue();
|
|
55
|
-
n_defensive_1.given(algType, "algType").ensureHasValue().ensureIsEnum(alg_type_1.AlgType);
|
|
56
|
-
n_defensive_1.given(key, "key").ensureHasValue();
|
|
57
|
-
n_defensive_1.given(token, "token").ensureHasValue();
|
|
40
|
+
(0, n_defensive_1.given)(issuer, "issuer").ensureHasValue();
|
|
41
|
+
(0, n_defensive_1.given)(algType, "algType").ensureHasValue().ensureIsEnum(alg_type_1.AlgType);
|
|
42
|
+
(0, n_defensive_1.given)(key, "key").ensureHasValue();
|
|
43
|
+
(0, n_defensive_1.given)(token, "token").ensureHasValue();
|
|
58
44
|
issuer = issuer.trim();
|
|
59
45
|
key = key.trim();
|
|
60
46
|
token = token.trim();
|
|
@@ -64,40 +50,74 @@ class JsonWebToken {
|
|
|
64
50
|
const headerString = tokenSplitted[0];
|
|
65
51
|
const bodyString = tokenSplitted[1];
|
|
66
52
|
const signature = tokenSplitted[2];
|
|
67
|
-
const header = JsonWebToken.
|
|
68
|
-
const body = JsonWebToken.
|
|
53
|
+
const header = JsonWebToken._toObject(headerString);
|
|
54
|
+
const body = JsonWebToken._toObject(bodyString);
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
69
56
|
if (header.iss === undefined || header.iss === null)
|
|
70
57
|
throw new invalid_token_exception_1.InvalidTokenException(token, "iss was not present");
|
|
71
58
|
if (header.iss !== issuer)
|
|
72
59
|
throw new invalid_token_exception_1.InvalidTokenException(token, `iss was expected to be '${issuer}' but instead was '${header.iss}'`);
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
73
61
|
if (header.alg === undefined || header.alg === null)
|
|
74
62
|
throw new invalid_token_exception_1.InvalidTokenException(token, "alg was not present");
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
75
64
|
if (header.alg !== algType)
|
|
76
65
|
throw new invalid_token_exception_1.InvalidTokenException(token, `alg was expected to be '${algType}' but instead was '${header.alg}'`);
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
77
67
|
if (header.exp === undefined || header.exp === null)
|
|
78
68
|
throw new invalid_token_exception_1.InvalidTokenException(token, "exp was not present");
|
|
79
|
-
if (typeof
|
|
69
|
+
if (typeof header.exp !== "number")
|
|
80
70
|
throw new invalid_token_exception_1.InvalidTokenException(token, `exp value '${header.exp}' is invalid`);
|
|
81
71
|
if (header.exp <= Date.now())
|
|
82
72
|
throw new expired_token_exception_1.ExpiredTokenException(token);
|
|
73
|
+
// if (algType === AlgType.hmac)
|
|
74
|
+
// {
|
|
75
|
+
// let computedSignature = await Hmac.create(key, headerString + "." + bodyString);
|
|
76
|
+
// if (computedSignature !== signature)
|
|
77
|
+
// throw new InvalidTokenException(token, "signature could not be verified");
|
|
78
|
+
// }
|
|
79
|
+
// else
|
|
80
|
+
// {
|
|
81
|
+
// let verification = await DigitalSignature.verify(key, headerString + "." + bodyString, signature);
|
|
82
|
+
// if (!verification)
|
|
83
|
+
// throw new InvalidTokenException(token, "signature could not be verified");
|
|
84
|
+
// }
|
|
83
85
|
const computedSignature = hmac_1.Hmac.create(key, headerString + "." + bodyString);
|
|
84
86
|
if (computedSignature !== signature)
|
|
85
87
|
throw new invalid_token_exception_1.InvalidTokenException(token, "signature could not be verified");
|
|
86
88
|
const claims = new Array();
|
|
87
|
-
for (
|
|
89
|
+
for (const item in body)
|
|
88
90
|
claims.push(new claim_1.Claim(item, body[item]));
|
|
89
91
|
return new JsonWebToken(issuer, algType, key, false, header.exp, claims);
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
const json = JSON.stringify(obj);
|
|
93
|
-
const hex = Buffer.from(json, "utf8").toString("hex");
|
|
94
|
-
return hex.toUpperCase();
|
|
95
|
-
}
|
|
96
|
-
static toObject(hex) {
|
|
93
|
+
static _toObject(hex) {
|
|
97
94
|
const json = Buffer.from(hex.toLowerCase(), "hex").toString("utf8");
|
|
98
95
|
const obj = JSON.parse(json);
|
|
99
96
|
return obj;
|
|
100
97
|
}
|
|
98
|
+
generateToken() {
|
|
99
|
+
if (!this._isfullKey)
|
|
100
|
+
throw new n_exception_1.InvalidOperationException("generating token using an instance created from token");
|
|
101
|
+
const header = {
|
|
102
|
+
iss: this._issuer,
|
|
103
|
+
alg: this._algType,
|
|
104
|
+
exp: this._expiry
|
|
105
|
+
};
|
|
106
|
+
const body = {};
|
|
107
|
+
this._claims.forEach(t => body[t.type] = t.value);
|
|
108
|
+
const headerAndBody = this._toHex(header) + "." + this._toHex(body);
|
|
109
|
+
// let signature = this._algType === AlgType.hmac
|
|
110
|
+
// ? await Hmac.create(this._key, headerAndBody)
|
|
111
|
+
// : await DigitalSignature.sign(this._key, headerAndBody);
|
|
112
|
+
const signature = hmac_1.Hmac.create(this._key, headerAndBody);
|
|
113
|
+
const token = headerAndBody + "." + signature;
|
|
114
|
+
return token;
|
|
115
|
+
}
|
|
116
|
+
_toHex(obj) {
|
|
117
|
+
const json = JSON.stringify(obj);
|
|
118
|
+
const hex = Buffer.from(json, "utf8").toString("hex");
|
|
119
|
+
return hex.toUpperCase();
|
|
120
|
+
}
|
|
101
121
|
}
|
|
102
122
|
exports.JsonWebToken = JsonWebToken;
|
|
103
123
|
//# sourceMappingURL=json-web-token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-web-token.js","sourceRoot":"","sources":["../../src/api-security/json-web-token.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,0DAAqE;AACrE,0DAAiD;AACjD,uEAAkE;AAClE,yCAAqC;AACrC,2CAAwC;
|
|
1
|
+
{"version":3,"file":"json-web-token.js","sourceRoot":"","sources":["../../src/api-security/json-web-token.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,0DAAqE;AACrE,0DAAiD;AACjD,uEAAkE;AAClE,yCAAqC;AACrC,2CAAwC;AACxC,oEAAoE;AACpE,uEAAkE;AAGlE,SAAS;AACT,MAAa,YAAY;IAmBrB,YAAoB,MAAc,EAAE,OAAgB,EAAE,GAAW,EAAE,SAAkB,EAAE,MAAc,EACjG,MAAoB;QAEpB,IAAA,mBAAK,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;QAC1D,IAAA,mBAAK,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC,cAAc,EAAE,CAAC,YAAY,CAAC,kBAAO,CAAC,CAAC;QACjE,IAAA,mBAAK,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;QACpD,IAAA,mBAAK,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC;QACjE,IAAA,mBAAK,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;QAC1D,IAAA,mBAAK,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,cAAc,EAAE,CAAC,aAAa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