@thefirstspine/certificate-authority 1.0.3 → 1.0.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.service.d.ts","sourceRoot":"","sources":["../../src/service/validator.service.ts"],"names":[],"mappings":"AAMA,qBAAa,gBAAgB;IAO3B,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,GAAC,SAAqB,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"validator.service.d.ts","sourceRoot":"","sources":["../../src/service/validator.service.ts"],"names":[],"mappings":"AAMA,qBAAa,gBAAgB;IAO3B,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,GAAC,SAAqB,GAAG,OAAO;IAoBjF,OAAO,CAAC,QAAQ;CAIjB;;AAED,wBAAsC"}
|
|
@@ -27,8 +27,8 @@ exports.ValidatorService = void 0;
|
|
|
27
27
|
const crypto = __importStar(require("crypto"));
|
|
28
28
|
class ValidatorService {
|
|
29
29
|
challenge(certificate, privateKey = undefined) {
|
|
30
|
-
const publicKeyStr =
|
|
31
|
-
const privateKeyStr = privateKey != undefined ?
|
|
30
|
+
const publicKeyStr = this.sanatize(certificate);
|
|
31
|
+
const privateKeyStr = privateKey != undefined ? this.sanatize(privateKey) : this.sanatize(process.env.PRIVATE_KEY);
|
|
32
32
|
try {
|
|
33
33
|
const challenge = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(10);
|
|
34
34
|
const encryptedBuffer = crypto.publicEncrypt(publicKeyStr, Buffer.from(challenge));
|
|
@@ -38,6 +38,9 @@ class ValidatorService {
|
|
|
38
38
|
catch (exception) { }
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
+
sanatize(input) {
|
|
42
|
+
return input.replace(/\\n/gm, '\n');
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
exports.ValidatorService = ValidatorService;
|
|
43
46
|
exports.default = new ValidatorService();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.service.js","sourceRoot":"","sources":["../../src/service/validator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAMjC,MAAa,gBAAgB;IAO3B,SAAS,CAAC,WAAmB,EAAE,aAA+B,SAAS;QAErE,MAAM,YAAY,GAAW,
|
|
1
|
+
{"version":3,"file":"validator.service.js","sourceRoot":"","sources":["../../src/service/validator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAMjC,MAAa,gBAAgB;IAO3B,SAAS,CAAC,WAAmB,EAAE,aAA+B,SAAS;QAErE,MAAM,YAAY,GAAW,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACxD,MAAM,aAAa,GAAW,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAE3H,IAAI,CAAC;YAEH,MAAM,SAAS,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAG3F,MAAM,eAAe,GAAW,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAC3F,MAAM,eAAe,GAAW,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YAGtF,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,SAAS,CAAC;QAClD,CAAC;QAAC,OAAO,SAAS,EAAE,CAAC,CAAA,CAAC;QAEtB,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,QAAQ,CAAC,KAAa;QAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CAEF;AA/BD,4CA+BC;AAED,kBAAe,IAAI,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thefirstspine/certificate-authority",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Self-signed certificate authority to automate & check secure layer for protected endpoints.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"minimist": "^1.2.8"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@types/node": "^20.10.
|
|
15
|
-
"eslint": "^8.
|
|
14
|
+
"@types/node": "^20.10.5",
|
|
15
|
+
"eslint": "^8.56.0",
|
|
16
16
|
"jest": "^29.7.0",
|
|
17
17
|
"rimraf": "^5.0.5",
|
|
18
18
|
"ts-jest": "^29.1.1",
|
|
19
|
-
"typescript": "^5.3.
|
|
19
|
+
"typescript": "^5.3.3"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "rimraf ./lib && tsc -b",
|