axiodb 9.7.6 → 9.7.8
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/README.md +5 -2
- package/lib/Helper/Console.helper.d.ts +4 -0
- package/lib/Helper/Console.helper.js +23 -0
- package/lib/Helper/Console.helper.js.map +1 -0
- package/lib/Helper/Crypto.helper.js +2 -2
- package/lib/Helper/Crypto.helper.js.map +1 -1
- package/lib/Helper/CryptoGraphy.helper.d.ts +15 -0
- package/lib/Helper/CryptoGraphy.helper.js +52 -0
- package/lib/Helper/CryptoGraphy.helper.js.map +1 -0
- package/lib/Helper/UniqueGenerator.helper.d.ts +12 -0
- package/lib/Helper/UniqueGenerator.helper.js +25 -0
- package/lib/Helper/UniqueGenerator.helper.js.map +1 -0
- package/lib/Helper/response.helper.js +3 -3
- package/lib/Helper/response.helper.js.map +1 -1
- package/lib/Services/Aggregation/Aggregation.Operation.js +4 -4
- package/lib/Services/Aggregation/Aggregation.Operation.js.map +1 -1
- package/lib/Services/CRUD Operation/Create.operation.js +2 -2
- package/lib/Services/CRUD Operation/Create.operation.js.map +1 -1
- package/lib/Services/Collection/collection.operation.js +3 -3
- package/lib/Services/Collection/collection.operation.js.map +1 -1
- package/lib/Services/Database/database.operation.js +4 -4
- package/lib/Services/Database/database.operation.js.map +1 -1
- package/lib/Services/Indexation.operation.js +9 -8
- package/lib/Services/Indexation.operation.js.map +1 -1
- package/lib/Services/Transaction/Session.service.js +2 -2
- package/lib/Services/Transaction/Session.service.js.map +1 -1
- package/lib/Services/Transaction/Transaction.service.js +3 -3
- package/lib/Services/Transaction/Transaction.service.js.map +1 -1
- package/lib/config/Keys/StatusCode.d.ts +63 -0
- package/lib/config/Keys/StatusCode.js +69 -0
- package/lib/config/Keys/StatusCode.js.map +1 -0
- package/lib/server/controller/Collections/Collection.controller.js +14 -14
- package/lib/server/controller/Collections/Collection.controller.js.map +1 -1
- package/lib/server/controller/Database/Databse.controller.js +10 -10
- package/lib/server/controller/Database/Databse.controller.js.map +1 -1
- package/lib/server/controller/Operation/CRUD.controller.js +62 -62
- package/lib/server/controller/Operation/CRUD.controller.js.map +1 -1
- package/lib/server/controller/Stats.controller.js +3 -3
- package/lib/server/controller/Stats.controller.js.map +1 -1
- package/lib/server/router/Router.js +5 -5
- package/lib/server/router/Router.js.map +1 -1
- package/lib/tcp/config/server.d.ts +0 -5
- package/lib/tcp/config/server.js +0 -19
- package/lib/tcp/config/server.js.map +1 -1
- package/package.json +6 -5
- package/lib/server/controller/Key/key.controller.d.ts +0 -38
- package/lib/server/controller/Key/key.controller.js +0 -82
- package/lib/server/controller/Key/key.controller.js.map +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
-
const outers_1 = require("outers");
|
|
17
|
-
const responseBuilder_helper_1 = __importDefault(require("../../helper/responseBuilder.helper"));
|
|
18
|
-
const keys_1 = require("../../config/keys");
|
|
19
|
-
/**
|
|
20
|
-
* Controller class for handling key generation and verification operations.
|
|
21
|
-
*
|
|
22
|
-
* This class provides functionality for generating session keys using JWT (JSON Web Token)
|
|
23
|
-
* and verifying those keys for authentication purposes.
|
|
24
|
-
*
|
|
25
|
-
* @class KeyController
|
|
26
|
-
*/
|
|
27
|
-
class KeyController {
|
|
28
|
-
constructor(Generationkey) {
|
|
29
|
-
this.Generationkey = Generationkey;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Generates a session key using JWT for authentication purposes.
|
|
33
|
-
*
|
|
34
|
-
* This method creates a new JWT token with default server key parameters
|
|
35
|
-
* including issuer, reason, audience, expiration time, and timestamp.
|
|
36
|
-
* The token is encrypted using the specified rounds of encryption.
|
|
37
|
-
*
|
|
38
|
-
* @returns {Promise<string | any>} A promise that resolves to a response object containing
|
|
39
|
-
* the generated session key or an error object in case of failure.
|
|
40
|
-
* The response includes status code, message, and the originSessionKey.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* const keyController = new KeyController();
|
|
44
|
-
* const response = await keyController.generateKey();
|
|
45
|
-
* // response = { statusCode: 200, message: "Key Generated Successfully", data: { originSessionKey: "jwt-token" } }
|
|
46
|
-
*/
|
|
47
|
-
generateKey() {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const originSessionKey = new outers_1.ClassBased.JWT_Manager(this.Generationkey).generate({
|
|
50
|
-
issuer: keys_1.ServerKeys.DEFAULT_KEY_ISSUER,
|
|
51
|
-
Reason: keys_1.ServerKeys.DEFAULT_KEY_REASON,
|
|
52
|
-
audience: keys_1.ServerKeys.DEFAULT_KEY_AUDIENCE,
|
|
53
|
-
expiringIn: keys_1.ServerKeys.DEFAULT_KEY_EXPIRE,
|
|
54
|
-
Timestamp: keys_1.ServerKeys.DEFAULT_KEY_TIMESTAMP,
|
|
55
|
-
}, keys_1.ServerKeys.DEFAULT_KEY_EXPIRE).toKen;
|
|
56
|
-
return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Key Generated Successfully", {
|
|
57
|
-
originSessionKey,
|
|
58
|
-
expiresIn: keys_1.ServerKeys.DEFAULT_KEY_TIMESTAMP,
|
|
59
|
-
expiryTime: keys_1.ServerKeys.DEFAULT_KEY_EXPIRE,
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Verifies the provided API key.
|
|
65
|
-
*
|
|
66
|
-
* @param {string} key - The API key to verify
|
|
67
|
-
* @returns {Promise<string | any>} A response object containing status code and message
|
|
68
|
-
* - If key is valid: Status 200 with success message
|
|
69
|
-
* - If key is invalid: Status 401 with error message
|
|
70
|
-
*/
|
|
71
|
-
verifyKey(key) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const isValid = new outers_1.ClassBased.JWT_Manager(this.Generationkey).decode(key);
|
|
74
|
-
if (!isValid || isValid.status == "Invalid") {
|
|
75
|
-
return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.UNAUTHORIZED, "Invalid Key", null);
|
|
76
|
-
}
|
|
77
|
-
return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Key Verified Successfully", null);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.default = KeyController;
|
|
82
|
-
//# sourceMappingURL=key.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"key.controller.js","sourceRoot":"","sources":["../../../../source/server/controller/Key/key.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,mCAAiD;AACjD,iGAAgE;AAChE,4CAA+C;AAE/C;;;;;;;GAOG;AACH,MAAqB,aAAa;IAGhC,YAAY,aAAqB;QAC/B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACU,WAAW;;YACtB,MAAM,gBAAgB,GAAG,IAAI,mBAAU,CAAC,WAAW,CACjD,IAAI,CAAC,aAAa,CACnB,CAAC,QAAQ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