This commit is contained in:
Benjamin Toby
2025-04-23 13:45:48 +01:00
parent cd6bfdfc67
commit d78e44c98d
12 changed files with 42 additions and 21 deletions
+1 -2
View File
@@ -19,7 +19,6 @@ const grabApiCred = ({ key, database, table, user_id, media, }) => {
if (!allowedKeysPath)
throw new Error("process.env.DSQL_API_KEYS_PATH variable not found");
const ApiJSON = (0, decrypt_1.default)({ encryptedString: key });
/** @type {import("../../types").ApiKeyObject} */
const ApiObject = JSON.parse(ApiJSON || "");
const isApiKeyValid = fs_1.default.existsSync(`${allowedKeysPath}/${ApiObject.sign}`);
if (String(ApiObject.user_id) !== String(user_id))
@@ -42,7 +41,7 @@ const grabApiCred = ({ key, database, table, user_id, media, }) => {
return ApiObject;
return null;
}
catch ( /** @type {any} */error) {
catch (error) {
console.log(`api-cred ERROR: ${error.message}`);
return { error: `api-cred ERROR: ${error.message}` };
}