@naturalcycles/nodejs-lib 15.14.0 → 15.15.0
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/dist/jwt/jwt.service.js
CHANGED
|
@@ -24,9 +24,7 @@ export class JWTService {
|
|
|
24
24
|
}
|
|
25
25
|
sign(payload, schema, opt = {}) {
|
|
26
26
|
_assert(this.cfg.privateKey, 'JWTService: privateKey is required to be able to verify, but not provided');
|
|
27
|
-
schema?.validate(payload
|
|
28
|
-
mutateInput: true,
|
|
29
|
-
});
|
|
27
|
+
schema?.validate(payload);
|
|
30
28
|
return jsonwebtoken.sign(payload, this.cfg.privateKey, {
|
|
31
29
|
algorithm: this.cfg.algorithm,
|
|
32
30
|
noTimestamp: true,
|
|
@@ -42,9 +40,7 @@ export class JWTService {
|
|
|
42
40
|
...this.cfg.verifyOptions,
|
|
43
41
|
...opt,
|
|
44
42
|
});
|
|
45
|
-
schema?.validate(data
|
|
46
|
-
mutateInput: true,
|
|
47
|
-
});
|
|
43
|
+
schema?.validate(data);
|
|
48
44
|
return data;
|
|
49
45
|
}
|
|
50
46
|
catch (err) {
|
|
@@ -63,9 +59,7 @@ export class JWTService {
|
|
|
63
59
|
_assert(data?.payload, 'invalid token, decoded value is empty', {
|
|
64
60
|
...this.cfg.errorData,
|
|
65
61
|
});
|
|
66
|
-
schema?.validate(data.payload
|
|
67
|
-
mutateInput: true,
|
|
68
|
-
});
|
|
62
|
+
schema?.validate(data.payload);
|
|
69
63
|
return data;
|
|
70
64
|
}
|
|
71
65
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/nodejs-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.15.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@naturalcycles/js-lib": "^15",
|
|
7
7
|
"@types/js-yaml": "^4",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"ajv-keywords": "^5",
|
|
13
13
|
"chalk": "^5",
|
|
14
14
|
"dotenv": "^17",
|
|
15
|
-
"joi": "^
|
|
15
|
+
"joi": "^18",
|
|
16
16
|
"js-yaml": "^4",
|
|
17
17
|
"jsonwebtoken": "^9",
|
|
18
18
|
"lru-cache": "^11",
|
package/src/jwt/jwt.service.ts
CHANGED
|
@@ -69,9 +69,7 @@ export class JWTService {
|
|
|
69
69
|
'JWTService: privateKey is required to be able to verify, but not provided',
|
|
70
70
|
)
|
|
71
71
|
|
|
72
|
-
schema?.validate(payload
|
|
73
|
-
mutateInput: true,
|
|
74
|
-
})
|
|
72
|
+
schema?.validate(payload)
|
|
75
73
|
|
|
76
74
|
return jsonwebtoken.sign(payload, this.cfg.privateKey, {
|
|
77
75
|
algorithm: this.cfg.algorithm,
|
|
@@ -99,9 +97,7 @@ export class JWTService {
|
|
|
99
97
|
...opt,
|
|
100
98
|
}) as T
|
|
101
99
|
|
|
102
|
-
schema?.validate(data
|
|
103
|
-
mutateInput: true,
|
|
104
|
-
})
|
|
100
|
+
schema?.validate(data)
|
|
105
101
|
|
|
106
102
|
return data
|
|
107
103
|
} catch (err) {
|
|
@@ -134,9 +130,7 @@ export class JWTService {
|
|
|
134
130
|
...this.cfg.errorData,
|
|
135
131
|
})
|
|
136
132
|
|
|
137
|
-
schema?.validate(data.payload
|
|
138
|
-
mutateInput: true,
|
|
139
|
-
})
|
|
133
|
+
schema?.validate(data.payload)
|
|
140
134
|
|
|
141
135
|
return data
|
|
142
136
|
}
|