chatbot-nc 2.0.85 → 2.0.87
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 +9 -6
- package/dist/cjs/hashing/idObfuscation.js.map +1 -1
- package/dist/esm/hashing/idObfuscation.d.ts +1 -1
- package/dist/esm/hashing/idObfuscation.js +9 -6
- package/dist/esm/hashing/idObfuscation.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,16 +8,15 @@ const SSMParameters_1 = require("../config/SSMParameters");
|
|
|
8
8
|
const hashids_1 = __importDefault(require("hashids"));
|
|
9
9
|
class idObfuscationService {
|
|
10
10
|
constructor() {
|
|
11
|
-
this.
|
|
11
|
+
this.hash = new hashids_1.default();
|
|
12
12
|
(async () => {
|
|
13
|
-
this.config = await AWSSSM_1.SSM.getSSMParameter(SSMParameters_1.ssmParameter.idObfuscationSSM);
|
|
14
13
|
await this.getHashIds();
|
|
15
14
|
})();
|
|
16
15
|
}
|
|
17
16
|
async getHashIds() {
|
|
18
17
|
try {
|
|
19
|
-
|
|
20
|
-
this.
|
|
18
|
+
this.config = await AWSSSM_1.SSM.getSSMParameter(SSMParameters_1.ssmParameter.idObfuscationSSM);
|
|
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 || !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 || !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;AAE9B,MAAM,oBAAoB;IAItB;QAHM,
|
|
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;YACF,IAAG,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;gBACpC,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,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;gBACpC,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"}
|
|
@@ -12,17 +12,16 @@ import { ssmParameter } from '../config/SSMParameters';
|
|
|
12
12
|
import Hashids from "hashids";
|
|
13
13
|
class idObfuscationService {
|
|
14
14
|
constructor() {
|
|
15
|
-
this.
|
|
15
|
+
this.hash = new Hashids();
|
|
16
16
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
this.config = yield SSM.getSSMParameter(ssmParameter.idObfuscationSSM);
|
|
18
17
|
yield this.getHashIds();
|
|
19
18
|
}))();
|
|
20
19
|
}
|
|
21
20
|
getHashIds() {
|
|
22
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
22
|
try {
|
|
24
|
-
|
|
25
|
-
this.
|
|
23
|
+
this.config = yield SSM.getSSMParameter(ssmParameter.idObfuscationSSM);
|
|
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 || !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 || !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;AAE9B,MAAM,oBAAoB;IAItB;QAHM,
|
|
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,YAAY,CAAC,gBA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