chatbot-nc 2.0.84 → 2.0.86
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/cjs/hashing/idObfuscation.d.ts +1 -1
- package/dist/cjs/hashing/idObfuscation.js +8 -5
- package/dist/cjs/hashing/idObfuscation.js.map +1 -1
- package/dist/esm/hashing/idObfuscation.d.ts +1 -1
- package/dist/esm/hashing/idObfuscation.js +8 -5
- package/dist/esm/hashing/idObfuscation.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const AWSSSM_1 = require("../aws/services/AWSSSM");
|
|
7
7
|
const SSMParameters_1 = require("../config/SSMParameters");
|
|
8
8
|
const hashids_1 = __importDefault(require("hashids"));
|
|
9
|
-
const config = AWSSSM_1.SSM.getSSM(SSMParameters_1.ssmParameter.idObfuscationSSM);
|
|
10
9
|
class idObfuscationService {
|
|
11
10
|
constructor() {
|
|
12
|
-
this.
|
|
11
|
+
this.hash = new hashids_1.default();
|
|
13
12
|
(async () => {
|
|
14
13
|
await this.getHashIds();
|
|
15
14
|
})();
|
|
@@ -17,7 +16,7 @@ class idObfuscationService {
|
|
|
17
16
|
async getHashIds() {
|
|
18
17
|
try {
|
|
19
18
|
this.config = await AWSSSM_1.SSM.getSSMParameter(SSMParameters_1.ssmParameter.idObfuscationSSM);
|
|
20
|
-
this.
|
|
19
|
+
this.hash = await new hashids_1.default(this.config.Salt, +this.config.MinHashLength);
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
22
|
catch (error) {
|
|
@@ -31,7 +30,9 @@ class idObfuscationService {
|
|
|
31
30
|
*/
|
|
32
31
|
async encode(id) {
|
|
33
32
|
try {
|
|
34
|
-
|
|
33
|
+
if (!this.config.Salt)
|
|
34
|
+
await this.getHashIds();
|
|
35
|
+
return await this.hash.encode(id);
|
|
35
36
|
}
|
|
36
37
|
catch (error) {
|
|
37
38
|
throw error;
|
|
@@ -44,7 +45,9 @@ class idObfuscationService {
|
|
|
44
45
|
*/
|
|
45
46
|
async decode(id) {
|
|
46
47
|
try {
|
|
47
|
-
|
|
48
|
+
if (!this.config.Salt)
|
|
49
|
+
await this.getHashIds();
|
|
50
|
+
return await this.hash.decode(id)[0];
|
|
48
51
|
}
|
|
49
52
|
catch (error) {
|
|
50
53
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;AAAA,mDAA4C;AAC5C,2DAAuD;AACvD,sDAA8B;
|
|
1
|
+
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;AAAA,mDAA4C;AAC5C,2DAAuD;AACvD,sDAA8B;AAE9B,MAAM,oBAAoB;IAItB;QAHM,SAAI,GAAY,IAAI,iBAAO,EAAE,CAAC;QAIlC,CAAC,KAAK,IAAG,EAAE;YACP,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;IAEO,KAAK,CAAC,UAAU;QACvB,IAAI;YACA,IAAI,CAAC,MAAM,GAAG,MAAM,YAAG,CAAC,eAAe,CAAC,4BAAY,CAAC,gBAAgB,CAAC,CAAC;YACvE,IAAI,CAAC,IAAI,GAAG,MAAM,IAAI,iBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC5E,OAAO;SACV;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,KAAK,CAAC;SACf;IACF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,EAAS;QAErB,IAAI;YACH,IAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;gBACnB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;SACnC;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,KAAK,CAAC;SACf;IACF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,EAAS;QAErB,IAAI;YACF,IAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;gBACpB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SACtC;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAC;SACb;IACF,CAAC;CACJ;AACD,IAAI,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;AACzC,kBAAe,OAAO,CAAC"}
|
|
@@ -10,10 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { SSM } from "../aws/services/AWSSSM";
|
|
11
11
|
import { ssmParameter } from '../config/SSMParameters';
|
|
12
12
|
import Hashids from "hashids";
|
|
13
|
-
const config = SSM.getSSM(ssmParameter.idObfuscationSSM);
|
|
14
13
|
class idObfuscationService {
|
|
15
14
|
constructor() {
|
|
16
|
-
this.
|
|
15
|
+
this.hash = new Hashids();
|
|
17
16
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
yield this.getHashIds();
|
|
19
18
|
}))();
|
|
@@ -22,7 +21,7 @@ class idObfuscationService {
|
|
|
22
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
22
|
try {
|
|
24
23
|
this.config = yield SSM.getSSMParameter(ssmParameter.idObfuscationSSM);
|
|
25
|
-
this.
|
|
24
|
+
this.hash = yield new Hashids(this.config.Salt, +this.config.MinHashLength);
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
27
|
catch (error) {
|
|
@@ -38,7 +37,9 @@ class idObfuscationService {
|
|
|
38
37
|
encode(id) {
|
|
39
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
39
|
try {
|
|
41
|
-
|
|
40
|
+
if (!this.config.Salt)
|
|
41
|
+
yield this.getHashIds();
|
|
42
|
+
return yield this.hash.encode(id);
|
|
42
43
|
}
|
|
43
44
|
catch (error) {
|
|
44
45
|
throw error;
|
|
@@ -53,7 +54,9 @@ class idObfuscationService {
|
|
|
53
54
|
decode(id) {
|
|
54
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
56
|
try {
|
|
56
|
-
|
|
57
|
+
if (!this.config.Salt)
|
|
58
|
+
yield this.getHashIds();
|
|
59
|
+
return yield this.hash.decode(id)[0];
|
|
57
60
|
}
|
|
58
61
|
catch (error) {
|
|
59
62
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,oBAAoB;IAItB;QAHM,SAAI,GAAY,IAAI,OAAO,EAAE,CAAC;QAIlC,CAAC,GAAQ,EAAE;YACP,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC,CAAA,CAAC,EAAE,CAAC;IACP,CAAC;IAEa,UAAU;;YACvB,IAAI;gBACA,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC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