This commit is contained in:
Tben
2023-08-10 14:07:41 +01:00
parent 089f1b56bd
commit b74e2d8aa1
4 changed files with 106 additions and 19 deletions
+1 -15
View File
@@ -26,12 +26,11 @@ const parseCookies = require("../utils/functions/parseCookies");
* @param {http.IncomingMessage} params.request - Http request object
* @param {string} params.encryptionKey - Encryption Key
* @param {string} params.encryptionSalt - Encryption Salt
* @param {("deep" | "normal")?} [params.level] - Optional. "Deep" value indicates an extra layer of security
* @param {string} params.database - Database Name
*
* @returns {{ key: string | undefined, csrf: string | undefined }}
*/
function getToken({ request, encryptionKey, encryptionSalt, level, database }) {
function getToken({ request, encryptionKey, encryptionSalt, database }) {
try {
/**
* Grab the payload
@@ -81,19 +80,6 @@ function getToken({ request, encryptionKey, encryptionSalt, level, database }) {
/** ********************************************** */
/** ********************************************** */
/**
* Grab the payload
*
* @description Grab the payload
*/
if (level?.match(/deep/i) && !csrf?.match(new RegExp(`${userObject.csrf_k}`))) {
return { key: undefined, csrf: undefined };
}
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */
/**
* Return User Object
*