This commit is contained in:
Benjamin Toby
2025-07-09 20:30:45 +01:00
parent ccb5605b58
commit c37d105dee
264 changed files with 2389 additions and 3743 deletions
+8 -6
View File
@@ -8,6 +8,7 @@ type Param = {
encryptedString: string;
encryptionKey?: string;
encryptionSalt?: string;
debug?: boolean;
};
/**
@@ -17,9 +18,10 @@ export default function decrypt({
encryptedString,
encryptionKey,
encryptionSalt,
debug,
}: Param) {
if (!encryptedString?.match(/./)) {
console.log("Encrypted string is invalid");
if (debug) console.log("Encrypted string is invalid");
return encryptedString;
}
@@ -32,12 +34,12 @@ export default function decrypt({
} = grabKeys({ encryptionKey });
if (!encrptKey?.match(/.{8,}/)) {
console.log("Decrption key is invalid");
if (debug) console.log("Decrption key is invalid");
return encryptedString;
}
if (!salt?.match(/.{8,}/)) {
console.log("Decrption salt is invalid");
if (debug) console.log("Decrption salt is invalid");
return encryptedString;
}
@@ -51,9 +53,9 @@ export default function decrypt({
decrypted += decipher.final("utf8");
return decrypted;
} catch (error: any) {
console.log("Error in decrypting =>", error.message);
console.log("encryptedString =>", encryptedString);
global.ERROR_CALLBACK?.(`Error Decrypting data`, error as Error);
if (debug) {
console.log("Error Decrypting data", error as Error);
}
return encryptedString;
}
}
-1
View File
@@ -53,7 +53,6 @@ export default function encrypt({
return encrypted;
} catch (error: any) {
console.log("Error in encrypting =>", error.message);
global.ERROR_CALLBACK?.(`Error Encrypting Data`, error as Error);
return data;
}
}