@aldb2b/common 1.0.440 → 1.0.441
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.
|
@@ -6902,8 +6902,8 @@
|
|
|
6902
6902
|
"affectsGlobalScope": false
|
|
6903
6903
|
},
|
|
6904
6904
|
"../src/utils/encryptor.ts": {
|
|
6905
|
-
"version": "
|
|
6906
|
-
"signature": "
|
|
6905
|
+
"version": "5625e194119f90d3294cbf6e0183a55220fc68b2bb46b140c714efa7c63a27d4",
|
|
6906
|
+
"signature": "111419e1fa999c17873584ee36122978678d6dac8dc6c90ff526e77a2741d36c",
|
|
6907
6907
|
"affectsGlobalScope": false
|
|
6908
6908
|
},
|
|
6909
6909
|
"../src/enums/elastic-sort-order.enum.ts": {
|
|
@@ -12477,7 +12477,8 @@
|
|
|
12477
12477
|
"../node_modules/@types/node/fs.d.ts"
|
|
12478
12478
|
],
|
|
12479
12479
|
"../src/utils/encryptor.ts": [
|
|
12480
|
-
"../node_modules/@nestjs/common/index.d.ts"
|
|
12480
|
+
"../node_modules/@nestjs/common/index.d.ts",
|
|
12481
|
+
"../src/types/encryptRecordType.enum.ts"
|
|
12481
12482
|
],
|
|
12482
12483
|
"../src/utils/equal-array-object.ts": [
|
|
12483
12484
|
"../src/utils/equal-object.ts"
|
|
@@ -17985,6 +17986,9 @@
|
|
|
17985
17986
|
"../src/types/meeting-token.interface.ts": [
|
|
17986
17987
|
"../src/types/encryptRecordType.enum.ts"
|
|
17987
17988
|
],
|
|
17989
|
+
"../src/utils/encryptor.ts": [
|
|
17990
|
+
"../src/types/encryptRecordType.enum.ts"
|
|
17991
|
+
],
|
|
17988
17992
|
"../src/utils/getEndpoint.ts": [
|
|
17989
17993
|
"../src/types/feature.interface.ts"
|
|
17990
17994
|
],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { EncryptRecordType } from "../types/encryptRecordType.enum";
|
|
1
2
|
export declare class Encryptor<T> {
|
|
2
3
|
private cryptr;
|
|
3
4
|
constructor(tokenSerializer: string);
|
|
4
5
|
encrypt(data: T): any;
|
|
5
|
-
decrypt(token: string): T;
|
|
6
|
+
decrypt(token: string, moduleType?: EncryptRecordType): T;
|
|
6
7
|
}
|
package/build/utils/encryptor.js
CHANGED
|
@@ -19,9 +19,13 @@ let Encryptor = class Encryptor {
|
|
|
19
19
|
encrypt(data) {
|
|
20
20
|
return this.cryptr.encrypt(JSON.stringify(data));
|
|
21
21
|
}
|
|
22
|
-
decrypt(token) {
|
|
22
|
+
decrypt(token, moduleType) {
|
|
23
23
|
try {
|
|
24
|
-
|
|
24
|
+
const decodedToken = JSON.parse(this.cryptr.decrypt(token));
|
|
25
|
+
if (moduleType && moduleType !== decodedToken.moduleType) {
|
|
26
|
+
throw new common_1.BadRequestException('Invalid token');
|
|
27
|
+
}
|
|
28
|
+
return decodedToken;
|
|
25
29
|
}
|
|
26
30
|
catch (err) {
|
|
27
31
|
throw new common_1.BadRequestException('Invalid token');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryptor.js","sourceRoot":"","sources":["../../src/utils/encryptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgE;
|
|
1
|
+
{"version":3,"file":"encryptor.js","sourceRoot":"","sources":["../../src/utils/encryptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgE;AAIhE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAGhC,IAAa,SAAS,GAAtB,MAAa,SAAS;IAEpB,YAAY,eAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAA;IAC3C,CAAC;IAED,OAAO,CAAC,IAAO;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,OAAO,CAAC,KAAa,EAAE,UAA8B;QACnD,IAAI;YACF,MAAM,YAAY,GAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAQ,CAAA;YACvE,IAAI,UAAU,IAAI,UAAU,KAAK,YAAY,CAAC,UAAU,EAAE;gBACxD,MAAM,IAAI,4BAAmB,CAAC,eAAe,CAAC,CAAA;aAC/C;YACD,OAAO,YAAY,CAAA;SACpB;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,4BAAmB,CAAC,eAAe,CAAC,CAAA;SAC/C;IACH,CAAC;CACF,CAAA;AArBY,SAAS;IADrB,mBAAU,EAAE;;GACA,SAAS,CAqBrB;AArBY,8BAAS"}
|